aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2015-08-08 19:41:57 -0400
committerStefan Monnier2015-08-08 19:41:57 -0400
commit3a5f75193ed10ee5fb458e9879340947f31d5e12 (patch)
treed35ef9485627600c28debc86d0c4f7c749928209
parent45987b34535e5ae97fa14535630e283f34af94dd (diff)
downloademacs-3a5f75193ed10ee5fb458e9879340947f31d5e12.tar.gz
emacs-3a5f75193ed10ee5fb458e9879340947f31d5e12.zip
* org.el: Fix up some lexical scoping warnings, and use dolist
* lisp/org/org.el (org-set-regexps-and-options-for-tags, org-goto-map) (org-set-regexps-and-options, org-assign-fast-keys) (org-contextualize-keys, org-contextualize-validate-key) (org-notes-order-reversed-p, org-local-logging, org-map-entries) (org-find-olp, org-find-exact-heading-in-directory) (org-cycle-agenda-files, org-release-buffers, org-fill-template) (org-agenda-prepare-buffers, org-occur-in-agenda-files) (org-replace-escapes): Use dolist. (org-mode): Optimize away XEmacs-only code. (org-refile-get-targets): Remove unused var `f'. (org-fast-todo-selection): Remove unused var `e'. (org-make-tags-matcher): Use dolist. Remove unused var `term'. (org-fast-tag-selection): Use dolist. Remove unused var `e'. (org-format-latex): Use dolist. Remove unused var `e'. (org-toggle-heading): Access vars lexically rather than dynamically. (org-backward-sentence, org-forward-sentence, org-meta-return) (org-kill-line): Mark arg as unused. (org-submit-bug-report): Silence compiler warning. (org-occur-in-agenda-files): Don't use add-to-list on local vars. (org-get-cursor-date): Remove unused var `tm'. (org-comment-or-uncomment-region): Use standard name `_'. (reftex-docstruct-symbol, reftex-cite-format): Declare to silence byte-compiler. (org-reftex-citation): Add `org--' prefix to dynamically scoped `rds' var.
-rw-r--r--lisp/org/org.el214
1 files changed, 114 insertions, 100 deletions
diff --git a/lisp/org/org.el b/lisp/org/org.el
index b545f9ee1cb..0cc185c0d75 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -4860,8 +4860,8 @@ Support for group tags is controlled by the option
4860 (if (characterp (cdr tg)) 4860 (if (characterp (cdr tg))
4861 (format "(%s)" (char-to-string (cdr tg))) ""))))) 4861 (format "(%s)" (char-to-string (cdr tg))) "")))))
4862 org-tag-alist))) 4862 org-tag-alist)))
4863 (let (e tgs g) 4863 (let (tgs g)
4864 (while (setq e (pop tags)) 4864 (dolist (e tags)
4865 (cond 4865 (cond
4866 ((equal e "{") 4866 ((equal e "{")
4867 (progn (push '(:startgroup) tgs) 4867 (progn (push '(:startgroup) tgs)
@@ -4875,7 +4875,8 @@ Support for group tags is controlled by the option
4875 ((equal e "\\n") (push '(:newline) tgs)) 4875 ((equal e "\\n") (push '(:newline) tgs))
4876 ((string-match (org-re "^\\([[:alnum:]_@#%]+\\)(\\(.\\))$") e) 4876 ((string-match (org-re "^\\([[:alnum:]_@#%]+\\)(\\(.\\))$") e)
4877 (push (cons (match-string 1 e) 4877 (push (cons (match-string 1 e)
4878 (string-to-char (match-string 2 e))) tgs) 4878 (string-to-char (match-string 2 e)))
4879 tgs)
4879 (if (and g (> g 0)) 4880 (if (and g (> g 0))
4880 (setcar org-tag-groups-alist 4881 (setcar org-tag-groups-alist
4881 (append (car org-tag-groups-alist) 4882 (append (car org-tag-groups-alist)
@@ -4887,7 +4888,7 @@ Support for group tags is controlled by the option
4887 (append (car org-tag-groups-alist) (list e)))) 4888 (append (car org-tag-groups-alist) (list e))))
4888 (if g (setq g (1+ g)))))) 4889 (if g (setq g (1+ g))))))
4889 (org-set-local 'org-tag-alist nil) 4890 (org-set-local 'org-tag-alist nil)
4890 (while (setq e (pop tgs)) 4891 (dolist (e tgs)
4891 (or (and (stringp (car e)) 4892 (or (and (stringp (car e))
4892 (assoc (car e) org-tag-alist)) 4893 (assoc (car e) org-tag-alist))
4893 (push e org-tag-alist))) 4894 (push e org-tag-alist)))
@@ -4957,7 +4958,8 @@ Support for group tags is controlled by the option
4957 ((string-match "\\`\\([a-zA-Z][0-9a-zA-Z_]*\\)_TODO\\'" key) 4958 ((string-match "\\`\\([a-zA-Z][0-9a-zA-Z_]*\\)_TODO\\'" key)
4958 ;; general TODO-like setup 4959 ;; general TODO-like setup
4959 (push (cons (intern (downcase (match-string 1 key))) 4960 (push (cons (intern (downcase (match-string 1 key)))
4960 (org-split-string value splitre)) kwds)) 4961 (org-split-string value splitre))
4962 kwds))
4961 ((equal key "COLUMNS") 4963 ((equal key "COLUMNS")
4962 (org-set-local 'org-columns-default-format value)) 4964 (org-set-local 'org-columns-default-format value))
4963 ((equal key "LINK") 4965 ((equal key "LINK")
@@ -4978,8 +4980,8 @@ Support for group tags is controlled by the option
4978 (org-table-set-constants)) 4980 (org-table-set-constants))
4979 ((equal key "STARTUP") 4981 ((equal key "STARTUP")
4980 (let ((opts (org-split-string value splitre)) 4982 (let ((opts (org-split-string value splitre))
4981 l var val) 4983 var val)
4982 (while (setq l (pop opts)) 4984 (dolist (l opts)
4983 (when (setq l (assoc l org-startup-options)) 4985 (when (setq l (assoc l org-startup-options))
4984 (setq var (nth 1 l) val (nth 2 l)) 4986 (setq var (nth 1 l) val (nth 2 l))
4985 (if (not (nth 3 l)) 4987 (if (not (nth 3 l))
@@ -5041,8 +5043,8 @@ Support for group tags is controlled by the option
5041 (default-value 'org-todo-keywords))))) 5043 (default-value 'org-todo-keywords)))))
5042 (setq kwds (reverse kwds))) 5044 (setq kwds (reverse kwds)))
5043 (setq kwds (nreverse kwds)) 5045 (setq kwds (nreverse kwds))
5044 (let (inter kws kw) 5046 (let (inter kw)
5045 (while (setq kws (pop kwds)) 5047 (dolist (kws kwds)
5046 (let ((kws (or 5048 (let ((kws (or
5047 (run-hook-with-args-until-success 5049 (run-hook-with-args-until-success
5048 'org-todo-setup-filter-hook kws) 5050 'org-todo-setup-filter-hook kws)
@@ -5210,8 +5212,8 @@ This will extract info from a string like \"WAIT(w@/!)\"."
5210(defun org-assign-fast-keys (alist) 5212(defun org-assign-fast-keys (alist)
5211 "Assign fast keys to a keyword-key alist. 5213 "Assign fast keys to a keyword-key alist.
5212Respect keys that are already there." 5214Respect keys that are already there."
5213 (let (new e (alt ?0)) 5215 (let (new (alt ?0))
5214 (while (setq e (pop alist)) 5216 (dolist (e alist)
5215 (if (or (memq (car e) '(:newline :grouptags :endgroup :startgroup)) 5217 (if (or (memq (car e) '(:newline :grouptags :endgroup :startgroup))
5216 (cdr e)) ;; Key already assigned. 5218 (cdr e)) ;; Key already assigned.
5217 (push e new) 5219 (push e new)
@@ -5330,8 +5332,9 @@ The following commands are available:
5330 (define-key org-mode-map [menu-bar show] 'undefined)) 5332 (define-key org-mode-map [menu-bar show] 'undefined))
5331 5333
5332 (org-load-modules-maybe) 5334 (org-load-modules-maybe)
5333 (easy-menu-add org-org-menu) 5335 (when (featurep 'xemacs)
5334 (easy-menu-add org-tbl-menu) 5336 (easy-menu-add org-org-menu)
5337 (easy-menu-add org-tbl-menu))
5335 (org-install-agenda-files-menu) 5338 (org-install-agenda-files-menu)
5336 (if org-descriptive-links (add-to-invisibility-spec '(org-link))) 5339 (if org-descriptive-links (add-to-invisibility-spec '(org-link)))
5337 (add-to-invisibility-spec '(org-cwidth)) 5340 (add-to-invisibility-spec '(org-cwidth))
@@ -7265,9 +7268,8 @@ Optional arguments START and END can be used to limit the range."
7265 (setq org-goto-map 7268 (setq org-goto-map
7266 (let ((map (make-sparse-keymap))) 7269 (let ((map (make-sparse-keymap)))
7267 (let ((cmds '(isearch-forward isearch-backward kill-ring-save set-mark-command 7270 (let ((cmds '(isearch-forward isearch-backward kill-ring-save set-mark-command
7268 mouse-drag-region universal-argument org-occur)) 7271 mouse-drag-region universal-argument org-occur)))
7269 cmd) 7272 (dolist (cmd cmds)
7270 (while (setq cmd (pop cmds))
7271 (substitute-key-definition cmd cmd map global-map))) 7273 (substitute-key-definition cmd cmd map global-map)))
7272 (suppress-keymap map) 7274 (suppress-keymap map)
7273 (org-defkey map "\C-m" 'org-goto-ret) 7275 (org-defkey map "\C-m" 'org-goto-ret)
@@ -8564,7 +8566,8 @@ and still retain the repeater to cover future instances of the task."
8564 (goto-char (point-min)) 8566 (goto-char (point-min))
8565 (while (re-search-forward drawer-re nil t) 8567 (while (re-search-forward drawer-re nil t)
8566 (mapc (lambda (d) 8568 (mapc (lambda (d)
8567 (org-remove-empty-drawer-at d (point))) org-drawers))) 8569 (org-remove-empty-drawer-at d (point)))
8570 org-drawers)))
8568 (goto-char (point-min)) 8571 (goto-char (point-min))
8569 (when doshift 8572 (when doshift
8570 (while (re-search-forward org-ts-regexp-both nil t) 8573 (while (re-search-forward org-ts-regexp-both nil t)
@@ -8598,7 +8601,8 @@ Optional argument WITH-CASE means sort case-sensitively."
8598 (while (string-match org-bracket-link-regexp s) 8601 (while (string-match org-bracket-link-regexp s)
8599 (setq s (replace-match (if (match-end 2) 8602 (setq s (replace-match (if (match-end 2)
8600 (match-string 3 s) 8603 (match-string 3 s)
8601 (match-string 1 s)) t t s))) 8604 (match-string 1 s))
8605 t t s)))
8602 (let ((st (format " %s " s))) 8606 (let ((st (format " %s " s)))
8603 (while (string-match org-emph-re st) 8607 (while (string-match org-emph-re st)
8604 (setq st (replace-match (format " %s " (match-string 4 st)) t t st))) 8608 (setq st (replace-match (format " %s " (match-string 4 st)) t t st)))
@@ -9148,10 +9152,11 @@ definitions."
9148 (list (car c) (car c) (cadr c))) 9152 (list (car c) (car c) (cadr c)))
9149 ((string= "" (cadr c)) 9153 ((string= "" (cadr c))
9150 (list (car c) (car c) (caddr c))) 9154 (list (car c) (car c) (caddr c)))
9151 (t c))) contexts)) 9155 (t c)))
9152 (a alist) c r s) 9156 contexts))
9157 (a alist) r s)
9153 ;; loop over all commands or templates 9158 ;; loop over all commands or templates
9154 (while (setq c (pop a)) 9159 (dolist (c a)
9155 (let (vrules repl) 9160 (let (vrules repl)
9156 (cond 9161 (cond
9157 ((not (assoc (car c) contexts)) 9162 ((not (assoc (car c) contexts))
@@ -9161,7 +9166,8 @@ definitions."
9161 (car c) contexts))) 9166 (car c) contexts)))
9162 (mapc (lambda (vr) 9167 (mapc (lambda (vr)
9163 (when (not (equal (car vr) (cadr vr))) 9168 (when (not (equal (car vr) (cadr vr)))
9164 (setq repl vr))) vrules) 9169 (setq repl vr)))
9170 vrules)
9165 (if (not repl) (push c r) 9171 (if (not repl) (push c r)
9166 (push (cadr repl) s) 9172 (push (cadr repl) s)
9167 (push 9173 (push
@@ -9178,14 +9184,16 @@ definitions."
9178 (let ((tpl (car x))) 9184 (let ((tpl (car x)))
9179 (when (not (delq 9185 (when (not (delq
9180 nil 9186 nil
9181 (mapcar (lambda(y) 9187 (mapcar (lambda (y)
9182 (equal y tpl)) s))) x))) 9188 (equal y tpl))
9189 s)))
9190 x)))
9183 (reverse r)))))) 9191 (reverse r))))))
9184 9192
9185(defun org-contextualize-validate-key (key contexts) 9193(defun org-contextualize-validate-key (key contexts)
9186 "Check CONTEXTS for agenda or capture KEY." 9194 "Check CONTEXTS for agenda or capture KEY."
9187 (let (r rr res) 9195 (let (rr res)
9188 (while (setq r (pop contexts)) 9196 (dolist (r contexts)
9189 (mapc 9197 (mapc
9190 (lambda (rr) 9198 (lambda (rr)
9191 (when 9199 (when
@@ -9484,7 +9492,8 @@ active region."
9484 (funcall (caar sfuns))) 9492 (funcall (caar sfuns)))
9485 (setq link (plist-get org-store-link-plist :link) 9493 (setq link (plist-get org-store-link-plist :link)
9486 desc (or (plist-get org-store-link-plist 9494 desc (or (plist-get org-store-link-plist
9487 :description) link)))) 9495 :description)
9496 link))))
9488 9497
9489 ;; Store a link from a source code buffer 9498 ;; Store a link from a source code buffer
9490 ((org-src-edit-buffer-p) 9499 ((org-src-edit-buffer-p)
@@ -9664,7 +9673,8 @@ active region."
9664 9673
9665 ;; Return the link 9674 ;; Return the link
9666 (if (not (and (or (org-called-interactively-p 'any) 9675 (if (not (and (or (org-called-interactively-p 'any)
9667 executing-kbd-macro) link)) 9676 executing-kbd-macro)
9677 link))
9668 (or agenda-link (and link (org-make-link-string link desc))) 9678 (or agenda-link (and link (org-make-link-string link desc)))
9669 (push (list link desc) org-stored-links) 9679 (push (list link desc) org-stored-links)
9670 (message "Stored: %s" (or desc link)) 9680 (message "Stored: %s" (or desc link))
@@ -10897,7 +10907,7 @@ visibility around point, thus ignoring
10897enclose the position of `org-open-link-marker'." 10907enclose the position of `org-open-link-marker'."
10898 (let ((m org-open-link-marker)) 10908 (let ((m org-open-link-marker))
10899 (catch 'exit 10909 (catch 'exit
10900 (while (apply 're-search-forward args) 10910 (while (apply #'re-search-forward args)
10901 (unless (get-text-property (match-end group) 'intangible) ; Emacs 21 10911 (unless (get-text-property (match-end group) 'intangible) ; Emacs 21
10902 (goto-char (match-end group)) 10912 (goto-char (match-end group))
10903 (if (and (or (not (eq (marker-buffer m) (current-buffer))) 10913 (if (and (or (not (eq (marker-buffer m) (current-buffer)))
@@ -11248,12 +11258,9 @@ on the system \"/user@host:\"."
11248 ((eq t org-reverse-note-order) t) 11258 ((eq t org-reverse-note-order) t)
11249 ((not (listp org-reverse-note-order)) nil) 11259 ((not (listp org-reverse-note-order)) nil)
11250 (t (catch 'exit 11260 (t (catch 'exit
11251 (let ((all org-reverse-note-order) 11261 (dolist (entry org-reverse-note-order)
11252 entry) 11262 (if (string-match (car entry) buffer-file-name)
11253 (while (setq entry (pop all)) 11263 (throw 'exit (cdr entry))))))))
11254 (if (string-match (car entry) buffer-file-name)
11255 (throw 'exit (cdr entry))))
11256 nil)))))
11257 11264
11258(defvar org-refile-target-table nil 11265(defvar org-refile-target-table nil
11259 "The list of refile targets, created by `org-refile'.") 11266 "The list of refile targets, created by `org-refile'.")
@@ -11318,10 +11325,10 @@ on the system \"/user@host:\"."
11318 (let ((case-fold-search nil) 11325 (let ((case-fold-search nil)
11319 ;; otherwise org confuses "TODO" as a kw and "Todo" as a word 11326 ;; otherwise org confuses "TODO" as a kw and "Todo" as a word
11320 (entries (or org-refile-targets '((nil . (:level . 1))))) 11327 (entries (or org-refile-targets '((nil . (:level . 1)))))
11321 targets tgs txt re files f desc descre fast-path-p level pos0) 11328 targets tgs txt re files desc descre fast-path-p level pos0)
11322 (message "Getting targets...") 11329 (message "Getting targets...")
11323 (with-current-buffer (or default-buffer (current-buffer)) 11330 (with-current-buffer (or default-buffer (current-buffer))
11324 (while (setq entry (pop entries)) 11331 (dolist (entry entries)
11325 (setq files (car entry) desc (cdr entry)) 11332 (setq files (car entry) desc (cdr entry))
11326 (setq fast-path-p nil) 11333 (setq fast-path-p nil)
11327 (cond 11334 (cond
@@ -11354,7 +11361,7 @@ on the system \"/user@host:\"."
11354 (cdr desc))) 11361 (cdr desc)))
11355 "\\}[ \t]"))) 11362 "\\}[ \t]")))
11356 (t (error "Bad refiling target description %s" desc))) 11363 (t (error "Bad refiling target description %s" desc)))
11357 (while (setq f (pop files)) 11364 (dolist (f files)
11358 (with-current-buffer 11365 (with-current-buffer
11359 (if (bufferp f) f (org-get-agenda-file-buffer f)) 11366 (if (bufferp f) f (org-get-agenda-file-buffer f))
11360 (or 11367 (or
@@ -12736,20 +12743,19 @@ This hook runs even if there is no statistics cookie present, in which case
12736 12743
12737(defun org-local-logging (value) 12744(defun org-local-logging (value)
12738 "Get logging settings from a property VALUE." 12745 "Get logging settings from a property VALUE."
12739 (let* (words w a) 12746 ;; Directly set the variables, they are already local.
12740 ;; directly set the variables, they are already local. 12747 (setq org-log-done nil
12741 (setq org-log-done nil 12748 org-log-repeat nil
12742 org-log-repeat nil 12749 org-todo-log-states nil)
12743 org-todo-log-states nil) 12750 (dolist (w (org-split-string value))
12744 (setq words (org-split-string value)) 12751 (let* (a)
12745 (while (setq w (pop words))
12746 (cond 12752 (cond
12747 ((setq a (assoc w org-startup-options)) 12753 ((setq a (assoc w org-startup-options))
12748 (and (member (nth 1 a) '(org-log-done org-log-repeat)) 12754 (and (member (nth 1 a) '(org-log-done org-log-repeat))
12749 (set (nth 1 a) (nth 2 a)))) 12755 (set (nth 1 a) (nth 2 a))))
12750 ((setq a (org-extract-log-state-settings w)) 12756 ((setq a (org-extract-log-state-settings w))
12751 (and (member (car a) org-todo-keywords-1) 12757 (and (member (car a) org-todo-keywords-1)
12752 (push a org-todo-log-states))))))) 12758 (push a org-todo-log-states)))))))
12753 12759
12754(defun org-get-todo-sequence-head (kwd) 12760(defun org-get-todo-sequence-head (kwd)
12755 "Return the head of the TODO sequence to which KWD belongs. 12761 "Return the head of the TODO sequence to which KWD belongs.
@@ -12779,7 +12785,7 @@ Returns the new TODO keyword, or nil if no state change should occur."
12779 (expert nil) 12785 (expert nil)
12780 (fwidth (+ maxlen 3 1 3)) 12786 (fwidth (+ maxlen 3 1 3))
12781 (ncol (/ (- (window-width) 4) fwidth)) 12787 (ncol (/ (- (window-width) 4) fwidth))
12782 tg cnt e c tbl 12788 tg cnt c tbl
12783 groups ingroup) 12789 groups ingroup)
12784 (save-excursion 12790 (save-excursion
12785 (save-window-excursion 12791 (save-window-excursion
@@ -12789,7 +12795,7 @@ Returns the new TODO keyword, or nil if no state change should occur."
12789 (erase-buffer) 12795 (erase-buffer)
12790 (org-set-local 'org-done-keywords done-keywords) 12796 (org-set-local 'org-done-keywords done-keywords)
12791 (setq tbl fulltable cnt 0) 12797 (setq tbl fulltable cnt 0)
12792 (while (setq e (pop tbl)) 12798 (dolist (e tbl)
12793 (cond 12799 (cond
12794 ((equal e '(:startgroup)) 12800 ((equal e '(:startgroup))
12795 (push '() groups) (setq ingroup t) 12801 (push '() groups) (setq ingroup t)
@@ -14123,7 +14129,7 @@ See also `org-scan-tags'.
14123 (re (org-re "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL\\([<=>]\\{1,2\\}\\)\\([0-9]+\\)\\|\\(\\(?:[[:alnum:]_]+\\(?:\\\\-\\)*\\)+\\)\\([<>=]\\{1,2\\}\\)\\({[^}]+}\\|\"[^\"]*\"\\|-?[.0-9]+\\(?:[eE][-+]?[0-9]+\\)?\\)\\|[[:alnum:]_@#%]+\\)")) 14129 (re (org-re "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL\\([<=>]\\{1,2\\}\\)\\([0-9]+\\)\\|\\(\\(?:[[:alnum:]_]+\\(?:\\\\-\\)*\\)+\\)\\([<>=]\\{1,2\\}\\)\\({[^}]+}\\|\"[^\"]*\"\\|-?[.0-9]+\\(?:[eE][-+]?[0-9]+\\)?\\)\\|[[:alnum:]_@#%]+\\)"))
14124 minus tag mm 14130 minus tag mm
14125 tagsmatch todomatch tagsmatcher todomatcher kwd matcher 14131 tagsmatch todomatch tagsmatcher todomatcher kwd matcher
14126 orterms term orlist re-p str-p level-p level-op time-p 14132 orterms orlist re-p str-p level-p level-op time-p
14127 prop-p pn pv po gv rest (start 0) (ss 0)) 14133 prop-p pn pv po gv rest (start 0) (ss 0))
14128 ;; Expand group tags 14134 ;; Expand group tags
14129 (setq match (org-tags-expand match)) 14135 (setq match (org-tags-expand match))
@@ -14152,7 +14158,7 @@ See also `org-scan-tags'.
14152 (if (or (not tagsmatch) (not (string-match "\\S-" tagsmatch))) 14158 (if (or (not tagsmatch) (not (string-match "\\S-" tagsmatch)))
14153 (setq tagsmatcher t) 14159 (setq tagsmatcher t)
14154 (setq orterms (org-split-string tagsmatch "|") orlist nil) 14160 (setq orterms (org-split-string tagsmatch "|") orlist nil)
14155 (while (setq term (pop orterms)) 14161 (dolist (term orterms)
14156 (while (and (equal (substring term -1) "\\") orterms) 14162 (while (and (equal (substring term -1) "\\") orterms)
14157 (setq term (concat term "|" (pop orterms)))) ; repair bad split 14163 (setq term (concat term "|" (pop orterms)))) ; repair bad split
14158 (while (string-match re term) 14164 (while (string-match re term)
@@ -14213,7 +14219,7 @@ See also `org-scan-tags'.
14213 (if (or (not todomatch) (not (string-match "\\S-" todomatch))) 14219 (if (or (not todomatch) (not (string-match "\\S-" todomatch)))
14214 (setq todomatcher t) 14220 (setq todomatcher t)
14215 (setq orterms (org-split-string todomatch "|") orlist nil) 14221 (setq orterms (org-split-string todomatch "|") orlist nil)
14216 (while (setq term (pop orterms)) 14222 (dolist (term orterms)
14217 (while (string-match re term) 14223 (while (string-match re term)
14218 (setq minus (and (match-end 1) 14224 (setq minus (and (match-end 1)
14219 (equal (match-string 1 term) "-")) 14225 (equal (match-string 1 term) "-"))
@@ -14282,7 +14288,8 @@ When DOWNCASE is non-nil, expand downcased TAGS."
14282 (with-syntax-table stable 14288 (with-syntax-table stable
14283 (string-match 14289 (string-match
14284 (concat "\\(?1:[+-]?\\)\\(?2:\\<" 14290 (concat "\\(?1:[+-]?\\)\\(?2:\\<"
14285 (regexp-opt tml) "\\>\\)") rtnmatch))) 14291 (regexp-opt tml) "\\>\\)")
14292 rtnmatch)))
14286 (let* ((dir (match-string 1 rtnmatch)) 14293 (let* ((dir (match-string 1 rtnmatch))
14287 (tag (match-string 2 rtnmatch)) 14294 (tag (match-string 2 rtnmatch))
14288 (tag (if downcased (downcase tag) tag))) 14295 (tag (if downcased (downcase tag) tag)))
@@ -14418,7 +14425,8 @@ ignore inherited ones."
14418 (reverse (delete-dups 14425 (reverse (delete-dups
14419 (reverse (append 14426 (reverse (append
14420 (org-remove-uninherited-tags 14427 (org-remove-uninherited-tags
14421 org-file-tags) tags))))))))) 14428 org-file-tags)
14429 tags)))))))))
14422 14430
14423(defun org-add-prop-inherited (s) 14431(defun org-add-prop-inherited (s)
14424 (add-text-properties 0 (length s) '(inherited t) s) 14432 (add-text-properties 0 (length s) '(inherited t) s)
@@ -14750,7 +14758,7 @@ Returns the new tags string, or nil to not change the current settings."
14750 (ncol (/ (- (window-width) 4) fwidth)) 14758 (ncol (/ (- (window-width) 4) fwidth))
14751 (i-face 'org-done) 14759 (i-face 'org-done)
14752 (c-face 'org-todo) 14760 (c-face 'org-todo)
14753 tg cnt e c char c1 c2 ntable tbl rtn 14761 tg cnt c char c1 c2 ntable tbl rtn
14754 ov-start ov-end ov-prefix 14762 ov-start ov-end ov-prefix
14755 (exit-after-next org-fast-tag-selection-single-key) 14763 (exit-after-next org-fast-tag-selection-single-key)
14756 (done-keywords org-done-keywords) 14764 (done-keywords org-done-keywords)
@@ -14785,7 +14793,7 @@ Returns the new tags string, or nil to not change the current settings."
14785 (org-fast-tag-show-exit exit-after-next) 14793 (org-fast-tag-show-exit exit-after-next)
14786 (org-set-current-tags-overlay current ov-prefix) 14794 (org-set-current-tags-overlay current ov-prefix)
14787 (setq tbl fulltable char ?a cnt 0) 14795 (setq tbl fulltable char ?a cnt 0)
14788 (while (setq e (pop tbl)) 14796 (dolist (e tbl)
14789 (cond 14797 (cond
14790 ((equal (car e) :startgroup) 14798 ((equal (car e) :startgroup)
14791 (push '() groups) (setq ingroup t) 14799 (push '() groups) (setq ingroup t)
@@ -15077,7 +15085,7 @@ a *different* entry, you cannot use these techniques."
15077 ((eq scope 'file-with-archives) 15085 ((eq scope 'file-with-archives)
15078 (setq scope (org-add-archive-files (list (buffer-file-name)))))) 15086 (setq scope (org-add-archive-files (list (buffer-file-name))))))
15079 (org-agenda-prepare-buffers scope) 15087 (org-agenda-prepare-buffers scope)
15080 (while (setq file (pop scope)) 15088 (dolist (file scope)
15081 (with-current-buffer (org-find-base-buffer-visiting file) 15089 (with-current-buffer (org-find-base-buffer-visiting file)
15082 (save-excursion 15090 (save-excursion
15083 (save-restriction 15091 (save-restriction
@@ -16034,7 +16042,7 @@ only headings."
16034 (widen) 16042 (widen)
16035 (setq limit (point-max)) 16043 (setq limit (point-max))
16036 (goto-char (point-min)) 16044 (goto-char (point-min))
16037 (while (setq heading (pop path)) 16045 (dolist (heading path)
16038 (setq re (format org-complex-heading-regexp-format 16046 (setq re (format org-complex-heading-regexp-format
16039 (regexp-quote heading))) 16047 (regexp-quote heading)))
16040 (setq cnt 0 pos (point)) 16048 (setq cnt 0 pos (point))
@@ -16079,7 +16087,7 @@ When the target headline is found, return a marker to this location."
16079 nil "\\`[^.#].*\\.org\\'")) 16087 nil "\\`[^.#].*\\.org\\'"))
16080 file visiting m buffer) 16088 file visiting m buffer)
16081 (catch 'found 16089 (catch 'found
16082 (while (setq file (pop files)) 16090 (dolist (file files)
16083 (message "trying %s" file) 16091 (message "trying %s" file)
16084 (setq visiting (org-find-base-buffer-visiting file)) 16092 (setq visiting (org-find-base-buffer-visiting file))
16085 (setq buffer (or visiting (find-file-noselect file))) 16093 (setq buffer (or visiting (find-file-noselect file)))
@@ -18037,7 +18045,7 @@ If the current buffer does not, find the first agenda file."
18037 file) 18045 file)
18038 (unless files (user-error "No agenda files")) 18046 (unless files (user-error "No agenda files"))
18039 (catch 'exit 18047 (catch 'exit
18040 (while (setq file (pop files)) 18048 (dolist (file files)
18041 (if (equal (file-truename file) tcf) 18049 (if (equal (file-truename file) tcf)
18042 (when (car files) 18050 (when (car files)
18043 (find-file (car files)) 18051 (find-file (car files))
@@ -18123,8 +18131,8 @@ it to the list of buffers which might be released later."
18123 "Release all buffers in list, asking the user for confirmation when needed. 18131 "Release all buffers in list, asking the user for confirmation when needed.
18124When a buffer is unmodified, it is just killed. When modified, it is saved 18132When a buffer is unmodified, it is just killed. When modified, it is saved
18125\(if the user agrees) and then killed." 18133\(if the user agrees) and then killed."
18126 (let (buf file) 18134 (let (file)
18127 (while (setq buf (pop blist)) 18135 (dolist (buf blist)
18128 (setq file (buffer-file-name buf)) 18136 (setq file (buffer-file-name buf))
18129 (when (and (buffer-modified-p buf) 18137 (when (and (buffer-modified-p buf)
18130 file 18138 file
@@ -18146,7 +18154,7 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
18146 org-tag-groups-alist-for-agenda nil) 18154 org-tag-groups-alist-for-agenda nil)
18147 (save-excursion 18155 (save-excursion
18148 (save-restriction 18156 (save-restriction
18149 (while (setq file (pop files)) 18157 (dolist (file files)
18150 (catch 'nextfile 18158 (catch 'nextfile
18151 (if (bufferp file) 18159 (if (bufferp file)
18152 (set-buffer file) 18160 (set-buffer file)
@@ -18426,11 +18434,11 @@ Some of the options can be changed using the variable
18426 (optnew org-format-latex-options) 18434 (optnew org-format-latex-options)
18427 (matchers (plist-get opt :matchers)) 18435 (matchers (plist-get opt :matchers))
18428 (re-list org-latex-regexps) 18436 (re-list org-latex-regexps)
18429 (cnt 0) txt hash link beg end re e checkdir 18437 (cnt 0) txt hash link beg end re checkdir
18430 string 18438 string
18431 m n block-type block linkfile movefile ov) 18439 m n block-type block linkfile movefile ov)
18432 ;; Check the different regular expressions 18440 ;; Check the different regular expressions
18433 (while (setq e (pop re-list)) 18441 (dolist (e re-list)
18434 (setq m (car e) re (nth 1 e) n (nth 2 e) block-type (nth 3 e) 18442 (setq m (car e) re (nth 1 e) n (nth 2 e) block-type (nth 3 e)
18435 block (if block-type "\n\n" "")) 18443 block (if block-type "\n\n" ""))
18436 (when (member m matchers) 18444 (when (member m matchers)
@@ -19054,7 +19062,7 @@ BEG and END default to the buffer boundaries."
19054(org-defkey org-mode-map "\C-i" 'org-cycle) 19062(org-defkey org-mode-map "\C-i" 'org-cycle)
19055(org-defkey org-mode-map [(tab)] 'org-cycle) 19063(org-defkey org-mode-map [(tab)] 'org-cycle)
19056(org-defkey org-mode-map [(control tab)] 'org-force-cycle-archived) 19064(org-defkey org-mode-map [(control tab)] 'org-force-cycle-archived)
19057(org-defkey org-mode-map "\M-\t" 'pcomplete) 19065(org-defkey org-mode-map "\M-\t" #'pcomplete)
19058;; The following line is necessary under Suse GNU/Linux 19066;; The following line is necessary under Suse GNU/Linux
19059(unless (featurep 'xemacs) 19067(unless (featurep 'xemacs)
19060 (org-defkey org-mode-map [S-iso-lefttab] 'org-shifttab)) 19068 (org-defkey org-mode-map [S-iso-lefttab] 'org-shifttab))
@@ -19121,7 +19129,7 @@ BEG and END default to the buffer boundaries."
19121 (org-defkey org-mode-map [?\C-c (right)] 'org-shiftright) 19129 (org-defkey org-mode-map [?\C-c (right)] 'org-shiftright)
19122 (org-defkey org-mode-map [?\C-c ?\C-x (right)] 'org-shiftcontrolright) 19130 (org-defkey org-mode-map [?\C-c ?\C-x (right)] 'org-shiftcontrolright)
19123 (org-defkey org-mode-map [?\C-c ?\C-x (left)] 'org-shiftcontrolleft) 19131 (org-defkey org-mode-map [?\C-c ?\C-x (left)] 'org-shiftcontrolleft)
19124 (org-defkey org-mode-map [?\e (tab)] 'pcomplete) 19132 (org-defkey org-mode-map [?\e (tab)] #'pcomplete)
19125 (org-defkey org-mode-map [?\e (shift return)] 'org-insert-todo-heading) 19133 (org-defkey org-mode-map [?\e (shift return)] 'org-insert-todo-heading)
19126 (org-defkey org-mode-map [?\e (shift left)] 'org-shiftmetaleft) 19134 (org-defkey org-mode-map [?\e (shift left)] 'org-shiftmetaleft)
19127 (org-defkey org-mode-map [?\e (shift right)] 'org-shiftmetaright) 19135 (org-defkey org-mode-map [?\e (shift right)] 'org-shiftmetaright)
@@ -20784,8 +20792,8 @@ number of stars to add."
20784 (insert 20792 (insert
20785 (org-list-to-subtree 20793 (org-list-to-subtree
20786 (org-list-parse-list t) 20794 (org-list-parse-list t)
20787 '(:istart (concat stars add-stars (funcall get-stars depth)) 20795 `(:istart (concat ',stars ',add-stars (funcall get-stars depth))
20788 :icount (concat stars add-stars (funcall get-stars depth))))))) 20796 :icount (concat ',stars ',add-stars (funcall get-stars depth)))))))
20789 (setq toggled t)) 20797 (setq toggled t))
20790 (forward-line)))) 20798 (forward-line))))
20791 ;; Case 3. Started at normal text: make every line an heading, 20799 ;; Case 3. Started at normal text: make every line an heading,
@@ -20807,11 +20815,11 @@ number of stars to add."
20807 (forward-line))))))) 20815 (forward-line)))))))
20808 (unless toggled (message "Cannot toggle heading from here")))) 20816 (unless toggled (message "Cannot toggle heading from here"))))
20809 20817
20810(defun org-meta-return (&optional arg) 20818(defun org-meta-return (&optional _arg)
20811 "Insert a new heading or wrap a region in a table. 20819 "Insert a new heading or wrap a region in a table.
20812Calls `org-insert-heading' or `org-table-wrap-region', depending 20820Calls `org-insert-heading' or `org-table-wrap-region', depending
20813on context. See the individual commands for more information." 20821on context. See the individual commands for more information."
20814 (interactive "P") 20822 (interactive)
20815 (org-check-before-invisible-edit 'insert) 20823 (org-check-before-invisible-edit 'insert)
20816 (or (run-hook-with-args-until-success 'org-metareturn-hook) 20824 (or (run-hook-with-args-until-success 'org-metareturn-hook)
20817 (let* ((element (org-element-at-point)) 20825 (let* ((element (org-element-at-point))
@@ -21109,6 +21117,7 @@ output buffer into your mail program, as it gives us important
21109information about your Org-mode version and configuration." 21117information about your Org-mode version and configuration."
21110 (interactive) 21118 (interactive)
21111 (require 'reporter) 21119 (require 'reporter)
21120 (defvar reporter-prompt-for-summary-p)
21112 (org-load-modules-maybe) 21121 (org-load-modules-maybe)
21113 (org-require-autoloaded-modules) 21122 (org-require-autoloaded-modules)
21114 (let ((reporter-prompt-for-summary-p "Bug report subject: ")) 21123 (let ((reporter-prompt-for-summary-p "Bug report subject: "))
@@ -21368,11 +21377,13 @@ upon the next fontification round."
21368 'invisible 'org-link s)) 21377 'invisible 'org-link s))
21369 (setq s (concat (substring s 0 b) 21378 (setq s (concat (substring s 0 b)
21370 (substring s (or (next-single-property-change 21379 (substring s (or (next-single-property-change
21371 b 'invisible s) (length s))))))) 21380 b 'invisible s)
21381 (length s)))))))
21372 (while (setq b (text-property-any 0 (length s) 'org-cwidth t s)) 21382 (while (setq b (text-property-any 0 (length s) 'org-cwidth t s))
21373 (setq s (concat (substring s 0 b) 21383 (setq s (concat (substring s 0 b)
21374 (substring s (or (next-single-property-change 21384 (substring s (or (next-single-property-change
21375 b 'org-cwidth s) (length s)))))) 21385 b 'org-cwidth s)
21386 (length s))))))
21376 (setq l (string-width s) b -1) 21387 (setq l (string-width s) b -1)
21377 (while (setq b (text-property-any (1+ b) (length s) 'org-dwidth t s)) 21388 (while (setq b (text-property-any (1+ b) (length s) 'org-dwidth t s))
21378 (setq l (- l (get-text-property b 'org-dwidth-n s)))) 21389 (setq l (- l (get-text-property b 'org-dwidth-n s))))
@@ -21469,11 +21480,9 @@ N may optionally be the number of spaces to remove."
21469 21480
21470(defun org-fill-template (template alist) 21481(defun org-fill-template (template alist)
21471 "Find each %key of ALIST in TEMPLATE and replace it." 21482 "Find each %key of ALIST in TEMPLATE and replace it."
21472 (let ((case-fold-search nil) 21483 (let ((case-fold-search nil))
21473 entry key value) 21484 (dolist (entry (sort (copy-sequence alist)
21474 (setq alist (sort (copy-sequence alist) 21485 (lambda (a b) (< (length (car a)) (length (car b))))))
21475 (lambda (a b) (< (length (car a)) (length (car b))))))
21476 (while (setq entry (pop alist))
21477 (setq template 21486 (setq template
21478 (replace-regexp-in-string 21487 (replace-regexp-in-string
21479 (concat "%" (regexp-quote (car entry))) 21488 (concat "%" (regexp-quote (car entry)))
@@ -21795,23 +21804,24 @@ block from point."
21795 "^[ \t]*:end:.*$" 21804 "^[ \t]*:end:.*$"
21796 lim-up lim-down)))) 21805 lim-up lim-down))))
21797 21806
21798(defun org-occur-in-agenda-files (regexp &optional nlines) 21807(defun org-occur-in-agenda-files (regexp &optional _nlines)
21799 "Call `multi-occur' with buffers for all agenda files." 21808 "Call `multi-occur' with buffers for all agenda files."
21800 (interactive "sOrg-files matching: \np") 21809 (interactive "sOrg-files matching: ")
21801 (let* ((files (org-agenda-files)) 21810 (let* ((files (org-agenda-files))
21802 (tnames (mapcar 'file-truename files)) 21811 (tnames (mapcar #'file-truename files))
21803 (extra org-agenda-text-search-extra-files) 21812 (extra org-agenda-text-search-extra-files))
21804 f)
21805 (when (eq (car extra) 'agenda-archives) 21813 (when (eq (car extra) 'agenda-archives)
21806 (setq extra (cdr extra)) 21814 (setq extra (cdr extra))
21807 (setq files (org-add-archive-files files))) 21815 (setq files (org-add-archive-files files)))
21808 (while (setq f (pop extra)) 21816 (dolist (f extra)
21809 (unless (member (file-truename f) tnames) 21817 (unless (member (file-truename f) tnames)
21810 (add-to-list 'files f 'append) 21818 (unless (member f files) (setq files (append files (list f))))
21811 (add-to-list 'tnames (file-truename f) 'append))) 21819 (setq tnames (append tnames (list (file-truename f))))))
21812 (multi-occur 21820 (multi-occur
21813 (mapcar (lambda (x) 21821 (mapcar (lambda (x)
21814 (with-current-buffer 21822 (with-current-buffer
21823 ;; FIXME: Why not just (find-file-noselect x)?
21824 ;; Is it to avoid the "revert buffer" prompt?
21815 (or (get-file-buffer x) (find-file-noselect x)) 21825 (or (get-file-buffer x) (find-file-noselect x))
21816 (widen) 21826 (widen)
21817 (current-buffer))) 21827 (current-buffer)))
@@ -21996,7 +22006,7 @@ so values can contain further %-escapes if they are define later in TABLE."
21996 (case-fold-search nil) 22006 (case-fold-search nil)
21997 (pchg 0) 22007 (pchg 0)
21998 e re rpl) 22008 e re rpl)
21999 (while (setq e (pop tbl)) 22009 (dolist (e tbl)
22000 (setq re (concat "%-?[0-9.]*" (substring (car e) 1))) 22010 (setq re (concat "%-?[0-9.]*" (substring (car e) 1)))
22001 (when (and (cdr e) (string-match re (cdr e))) 22011 (when (and (cdr e) (string-match re (cdr e)))
22002 (let ((sref (substring (cdr e) (match-beginning 0) (match-end 0))) 22012 (let ((sref (substring (cdr e) (match-beginning 0) (match-end 0)))
@@ -22059,7 +22069,7 @@ This works in the calendar and in the agenda, anywhere else it just
22059returns the current time. 22069returns the current time.
22060If WITH-TIME is non-nil, returns the time of the event at point (in 22070If WITH-TIME is non-nil, returns the time of the event at point (in
22061the agenda) or the current time of the day." 22071the agenda) or the current time of the day."
22062 (let (date day defd tp tm hod mod) 22072 (let (date day defd tp hod mod)
22063 (when with-time 22073 (when with-time
22064 (setq tp (get-text-property (point) 'time)) 22074 (setq tp (get-text-property (point) 'time))
22065 (when (and tp (string-match "\\([0-9][0-9]\\):\\([0-9][0-9]\\)" tp)) 22075 (when (and tp (string-match "\\([0-9][0-9]\\):\\([0-9][0-9]\\)" tp))
@@ -22590,7 +22600,7 @@ If the line is empty, insert comment at its beginning."
22590 (insert "# ")) 22600 (insert "# "))
22591 22601
22592(defvar comment-empty-lines) ; From newcomment.el. 22602(defvar comment-empty-lines) ; From newcomment.el.
22593(defun org-comment-or-uncomment-region (beg end &rest ignore) 22603(defun org-comment-or-uncomment-region (beg end &rest _)
22594 "Comment or uncomment each non-blank line in the region. 22604 "Comment or uncomment each non-blank line in the region.
22595Uncomment each non-blank line between BEG and END if it only 22605Uncomment each non-blank line between BEG and END if it only
22596contains commented lines. Otherwise, comment them." 22606contains commented lines. Otherwise, comment them."
@@ -22782,6 +22792,10 @@ this line is also exported in fixed-width font."
22782 (goto-char (match-end 0)) 22792 (goto-char (match-end 0))
22783 (insert org-quote-string " "))))))) 22793 (insert org-quote-string " ")))))))
22784 22794
22795(defvar reftex-docstruct-symbol)
22796(defvar reftex-cite-format)
22797(defvar org--rds)
22798
22785(defun org-reftex-citation () 22799(defun org-reftex-citation ()
22786 "Use reftex-citation to insert a citation into the buffer. 22800 "Use reftex-citation to insert a citation into the buffer.
22787This looks for a line like 22801This looks for a line like
@@ -22796,9 +22810,9 @@ into the buffer.
22796Export of such citations to both LaTeX and HTML is handled by the contributed 22810Export of such citations to both LaTeX and HTML is handled by the contributed
22797package ox-bibtex by Taru Karttunen." 22811package ox-bibtex by Taru Karttunen."
22798 (interactive) 22812 (interactive)
22799 (let ((reftex-docstruct-symbol 'rds) 22813 (let ((reftex-docstruct-symbol 'org--rds)
22800 (reftex-cite-format "\\cite{%l}") 22814 (reftex-cite-format "\\cite{%l}")
22801 rds bib) 22815 org--rds bib)
22802 (save-excursion 22816 (save-excursion
22803 (save-restriction 22817 (save-restriction
22804 (widen) 22818 (widen)
@@ -22809,7 +22823,7 @@ package ox-bibtex by Taru Karttunen."
22809 (re-search-backward re nil t)))) 22823 (re-search-backward re nil t))))
22810 (error "No bibliography defined in file") 22824 (error "No bibliography defined in file")
22811 (setq bib (concat (match-string 1) ".bib") 22825 (setq bib (concat (match-string 1) ".bib")
22812 rds (list (list 'bib bib))))))) 22826 org--rds (list (list 'bib bib)))))))
22813 (call-interactively 'reftex-citation))) 22827 (call-interactively 'reftex-citation)))
22814 22828
22815;;;; Functions extending outline functionality 22829;;;; Functions extending outline functionality
@@ -22926,20 +22940,20 @@ the cursor is already beyond the end of the headline."
22926(define-key org-mode-map "\C-a" 'org-beginning-of-line) 22940(define-key org-mode-map "\C-a" 'org-beginning-of-line)
22927(define-key org-mode-map "\C-e" 'org-end-of-line) 22941(define-key org-mode-map "\C-e" 'org-end-of-line)
22928 22942
22929(defun org-backward-sentence (&optional arg) 22943(defun org-backward-sentence (&optional _arg)
22930 "Go to beginning of sentence, or beginning of table field. 22944 "Go to beginning of sentence, or beginning of table field.
22931This will call `backward-sentence' or `org-table-beginning-of-field', 22945This will call `backward-sentence' or `org-table-beginning-of-field',
22932depending on context." 22946depending on context."
22933 (interactive "P") 22947 (interactive)
22934 (cond 22948 (cond
22935 ((org-at-table-p) (call-interactively 'org-table-beginning-of-field)) 22949 ((org-at-table-p) (call-interactively 'org-table-beginning-of-field))
22936 (t (call-interactively 'backward-sentence)))) 22950 (t (call-interactively 'backward-sentence))))
22937 22951
22938(defun org-forward-sentence (&optional arg) 22952(defun org-forward-sentence (&optional _arg)
22939 "Go to end of sentence, or end of table field. 22953 "Go to end of sentence, or end of table field.
22940This will call `forward-sentence' or `org-table-end-of-field', 22954This will call `forward-sentence' or `org-table-end-of-field',
22941depending on context." 22955depending on context."
22942 (interactive "P") 22956 (interactive)
22943 (cond 22957 (cond
22944 ((org-at-table-p) (call-interactively 'org-table-end-of-field)) 22958 ((org-at-table-p) (call-interactively 'org-table-end-of-field))
22945 (t (call-interactively 'forward-sentence)))) 22959 (t (call-interactively 'forward-sentence))))
@@ -22947,9 +22961,9 @@ depending on context."
22947(define-key org-mode-map "\M-a" 'org-backward-sentence) 22961(define-key org-mode-map "\M-a" 'org-backward-sentence)
22948(define-key org-mode-map "\M-e" 'org-forward-sentence) 22962(define-key org-mode-map "\M-e" 'org-forward-sentence)
22949 22963
22950(defun org-kill-line (&optional arg) 22964(defun org-kill-line (&optional _arg)
22951 "Kill line, to tags or end of line." 22965 "Kill line, to tags or end of line."
22952 (interactive "P") 22966 (interactive)
22953 (cond 22967 (cond
22954 ((or (not org-special-ctrl-k) 22968 ((or (not org-special-ctrl-k)
22955 (bolp) 22969 (bolp)