summaryrefslogtreecommitdiff
path: root/lisp/org
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/org')
-rw-r--r--lisp/org/ob-comint.el2
-rw-r--r--lisp/org/ob-core.el21
-rw-r--r--lisp/org/ob-lilypond.el1
-rw-r--r--lisp/org/oc-basic.el13
-rw-r--r--lisp/org/oc.el25
-rw-r--r--lisp/org/ol-doi.el2
-rw-r--r--lisp/org/ol-eshell.el2
-rw-r--r--lisp/org/ol-eww.el2
-rw-r--r--lisp/org/ol-man.el8
-rw-r--r--lisp/org/ol-w3m.el2
-rw-r--r--lisp/org/ol.el10
-rw-r--r--lisp/org/org-capture.el11
-rw-r--r--lisp/org/org-clock.el8
-rw-r--r--lisp/org/org-compat.el21
-rw-r--r--lisp/org/org-element.el3
-rw-r--r--lisp/org/org-feed.el2
-rw-r--r--lisp/org/org-id.el3
-rw-r--r--lisp/org/org-lint.el6
-rw-r--r--lisp/org/org-macs.el8
-rw-r--r--lisp/org/org-mouse.el2
-rw-r--r--lisp/org/org-plot.el8
-rw-r--r--lisp/org/org-refile.el14
-rw-r--r--lisp/org/org.el18
-rw-r--r--lisp/org/ox-icalendar.el7
-rw-r--r--lisp/org/ox.el171
25 files changed, 208 insertions, 162 deletions
diff --git a/lisp/org/ob-comint.el b/lisp/org/ob-comint.el
index 427aba34150..c99d6a8ba71 100644
--- a/lisp/org/ob-comint.el
+++ b/lisp/org/ob-comint.el
@@ -166,7 +166,7 @@ source block, and the name of the temp file.")
(defvar-local org-babel-comint-async-chunk-callback nil
"Callback function to clean Babel async output results before insertion.
Its single argument is a string consisting of output from the
-comint process. It should return a string that will be be passed
+comint process. It should return a string that will be passed
to `org-babel-insert-result'.")
(defvar-local org-babel-comint-async-dangling nil
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el
index 04af84d2e44..3b114703cdc 100644
--- a/lisp/org/ob-core.el
+++ b/lisp/org/ob-core.el
@@ -136,8 +136,7 @@ used."
:type 'string
:safe (lambda (v)
(and (stringp v)
- (eq (compare-strings "RESULTS" nil nil v nil nil t)
- t))))
+ (string-equal-ignore-case "RESULTS" v))))
(defcustom org-babel-noweb-wrap-start "<<"
"String used to begin a noweb reference in a code block.
@@ -489,13 +488,13 @@ arguments, imagine you'd like to set the file name output of a
latex source block to a sha1 of its contents. We could achieve
this with:
-(defun org-src-sha ()
- (let ((elem (org-element-at-point)))
- (concat (sha1 (org-element-property :value elem)) \".svg\")))
+ (defun org-src-sha ()
+ (let ((elem (org-element-at-point)))
+ (concat (sha1 (org-element-property :value elem)) \".svg\")))
-(setq org-babel-default-header-args:latex
- `((:results . \"file link replace\")
- (:file . (lambda () (org-src-sha)))))
+ (setq org-babel-default-header-args:latex
+ `((:results . \"file link replace\")
+ (:file . (lambda () (org-src-sha)))))
Because the closure is evaluated with point at the source block,
the call to `org-element-at-point' above will always retrieve
@@ -2435,7 +2434,7 @@ INFO may provide the values of these header arguments (in the
;; Escape contents from "export" wrap. Wrap
;; inline results within an export snippet with
;; appropriate value.
- ((eq t (compare-strings type nil nil "export" nil nil t))
+ ((string-equal-ignore-case type "export")
(let ((backend (pcase split
(`(,_) "none")
(`(,_ ,b . ,_) b))))
@@ -2446,14 +2445,14 @@ INFO may provide the values of these header arguments (in the
backend) "@@)}}}")))
;; Escape contents from "example" wrap. Mark
;; inline results as verbatim.
- ((eq t (compare-strings type nil nil "example" nil nil t))
+ ((string-equal-ignore-case type "example")
(funcall wrap
opening-line closing-line
nil nil
"{{{results(=" "=)}}}"))
;; Escape contents from "src" wrap. Mark
;; inline results as inline source code.
- ((eq t (compare-strings type nil nil "src" nil nil t))
+ ((string-equal-ignore-case type "src")
(let ((inline-open
(pcase split
(`(,_)
diff --git a/lisp/org/ob-lilypond.el b/lisp/org/ob-lilypond.el
index 15538b50374..dd204d7f6b1 100644
--- a/lisp/org/ob-lilypond.el
+++ b/lisp/org/ob-lilypond.el
@@ -36,6 +36,7 @@
(declare-function org-show-all "org" (&optional types))
+;; FIXME: Doesn't this rather belong in lilypond-mode.el?
(defalias 'lilypond-mode 'LilyPond-mode)
(add-to-list 'org-babel-tangle-lang-exts '("LilyPond" . "ly"))
diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el
index 8c76e200e4f..398d2e2d3fa 100644
--- a/lisp/org/oc-basic.el
+++ b/lisp/org/oc-basic.el
@@ -460,12 +460,13 @@ substitutes for the unknown key. Finally, it may be the symbol
(_
(lambda ()
(interactive)
- (setf (buffer-substring beg end)
- (concat "@"
- (if (= 1 (length suggestions))
- (car suggestions)
- (completing-read "Did you mean: "
- suggestions nil t))))))))
+ (goto-char beg)
+ (delete-region beg end)
+ (insert "@"
+ (if (= 1 (length suggestions))
+ (car suggestions)
+ (completing-read "Did you mean: "
+ suggestions nil t)))))))
(put-text-property beg end 'keymap km)))
(defun org-cite-basic-activate (citation)
diff --git a/lisp/org/oc.el b/lisp/org/oc.el
index eb5f519cb64..c4cd0268c7c 100644
--- a/lisp/org/oc.el
+++ b/lisp/org/oc.el
@@ -808,6 +808,8 @@ INFO is the export communication channel, as a property list."
(or (plist-get info :citations)
(letrec ((cites nil)
(tree (plist-get info :parse-tree))
+ (definition-cache (make-hash-table :test #'equal))
+ (definition-list nil)
(find-definition
;; Find definition for standard reference LABEL. At
;; this point, it is impossible to rely on
@@ -816,11 +818,21 @@ INFO is the export communication channel, as a property list."
;; un-processed citation objects. So we use
;; a simplified version of the function above.
(lambda (label)
- (org-element-map tree 'footnote-definition
- (lambda (d)
- (and (equal label (org-element-property :label d))
- (or (org-element-contents d) "")))
- info t)))
+ (or (gethash label definition-cache)
+ (org-element-map
+ (or definition-list
+ (setq definition-list
+ (org-element-map
+ tree
+ 'footnote-definition
+ #'identity info)))
+ 'footnote-definition
+ (lambda (d)
+ (and (equal label (org-element-property :label d))
+ (puthash label
+ (or (org-element-contents d) "")
+ definition-cache)))
+ info t))))
(search-cites
(lambda (data)
(org-element-map data '(citation footnote-reference)
@@ -834,7 +846,8 @@ INFO is the export communication channel, as a property list."
(_
(let ((label (org-element-property :label datum)))
(funcall search-cites
- (funcall find-definition label))))))
+ (funcall find-definition label)))))
+ nil)
info nil 'footnote-definition t))))
(funcall search-cites tree)
(let ((result (nreverse cites)))
diff --git a/lisp/org/ol-doi.el b/lisp/org/ol-doi.el
index 94585e4c3e5..56239f65d43 100644
--- a/lisp/org/ol-doi.el
+++ b/lisp/org/ol-doi.el
@@ -44,7 +44,7 @@ PATH is a the path to search for, as a string."
"Export a \"doi\" type link.
PATH is the DOI name. DESC is the description of the link, or
nil. BACKEND is a symbol representing the backend used for
-export. INFO is a a plist containing the export parameters."
+export. INFO is a plist containing the export parameters."
(let ((uri (concat org-link-doi-server-url path)))
(pcase backend
(`html
diff --git a/lisp/org/ol-eshell.el b/lisp/org/ol-eshell.el
index 1dee61b98b8..1ca2aa2b28b 100644
--- a/lisp/org/ol-eshell.el
+++ b/lisp/org/ol-eshell.el
@@ -46,7 +46,7 @@ followed by a colon."
(eshell-buffer-name (car buffer-and-command))
(command (cadr buffer-and-command)))
(if (get-buffer eshell-buffer-name)
- (pop-to-buffer-same-window eshell-buffer-name)
+ (pop-to-buffer eshell-buffer-name display-comint-buffer-action)
(eshell))
(goto-char (point-max))
(eshell-kill-input)
diff --git a/lisp/org/ol-eww.el b/lisp/org/ol-eww.el
index 69bf1ba62dd..d1bb5195107 100644
--- a/lisp/org/ol-eww.el
+++ b/lisp/org/ol-eww.el
@@ -115,7 +115,7 @@ keep the structure of the Org file."
(setq transform-start (region-beginning))
(setq transform-end (region-end))
;; Deactivate mark if current mark is activate.
- (when (fboundp 'deactivate-mark) (deactivate-mark)))
+ (deactivate-mark))
(message "Transforming links...")
(save-excursion
(goto-char transform-start)
diff --git a/lisp/org/ol-man.el b/lisp/org/ol-man.el
index 3806d95cdaf..beed216acf9 100644
--- a/lisp/org/ol-man.el
+++ b/lisp/org/ol-man.el
@@ -8,12 +8,12 @@
;;
;; This file is part of GNU Emacs.
;;
-;; This program is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
-;; This program is distributed in the hope that it will be useful,
+;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
diff --git a/lisp/org/ol-w3m.el b/lisp/org/ol-w3m.el
index 517329889c6..80d6811a5c5 100644
--- a/lisp/org/ol-w3m.el
+++ b/lisp/org/ol-w3m.el
@@ -72,7 +72,7 @@ so that it can be yanked into an Org buffer with links working correctly."
(setq transform-start (region-beginning))
(setq transform-end (region-end))
;; Deactivate mark if current mark is activate.
- (when (fboundp 'deactivate-mark) (deactivate-mark)))
+ (deactivate-mark))
(message "Transforming links...")
(save-excursion
(goto-char transform-start)
diff --git a/lisp/org/ol.el b/lisp/org/ol.el
index f9816a187da..a9e613e0d4e 100644
--- a/lisp/org/ol.el
+++ b/lisp/org/ol.el
@@ -646,7 +646,7 @@ followed by another \"%[A-F0-9]{2}\" group."
(cons 6 128))))
(when (>= val 192) (setq eat (car shift-xor)))
(setq val (logxor val (cdr shift-xor)))
- (setq sum (+ (lsh sum (car shift-xor)) val))
+ (setq sum (+ (ash sum (car shift-xor)) val))
(when (> eat 0) (setq eat (- eat 1)))
(cond
((= 0 eat) ;multi byte
@@ -1580,14 +1580,6 @@ non-nil."
nil nil nil))))
(org-link-store-props :type "calendar" :date cd)))
- ((eq major-mode 'w3-mode)
- (setq cpltxt (if (and (buffer-name)
- (not (string-match "Untitled" (buffer-name))))
- (buffer-name)
- (url-view-url t))
- link (url-view-url t))
- (org-link-store-props :type "w3" :url (url-view-url t)))
-
((eq major-mode 'image-mode)
(setq cpltxt (concat "file:"
(abbreviate-file-name buffer-file-name))
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el
index bfead3aa5af..2fd9a9c74da 100644
--- a/lisp/org/org-capture.el
+++ b/lisp/org/org-capture.el
@@ -1816,10 +1816,13 @@ by their respective `org-store-link-plist' properties if present."
;; Load history list for current prompt.
(setq org-capture--prompt-history
(gethash prompt org-capture--prompt-history-table))
- (push (org-completing-read
- (concat (or prompt "Enter string")
- (and default (format " [%s]" default))
- ": ")
+ (push (org-completing-read
+ ;; `format-prompt' is new in Emacs 28.1.
+ (if (fboundp 'format-prompt)
+ (format-prompt (or prompt "Enter string") default)
+ (concat (or prompt "Enter string")
+ (and default (format " [%s]" default))
+ ": "))
completions
nil nil nil 'org-capture--prompt-history default)
strings)
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index 081a6178345..fdc9818a5a8 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -219,8 +219,7 @@ Emacs initialization file."
(const :tag "Clock and history" t)
(const :tag "No persistence" nil)))
-(defcustom org-clock-persist-file (convert-standard-filename
- (concat user-emacs-directory "org-clock-save.el"))
+(defcustom org-clock-persist-file (locate-user-emacs-file "org-clock-save.el")
"File to save clock data to."
:group 'org-clock
:type 'string)
@@ -659,7 +658,6 @@ there is no recent clock to choose from."
(if (< i 10)
(+ i ?0)
(+ i (- ?A 10))) m))
- (if (fboundp 'int-to-char) (setf (car s) (int-to-char (car s))))
(push s sel-list)))
(run-hooks 'org-clock-before-select-task-hook)
(goto-char (point-min))
@@ -2838,7 +2836,7 @@ a number of clock tables."
(pcase (if range (car range) (plist-get params :tstart))
((and (pred numberp) n)
(pcase-let ((`(,m ,d ,y) (calendar-gregorian-from-absolute n)))
- (apply #'encode-time (list 0 0 org-extend-today-until d m y))))
+ (encode-time 0 0 org-extend-today-until d m y)))
(timestamp
(seconds-to-time
(org-matcher-time (or timestamp
@@ -2848,7 +2846,7 @@ a number of clock tables."
(pcase (if range (nth 1 range) (plist-get params :tend))
((and (pred numberp) n)
(pcase-let ((`(,m ,d ,y) (calendar-gregorian-from-absolute n)))
- (apply #'encode-time (list 0 0 org-extend-today-until d m y))))
+ (encode-time 0 0 org-extend-today-until d m y)))
(timestamp (seconds-to-time (org-matcher-time timestamp))))))
(while (time-less-p start end)
(unless (bolp) (insert "\n"))
diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
index da544a567d8..085e32d6774 100644
--- a/lisp/org/org-compat.el
+++ b/lisp/org/org-compat.el
@@ -39,7 +39,7 @@
(declare-function org-calendar-goto-agenda "org-agenda" ())
(declare-function org-align-tags "org" (&optional all))
(declare-function org-at-heading-p "org" (&optional ignored))
-(declare-function org-at-table.el-p "org" ())
+(declare-function org-at-table.el-p "org-table" ())
(declare-function org-element-at-point "org-element" ())
(declare-function org-element-context "org-element" (&optional element))
(declare-function org-element-lineage "org-element" (blob &optional types with-self))
@@ -204,8 +204,7 @@ extension beyond end of line was not controllable."
(defsubst file-attribute-modification-time (attributes)
"The modification time in ATTRIBUTES returned by `file-attributes'.
This is the time of the last change to the file's contents, and
-is a list of integers (HIGH LOW USEC PSEC) in the same style
-as (current-time)."
+is a Lisp timestamp in the same style as `current-time'."
(nth 5 attributes)))
(unless (fboundp 'file-attribute-size)
@@ -244,7 +243,7 @@ This is a floating point number if the size is too large for an integer."
(if (fboundp 'string-collate-lessp)
(defalias 'org-string-collate-lessp
'string-collate-lessp)
- (defun org-string-collate-lessp (s1 s2 &rest _)
+ (defun org-string-collate-lessp (s1 s2 &optional _ _)
"Return non-nil if STRING1 is less than STRING2 in lexicographic order.
Case is significant."
(string< s1 s2)))
@@ -935,6 +934,14 @@ Implements `define-error' for older emacsen."
(put name 'error-conditions
(copy-sequence (cons name (get 'error 'error-conditions))))))
+(unless (fboundp 'string-equal-ignore-case)
+ ;; From Emacs subr.el.
+ (defun string-equal-ignore-case (string1 string2)
+ "Like `string-equal', but case-insensitive.
+Upper-case and lower-case letters are treated as equal.
+Unibyte strings are converted to multibyte for comparison."
+ (eq t (compare-strings string1 0 nil string2 0 nil t))))
+
(unless (fboundp 'string-suffix-p)
;; From Emacs subr.el.
(defun string-suffix-p (suffix string &optional ignore-case)
@@ -1126,10 +1133,8 @@ ELEMENT is the element at point."
(and log
(let ((drawer (org-element-lineage element '(drawer))))
(and drawer
- (eq (compare-strings
- log nil nil
- (org-element-property :drawer-name drawer) nil nil t)
- t)))))
+ (string-equal-ignore-case
+ log (org-element-property :drawer-name drawer))))))
nil)
(t
(cl-case (org-element-type element)
diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el
index 9db1406b3fb..20b5b030392 100644
--- a/lisp/org/org-element.el
+++ b/lisp/org/org-element.el
@@ -4391,6 +4391,7 @@ looking into captions:
;; every element it encounters.
(and (not (eq category 'elements))
(setq category 'elements))))))))
+ (--ignore-list (plist-get info :ignore-list))
--acc)
(letrec ((--walk-tree
(lambda (--data)
@@ -4400,7 +4401,7 @@ looking into captions:
(cond
((not --data))
;; Ignored element in an export context.
- ((and info (memq --data (plist-get info :ignore-list))))
+ ((and info (memq --data --ignore-list)))
;; List of elements or objects.
((not --type) (mapc --walk-tree --data))
;; Unconditionally enter parse trees.
diff --git a/lisp/org/org-feed.el b/lisp/org/org-feed.el
index a5fea08882f..c7b4bde0d28 100644
--- a/lisp/org/org-feed.el
+++ b/lisp/org/org-feed.el
@@ -406,7 +406,7 @@ it can be a list structured like an entry in `org-feed-alist'."
;; Write the new status
;; We do this only now, in case something goes wrong above, so
- ;; that would would end up with a status that does not reflect
+ ;; that would end up with a status that does not reflect
;; which items truly have been handled
(org-feed-write-status inbox-pos drawer status)
diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el
index b4acec7bdd7..7334050b8b4 100644
--- a/lisp/org/org-id.el
+++ b/lisp/org/org-id.el
@@ -196,8 +196,7 @@ the link."
:group 'org-id
:type 'boolean)
-(defcustom org-id-locations-file (convert-standard-filename
- (concat user-emacs-directory ".org-id-locations"))
+(defcustom org-id-locations-file (locate-user-emacs-file ".org-id-locations")
"The file for remembering in which file an ID was defined.
This variable is only relevant when `org-id-track-globally' is set."
:group 'org-id
diff --git a/lisp/org/org-lint.el b/lisp/org/org-lint.el
index 83c2d08a907..6d8cf3f2374 100644
--- a/lisp/org/org-lint.el
+++ b/lisp/org/org-lint.el
@@ -334,10 +334,8 @@ called with one argument, the key used for comparison."
ast
'node-property
(lambda (property)
- (and (eq (compare-strings "CUSTOM_ID" nil nil
- (org-element-property :key property) nil nil
- t)
- t)
+ (and (string-equal-ignore-case
+ "CUSTOM_ID" (org-element-property :key property))
(org-element-property :value property)))
(lambda (property _) (org-element-property :begin property))
(lambda (key) (format "Duplicate CUSTOM_ID property \"%s\"" key))))
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index b10725bd526..bb0562dde06 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -37,6 +37,7 @@
(declare-function org-mode "org" ())
(declare-function org-show-context "org" (&optional key))
(declare-function org-string-collate-lessp "org-compat" (s1 s2 &optional locale ignore-case))
+(declare-function org-time-convert-to-integer "org-compat" (time))
(defvar org-ts-regexp0)
(defvar ffap-url-regexp)
@@ -257,15 +258,16 @@ ignored in this case."
(defun org-file-newer-than-p (file time)
"Non-nil if FILE is newer than TIME.
-FILE is a filename, as a string, TIME is a list of integers, as
+FILE is a filename, as a string, TIME is a Lisp time value, as
returned by, e.g., `current-time'."
(and (file-exists-p file)
;; Only compare times up to whole seconds as some file-systems
;; (e.g. HFS+) do not retain any finer granularity. As
;; a consequence, make sure we return non-nil when the two
;; times are equal.
- (not (time-less-p (cl-subseq (nth 5 (file-attributes file)) 0 2)
- (cl-subseq time 0 2)))))
+ (not (time-less-p (org-time-convert-to-integer
+ (nth 5 (file-attributes file)))
+ (org-time-convert-to-integer time)))))
(defun org-compile-file (source process ext &optional err-msg log-buf spec)
"Compile a SOURCE file using PROCESS.
diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el
index 20c20acc320..a590ff87f24 100644
--- a/lisp/org/org-mouse.el
+++ b/lisp/org/org-mouse.el
@@ -208,7 +208,7 @@ this function is called. Otherwise, the current major mode menu is used."
(interactive "@e \nP")
(if (and (= (event-click-count event) 1)
(or (not mark-active)
- (sit-for (/ double-click-time 1000.0))))
+ (sit-for (/ (mouse-double-click-time) 1000.0))))
(progn
(select-window (posn-window (event-start event)))
(when (not (org-mouse-mark-active))
diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el
index 7958ffd58da..831c84befcb 100644
--- a/lisp/org/org-plot.el
+++ b/lisp/org/org-plot.el
@@ -272,10 +272,10 @@ argument for the FUNCTION."
for k in keys collect
(cons k (funcall function (lookup k alist1) (lookup k alist2))))))
-(defun org--plot/item-frequencies (values &optional normalise)
+(defun org--plot/item-frequencies (values &optional normalize)
"Return an alist indicating the frequency of values in VALUES list.
-When NORMALISE is non-nil, the count is divided by the number of values."
- (let ((normaliser (if normalise (float (length values)) 1)))
+When NORMALIZE is non-nil, the count is divided by the number of values."
+ (let ((normaliser (if normalize (float (length values)) 1)))
(cl-loop for (n . m) in (seq-group-by #'identity values)
collect (cons n (/ (length m) normaliser)))))
@@ -622,7 +622,7 @@ manner suitable for prepending to a user-specified script."
(dolist (img-overlay org-inline-image-overlays)
(when (string= img-file (plist-get (cdr (overlay-get img-overlay 'display)) :file))
(when (file-exists-p img-file)
- (image-refresh (overlay-get img-overlay 'display))))))
+ (image-flush (overlay-get img-overlay 'display))))))
;;-----------------------------------------------------------------------------
;; facade functions
diff --git a/lisp/org/org-refile.el b/lisp/org/org-refile.el
index 5ad73422efa..71d00a7a22b 100644
--- a/lisp/org/org-refile.el
+++ b/lisp/org/org-refile.el
@@ -577,7 +577,7 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(with-demoted-errors "Bookmark set error: %S"
(bookmark-set bookmark-name))))
(move-marker org-capture-last-stored-marker (point)))
- (when (fboundp 'deactivate-mark) (deactivate-mark))
+ (deactivate-mark)
(run-hooks 'org-after-refile-insert-hook)))
(unless org-refile-keep
(if regionp
@@ -640,11 +640,13 @@ this function appends the default value from
org-refile-target-table))
(completion-ignore-case t)
cdef
- (prompt (concat prompt
- (or (and (car org-refile-history)
- (concat " (default " (car org-refile-history) ")"))
- (and (assoc cbnex tbl) (setq cdef cbnex)
- (concat " (default " cbnex ")"))) ": "))
+ (prompt (let ((default (or (car org-refile-history)
+ (and (assoc cbnex tbl) (setq cdef cbnex)
+ cbnex))))
+ ;; `format-prompt' is new in Emacs 28.1.
+ (if (fboundp 'format-prompt)
+ (format-prompt prompt default)
+ (concat prompt " (default " default ": "))))
pa answ parent-target child parent old-hist)
(setq old-hist org-refile-history)
(setq answ (funcall cfunc prompt tbl nil (not new-nodes)
diff --git a/lisp/org/org.el b/lisp/org/org.el
index a6155c1382a..df708a2159d 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -82,8 +82,8 @@
(or (eq this-command 'eval-buffer)
(condition-case nil
(load (concat (file-name-directory load-file-name)
- "org-loaddefs.el")
- nil t t t)
+ "org-loaddefs")
+ nil t nil t)
(error
(message "WARNING: No org-loaddefs.el file could be found from where org.el is loaded.")
(sit-for 3)
@@ -1357,7 +1357,7 @@ Possible values for the file identifier are:
to open [[file:document.pdf::5]] with evince at page 5.
`directory' Matches a directory
- `remote' Matches a remote file, accessible through tramp or efs.
+ `remote' Matches a remote file, accessible through tramp.
Remote files most likely should be visited through Emacs
because external applications cannot handle such paths.
`auto-mode' Matches files that are matched by any entry in `auto-mode-alist',
@@ -3807,10 +3807,6 @@ This is needed for font-lock setup.")
(declare-function dired-get-filename
"dired"
(&optional localp no-error-if-not-filep))
-(declare-function iswitchb-read-buffer
- "iswitchb"
- (prompt &optional
- default require-match _predicate start matches-set))
(declare-function org-agenda-change-all-lines
"org-agenda"
(newhead hdmarker &optional fixface just-this))
@@ -3844,7 +3840,6 @@ This is needed for font-lock setup.")
(defvar calc-embedded-open-formula)
(defvar calc-embedded-open-mode)
(defvar font-lock-unfontify-region-function)
-(defvar iswitchb-temp-buflist)
(defvar org-agenda-tags-todo-honor-ignore-options)
(defvar remember-data-file)
(defvar texmathp-why)
@@ -9319,6 +9314,7 @@ TYPE is the dynamic block type, as a string."
"List all defined dynamic block types."
(mapcar #'car org-dynamic-block-alist))
+;;;###org-autoload
(defun org-dynamic-block-define (type func)
"Define dynamic block TYPE with FUNC.
TYPE is a string. FUNC is the function creating the dynamic
@@ -12160,7 +12156,7 @@ This works in the agenda, and also in an Org buffer."
(progn
(message "[s]et or [r]emove? ")
(equal (read-char-exclusive) ?r))))
- (when (fboundp 'deactivate-mark) (deactivate-mark))
+ (deactivate-mark)
(let ((agendap (equal major-mode 'org-agenda-mode))
l1 l2 m buf pos newhead (cnt 0))
(goto-char end)
@@ -16486,7 +16482,7 @@ INCLUDE-LINKED is passed to `org-display-inline-images'."
(org-toggle-inline-images)))
;; For without-x builds.
-(declare-function image-refresh "image" (spec &optional frame))
+(declare-function image-flush "image" (spec &optional frame))
(defcustom org-display-remote-inline-images 'skip
"How to display remote inline images.
@@ -16627,7 +16623,7 @@ buffer boundaries with possible narrowing."
(org-element-property :begin link)
'org-image-overlay)))
(if (and (car-safe old) refresh)
- (image-refresh (overlay-get (cdr old) 'display))
+ (image-flush (overlay-get (cdr old) 'display))
(let ((image (org--create-inline-image file width)))
(when image
(let ((ov (make-overlay
diff --git a/lisp/org/ox-icalendar.el b/lisp/org/ox-icalendar.el
index 148e111fd4c..7a62145076b 100644
--- a/lisp/org/ox-icalendar.el
+++ b/lisp/org/ox-icalendar.el
@@ -824,8 +824,7 @@ as a communication channel."
(if (not (plist-get info :with-author)) ""
(org-export-data (plist-get info :author) info))
;; Timezone.
- (if (org-string-nw-p org-icalendar-timezone) org-icalendar-timezone
- (cadr (current-time-zone)))
+ (or (org-string-nw-p org-icalendar-timezone) (format-time-string "%Z"))
;; Description.
(org-export-data (plist-get info :title) info)
contents))
@@ -972,7 +971,7 @@ This function assumes major mode for current buffer is
(org-icalendar--vcalendar
org-icalendar-combined-name
user-full-name
- (or (org-string-nw-p org-icalendar-timezone) (cadr (current-time-zone)))
+ (or (org-string-nw-p org-icalendar-timezone) (format-time-string "%Z"))
org-icalendar-combined-description
contents)))
(run-hook-with-args 'org-icalendar-after-save-hook file)))
@@ -995,7 +994,7 @@ FILES is a list of files to build the calendar from."
user-full-name
;; Timezone.
(or (org-string-nw-p org-icalendar-timezone)
- (cadr (current-time-zone)))
+ (format-time-string "Z"))
;; Description.
org-icalendar-combined-description
;; Contents.
diff --git a/lisp/org/ox.el b/lisp/org/ox.el
index a6209ee98f6..9a2a69b2c16 100644
--- a/lisp/org/ox.el
+++ b/lisp/org/ox.el
@@ -80,6 +80,7 @@
(require 'org-element)
(require 'org-macro)
(require 'tabulated-list)
+(require 'subr-x)
(declare-function org-src-coderef-format "org-src" (&optional element))
(declare-function org-src-coderef-regexp "org-src" (fmt &optional label))
@@ -1925,28 +1926,34 @@ Return a string."
(and (not greaterp)
(memq type org-element-recursive-objects)))
(contents
- (mapconcat
- (lambda (element) (org-export-data element info))
- (org-element-contents
- (if (or greaterp objectp) data
- ;; Elements directly containing
- ;; objects must have their indentation
- ;; normalized first.
- (org-element-normalize-contents
- data
- ;; When normalizing first paragraph
- ;; of an item or
- ;; a footnote-definition, ignore
- ;; first line's indentation.
- (and
- (eq type 'paragraph)
- (memq (org-element-type parent)
- '(footnote-definition item))
- (eq (car (org-element-contents parent))
- data)
- (eq (org-element-property :pre-blank parent)
- 0)))))
- "")))
+ (let ((export-buffer (current-buffer)))
+ (with-temp-buffer
+ (dolist (element (org-element-contents
+ (if (or greaterp objectp) data
+ ;; Elements directly containing
+ ;; objects must have their indentation
+ ;; normalized first.
+ (org-element-normalize-contents
+ data
+ ;; When normalizing first paragraph
+ ;; of an item or
+ ;; a footnote-definition, ignore
+ ;; first line's indentation.
+ (and
+ (eq type 'paragraph)
+ (memq (org-element-type parent)
+ '(footnote-definition item))
+ (eq (car (org-element-contents parent))
+ data)
+ (eq (org-element-property :pre-blank parent)
+ 0))))))
+ (insert
+ ;; Use right local variable
+ ;; environment if there are, for
+ ;; example, #+BIND variables.
+ (with-current-buffer export-buffer
+ (org-export-data element info))))
+ (buffer-string)))))
(broken-link-handler
(funcall transcoder data
(if (not greaterp) contents
@@ -2958,11 +2965,12 @@ Return code as a string."
(mapcar (lambda (o) (and (eq (nth 4 o) 'parse) (nth 1 o)))
(append (org-export-get-all-options backend)
org-export-options-alist))))
- tree)
+ tree modified-tick)
;; Update communication channel and get parse tree. Buffer
;; isn't parsed directly. Instead, all buffer modifications
;; and consequent parsing are undertaken in a temporary copy.
(org-export-with-buffer-copy
+ (font-lock-mode -1)
;; Run first hook with current back-end's name as argument.
(run-hook-with-args 'org-export-before-processing-hook
(org-export-backend-name backend))
@@ -2974,6 +2982,7 @@ Return code as a string."
;; potentially invasive changes.
(org-set-regexps-and-options)
(org-update-radio-target-regexp)
+ (setq modified-tick (buffer-chars-modified-tick))
;; Possibly execute Babel code. Re-run a macro expansion
;; specifically for {{{results}}} since inline source blocks
;; may have generated some more. Refresh buffer properties
@@ -2981,8 +2990,10 @@ Return code as a string."
(when org-export-use-babel
(org-babel-exp-process-buffer)
(org-macro-replace-all '(("results" . "$1")) parsed-keywords)
- (org-set-regexps-and-options)
- (org-update-radio-target-regexp))
+ (unless (eq modified-tick (buffer-chars-modified-tick))
+ (org-set-regexps-and-options)
+ (org-update-radio-target-regexp))
+ (setq modified-tick (buffer-chars-modified-tick)))
;; Run last hook with current back-end's name as argument.
;; Update buffer properties and radio targets one last time
;; before parsing.
@@ -2990,8 +3001,10 @@ Return code as a string."
(save-excursion
(run-hook-with-args 'org-export-before-parsing-hook
(org-export-backend-name backend)))
- (org-set-regexps-and-options)
- (org-update-radio-target-regexp)
+ (unless (eq modified-tick (buffer-chars-modified-tick))
+ (org-set-regexps-and-options)
+ (org-update-radio-target-regexp))
+ (setq modified-tick (buffer-chars-modified-tick))
;; Update communication channel with environment.
(setq info
(org-combine-plists
@@ -3750,28 +3763,33 @@ definition can be found, raise an error."
(if (not label) (org-element-contents footnote-reference)
(let ((cache (or (plist-get info :footnote-definition-cache)
(let ((hash (make-hash-table :test #'equal)))
+ ;; Cache all the footnotes in document for
+ ;; later search.
+ (org-element-map (plist-get info :parse-tree)
+ '(footnote-definition footnote-reference)
+ (lambda (f)
+ ;; Skip any standard footnote reference
+ ;; since those cannot contain a
+ ;; definition.
+ (unless (eq (org-element-property :type f) 'standard)
+ (puthash
+ (cons :element (org-element-property :label f))
+ f
+ hash)))
+ info)
(plist-put info :footnote-definition-cache hash)
hash))))
(or
(gethash label cache)
(puthash label
- (org-element-map (plist-get info :parse-tree)
- '(footnote-definition footnote-reference)
- (lambda (f)
- (cond
- ;; Skip any footnote with a different label.
- ;; Also skip any standard footnote reference
- ;; with the same label since those cannot
- ;; contain a definition.
- ((not (equal (org-element-property :label f) label)) nil)
- ((eq (org-element-property :type f) 'standard) nil)
- ((org-element-contents f))
- ;; Even if the contents are empty, we can not
- ;; return nil since that would eventually raise
- ;; the error. Instead, return the equivalent
- ;; empty string.
- (t "")))
- info t)
+ (let ((hashed (gethash (cons :element label) cache)))
+ (when hashed
+ (or (org-element-contents hashed)
+ ;; Even if the contents are empty, we can not
+ ;; return nil since that would eventually raise
+ ;; the error. Instead, return the equivalent
+ ;; empty string.
+ "")))
cache)
(error "Definition not found for footnote %s" label))))))
@@ -4343,17 +4361,27 @@ significant."
(let* ((search-cells (org-export-string-to-search-cell
(org-element-property :path link)))
(link-cache (or (plist-get info :resolve-fuzzy-link-cache)
- (let ((table (make-hash-table :test #'eq)))
+ (let ((table (make-hash-table :test #'equal)))
+ ;; Cache all the element search cells.
+ (org-element-map (plist-get info :parse-tree)
+ (append pseudo-types '(target) org-element-all-elements)
+ (lambda (datum)
+ (dolist (cell (org-export-search-cells datum))
+ (if (gethash cell table)
+ (push datum (gethash cell table))
+ (puthash cell (list datum) table)))))
(plist-put info :resolve-fuzzy-link-cache table)
table)))
(cached (gethash search-cells link-cache 'not-found)))
(if (not (eq cached 'not-found)) cached
(let ((matches
- (org-element-map (plist-get info :parse-tree)
- (append pseudo-types '(target) org-element-all-elements)
- (lambda (datum)
- (and (org-export-match-search-cell-p datum search-cells)
- datum)))))
+ (let (result)
+ (dolist (search-cell search-cells)
+ (setq result
+ (nconc
+ result
+ (gethash search-cell link-cache))))
+ (delq nil result))))
(unless matches
(signal 'org-link-broken (list (org-element-property :path link))))
(puthash
@@ -4380,15 +4408,27 @@ tree or a file name. Assume LINK type is either \"id\" or
\"custom-id\". Throw an error if no match is found."
(let ((id (org-element-property :path link)))
;; First check if id is within the current parse tree.
- (or (org-element-map (plist-get info :parse-tree) 'headline
- (lambda (headline)
- (when (or (equal (org-element-property :ID headline) id)
- (equal (org-element-property :CUSTOM_ID headline) id))
- headline))
- info 'first-match)
- ;; Otherwise, look for external files.
- (cdr (assoc id (plist-get info :id-alist)))
- (signal 'org-link-broken (list id)))))
+ (or (let ((local-ids (or (plist-get info :id-local-cache)
+ (let ((table (make-hash-table :test #'equal)))
+ (org-element-map
+ (plist-get info :parse-tree)
+ 'headline
+ (lambda (headline)
+ (let ((id (org-element-property :ID headline))
+ (custom-id (org-element-property :CUSTOM_ID headline)))
+ (when id
+ (unless (gethash id table)
+ (puthash id headline table)))
+ (when custom-id
+ (unless (gethash custom-id table)
+ (puthash custom-id headline table)))))
+ info)
+ (plist-put info :id-local-cache table)
+ table))))
+ (gethash id local-ids))
+ ;; Otherwise, look for external files.
+ (cdr (assoc id (plist-get info :id-alist)))
+ (signal 'org-link-broken (list id)))))
(defun org-export-resolve-radio-link (link info)
"Return radio-target object referenced as LINK destination.
@@ -4397,15 +4437,12 @@ INFO is a plist used as a communication channel.
Return value can be a radio-target object or nil. Assume LINK
has type \"radio\"."
- (let ((path (replace-regexp-in-string
- "[ \r\t\n]+" " " (org-element-property :path link))))
+ (let ((path (string-clean-whitespace (org-element-property :path link))))
(org-element-map (plist-get info :parse-tree) 'radio-target
(lambda (radio)
- (and (eq (compare-strings
- (replace-regexp-in-string
- "[ \r\t\n]+" " " (org-element-property :value radio))
- nil nil path nil nil t)
- t)
+ (and (string-equal-ignore-case
+ (string-clean-whitespace (org-element-property :value radio))
+ path)
radio))
info 'first-match)))
@@ -6442,7 +6479,7 @@ to send the output file through additional processing, e.g,
(let ((outfile (org-export-output-file-name \".tex\" subtreep)))
(org-export-to-file \\='latex outfile
async subtreep visible-only body-only ext-plist
- #'org-latex-compile)))
+ #\\='org-latex-compile)))
When expressed as an anonymous function, using `lambda',
POST-PROCESS needs to be quoted.