diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2017-01-04 00:40:45 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2017-01-04 00:40:45 -0500 |
commit | 2ec41c415f39990561cc9da4c9bad0b69bfad489 (patch) | |
tree | 01a5234df9caa1e9db39d76bf31ba8a3a622298c /lisp/org | |
parent | f49f8c1454e19123572a071bf582271c70d28f01 (diff) | |
download | emacs-2ec41c415f39990561cc9da4c9bad0b69bfad489.tar.gz emacs-2ec41c415f39990561cc9da4c9bad0b69bfad489.tar.bz2 emacs-2ec41c415f39990561cc9da4c9bad0b69bfad489.zip |
Avoid add-to-list on local variables
* lisp/gnus/nnir.el: Use lexical-binding and cl-lib.
(nnir-retrieve-headers): Use pcase.
(nnir-search-thread): Avoid add-to-list on local variables.
* lisp/gnus/smime.el: Use lexical-binding and cl-lib.
(smime-verify-region): Avoid add-to-list on local variables.
* lisp/mail/undigest.el: Use lexical-binding and cl-lib.
(rmail-digest-parse-mime, rmail-digest-rfc1153)
(rmail-digest-parse-rfc934): Avoid add-to-list on local variable.
* lisp/net/ldap.el (ldap-search): Move init into declaration.
* lisp/net/newst-backend.el (newsticker--cache-add):
Avoid add-to-list on local variables; Simplify code with `assq'.
* lisp/net/zeroconf.el: Use lexical-binding and cl-lib.
(dbus-debug): Remove declaration, unused.
(zeroconf-service-add-hook, zeroconf-service-remove-hook)
(zeroconf-service-browser-handler, zeroconf-publish-service):
Avoid add-to-list and *-hook on local variables.
* lisp/org/org-archive.el (org-all-archive-files):
* lisp/org/org-agenda.el (org-agenda-get-restriction-and-command):
Avoid add-to-list on local variables.
* lisp/org/ox-publish.el (org-publish--run-functions): New function.
(org-publish-projects): Use it to avoid run-hooks on a local variable.
(org-publish-cache-file-needs-publishing): Avoid add-to-list on
local variables.
* lisp/progmodes/ada-prj.el: Use setq instead of (set '...).
(ada-prj-load-from-file): Avoid add-to-list on local variables.
* lisp/progmodes/ada-xref.el (ada-initialize-runtime-library): Simplify.
(ada-gnat-parse-gpr, ada-parse-prj-file-1)
(ada-xref-find-in-modified-ali): Avoid add-to-list on local variables.
* lisp/progmodes/idlw-shell.el (idlwave-shell-update-bp-overlays):
Avoid add-to-list on local variables.
Diffstat (limited to 'lisp/org')
-rw-r--r-- | lisp/org/org-agenda.el | 2 | ||||
-rw-r--r-- | lisp/org/org-archive.el | 5 | ||||
-rw-r--r-- | lisp/org/ox-publish.el | 21 |
3 files changed, 20 insertions, 8 deletions
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index e119d9ffeb1..c870ddd4e43 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -2928,7 +2928,7 @@ L Timeline for current buffer # List stuck projects (!=configure) type (nth 2 entry) match (nth 3 entry)) (if (> (length key) 1) - (add-to-list 'prefixes (string-to-char key)) + (pushnew (string-to-char key) prefixes :test #'equal) (setq line (format "%-4s%-14s" diff --git a/lisp/org/org-archive.el b/lisp/org/org-archive.el index a7afa19c0f9..39a6581046a 100644 --- a/lisp/org/org-archive.el +++ b/lisp/org/org-archive.el @@ -29,6 +29,7 @@ ;;; Code: (require 'org) +(eval-when-compile (require 'cl)) (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ()) (declare-function org-datetree-find-date-create "org-datetree" (date &optional keep-restriction)) @@ -163,11 +164,11 @@ archive file is." (setq file (org-extract-archive-file (org-match-string-no-properties 2))) (and file (> (length file) 0) (file-exists-p file) - (add-to-list 'files file))))) + (pushnew file files :test #'equal))))) (setq files (nreverse files)) (setq file (org-extract-archive-file)) (and file (> (length file) 0) (file-exists-p file) - (add-to-list 'files file)) + (pushnew file files :test #'equal)) files)) (defun org-extract-archive-file (&optional location) diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el index fdab9ac46e6..4ebc073990e 100644 --- a/lisp/org/ox-publish.el +++ b/lisp/org/ox-publish.el @@ -662,6 +662,13 @@ See `org-publish-projects'." filename pub-dir publishing-function base-dir))) (unless no-cache (org-publish-write-cache-file)))) +(defun org-publish--run-functions (functions) + (cond + ((null functions) nil) + ((functionp functions) (funcall functions)) + ((consp functions) (mapc #'funcall functions)) + (t (error "Neither a function nor a list: %S" functions)))) + (defun org-publish-projects (projects) "Publish all files belonging to the PROJECTS alist. If `:auto-sitemap' is set, publish the sitemap too. If @@ -690,7 +697,7 @@ If `:auto-sitemap' is set, publish the sitemap too. If (theindex (expand-file-name "theindex.org" (plist-get project-plist :base-directory)))) - (when preparation-function (run-hooks 'preparation-function)) + (org-publish--run-functions preparation-function) (if sitemap-p (funcall sitemap-function project sitemap-filename)) ;; Publish all files from PROJECT excepted "theindex.org". Its ;; publishing will be deferred until "theindex.inc" is @@ -704,7 +711,7 @@ If `:auto-sitemap' is set, publish the sitemap too. If (org-publish-index-generate-theindex project (plist-get project-plist :base-directory)) (org-publish-file theindex project t)) - (when completion-function (run-hooks 'completion-function)) + (org-publish--run-functions completion-function) (org-publish-write-cache-file))) (org-publish-expand-projects projects))) @@ -1171,9 +1178,13 @@ the file including them will be republished as well." (goto-char (point-min)) (while (re-search-forward "^#\\+INCLUDE:[ \t]+\"\\([^\t\n\r\"]*\\)\"[ \t]*.*$" nil t) - (let* ((included-file (expand-file-name (match-string 1)))) - (add-to-list 'included-files-ctime - (org-publish-cache-ctime-of-src included-file) t)))) + (let* ((included-file (expand-file-name (match-string 1))) + (ctime (org-publish-cache-ctime-of-src included-file))) + (unless (member ctime included-files-ctime) + ;; FIXME: The original code insisted on appending this ctime + ;; to the end of the list, even tho the order seems irrelevant. + (setq included-files-ctime + (append included-files-ctime (list ctime))))))) (unless visiting (kill-buffer buf))) (if (null pstamp) t (let ((ctime (org-publish-cache-ctime-of-src filename))) |