From bb551c529fa741a3b389215d776335daac8b8e3c Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 15 Jun 2024 14:25:35 -0400 Subject: [PATCH] Update to Org 9.7.4-7-g165319 (cherry picked from commit 0910f6fe3f701caa478d4aa08d9667316050b977) --- etc/ORG-NEWS | 12 ++++++++ etc/refcards/orgcard.tex | 2 +- lisp/org/ob-C.el | 2 +- lisp/org/ob-awk.el | 2 +- lisp/org/ob-clojure.el | 2 +- lisp/org/ob-core.el | 61 ++++++++++++++++++++++----------------- lisp/org/ob-ditaa.el | 5 ++-- lisp/org/ob-exp.el | 10 ++++--- lisp/org/ob-gnuplot.el | 6 ++-- lisp/org/ob-groovy.el | 2 +- lisp/org/ob-lilypond.el | 2 +- lisp/org/ob-maxima.el | 4 +-- lisp/org/ob-screen.el | 2 +- lisp/org/ob-sed.el | 2 +- lisp/org/org-capture.el | 7 ++--- lisp/org/org-clock.el | 47 ++++++++++++++++-------------- lisp/org/org-compat.el | 11 +++++++ lisp/org/org-element.el | 28 +++++++++--------- lisp/org/org-fold-core.el | 15 +++++----- lisp/org/org-lint.el | 14 +++++++-- lisp/org/org-num.el | 2 +- lisp/org/org-persist.el | 4 +-- lisp/org/org-src.el | 4 +-- lisp/org/org-table.el | 18 +++++++----- lisp/org/org-version.el | 4 +-- lisp/org/org.el | 51 ++++++++++++++++++++++---------- lisp/org/ox.el | 7 ++--- 27 files changed, 196 insertions(+), 130 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 32e56cba82c..edeb7d3ab6c 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -28,6 +28,15 @@ constant. If you still want to use python-mode with ob-python, you might consider [[https://gitlab.com/jackkamm/ob-python-mode-mode][ob-python-mode-mode]], where the code to support python-mode has been ported to. +*** It is no longer possible to reveal hidden parts of the links during isearch + +Org 9.6 introduced support for searching hidden parts of the links. + +Unfortunately, we had to drop this support because its implementation +turned out to be unreliable for many users. Proper implementation +would require patching =isearch.el= and possibly a number of external +libraries implementing isearch equivalents. It cannot be done on Org +side alone. *** =ox-latex=: ~org-latex-line-break-safe~ is deprecated @@ -1719,6 +1728,9 @@ to the Org behavior. The new features and changes are listed below. **** Hidden parts of the links can now be searched and revealed during isearch +[2024-06-09 Sun] Since Org 9.7, this is no longer working. See +changes for Org 9.7. + In the past, hidden parts of the links could not be searched using isearch (=C-s=). Now, they are searchable by default. The hidden match is also revealed temporarily during isearch. diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex index 4d605fe7704..3967459fd81 100644 --- a/etc/refcards/orgcard.tex +++ b/etc/refcards/orgcard.tex @@ -1,5 +1,5 @@ % Reference Card for Org Mode -\def\orgversionnumber{9.7.3} +\def\orgversionnumber{9.7.4} \def\versionyear{2024} % latest update \input emacsver.tex diff --git a/lisp/org/ob-C.el b/lisp/org/ob-C.el index d13c65d260a..f7735ee72bb 100644 --- a/lisp/org/ob-C.el +++ b/lisp/org/ob-C.el @@ -482,7 +482,7 @@ int get_column_num (int nbcols, const char** header, const char* column) (defun org-babel-C-header-to-C (head type) "Convert an elisp list of header table into a C or D vector specifying a variable with the name of the table." - (message "%S" type) + (unless noninteractive (message "%S" type)) (let ((table (car head)) (headers (cdr head)) (typename (pcase type diff --git a/lisp/org/ob-awk.el b/lisp/org/ob-awk.el index 9577a39ee67..d94da405f0d 100644 --- a/lisp/org/ob-awk.el +++ b/lisp/org/ob-awk.el @@ -61,7 +61,7 @@ "Execute a block of Awk code BODY with org-babel. PARAMS is a plist of src block parameters . This function is called by `org-babel-execute-src-block'." - (message "Executing Awk source code block") + (unless noninteractive (message "Executing Awk source code block")) (let* ((result-params (cdr (assq :result-params params))) (cmd-line (cdr (assq :cmd-line params))) (in-file (cdr (assq :in-file params))) diff --git a/lisp/org/ob-clojure.el b/lisp/org/ob-clojure.el index 4a54acc51b3..c7ebbbb95e9 100644 --- a/lisp/org/ob-clojure.el +++ b/lisp/org/ob-clojure.el @@ -130,7 +130,7 @@ (defcustom ob-clojure-cli-command (when-let (cmd (executable-find "clojure")) (concat cmd " -M")) "Clojure CLI command used by the Clojure `clojure-cli' backend." - :type 'string + :type '(choice string (const nil)) :group 'org-babel :package-version '(Org . "9.7")) diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el index d1984b2d6fe..db75f1f0ad5 100644 --- a/lisp/org/ob-core.el +++ b/lisp/org/ob-core.el @@ -855,8 +855,9 @@ guess will be made." (forward-line) (skip-chars-forward " \t") (let ((result (org-babel-read-result))) - (message (format "Cached: %s" - (replace-regexp-in-string "%" "%%" (format "%S" result)))) + (unless noninteractive + (message (format "Cached: %s" + (replace-regexp-in-string "%" "%%" (format "%S" result))))) result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) @@ -879,21 +880,26 @@ guess will be made." result exec-start-time) (unless (fboundp cmd) (error "No org-babel-execute function for %s!" lang)) - (message "Executing %s %s %s..." - (capitalize lang) - (pcase executor-type - ('src-block "code block") - ('inline-src-block "inline code block") - ('babel-call "call") - ('inline-babel-call "inline call") - (e (symbol-name e))) - (let ((name (nth 4 info))) - (if name - (format "(%s)" name) - (format "at position %S" (nth 5 info))))) + (unless noninteractive + (message "Executing %s %s %s..." + (capitalize lang) + (pcase executor-type + ('src-block "code block") + ('inline-src-block "inline code block") + ('babel-call "call") + ('inline-babel-call "inline call") + (e (symbol-name e))) + (let ((name (nth 4 info))) + (if name + (format "(%s)" name) + (format "at position %S" (nth 5 info)))))) (setq exec-start-time (current-time) result - (let ((r (save-current-buffer (funcall cmd body params)))) + (let ((r + ;; Code block may move point in the buffer. + ;; Make sure that the point remains on the + ;; code block. + (save-excursion (funcall cmd body params)))) (if (and (eq (cdr (assq :result-type params)) 'value) (or (member "vector" result-params) (member "table" result-params)) @@ -2758,18 +2764,19 @@ INFO may provide the values of these header arguments (in the (not (and (listp result) (member "append" result-params)))) (indent-rigidly beg end indent)) - (let ((time-info - ;; Only show the time when something other than - ;; 0s will be shown, i.e. check if the time is at - ;; least half of the displayed precision. - (if (and exec-time (> (float-time exec-time) 0.05)) - (format " (took %.1fs)" (float-time exec-time)) - ""))) - (if (null result) - (if (member "value" result-params) - (message "Code block returned no value%s." time-info) - (message "Code block produced no output%s." time-info)) - (message "Code block evaluation complete%s." time-info)))) + (unless noninteractive + (let ((time-info + ;; Only show the time when something other than + ;; 0s will be shown, i.e. check if the time is at + ;; least half of the displayed precision. + (if (and exec-time (> (float-time exec-time) 0.05)) + (format " (took %.1fs)" (float-time exec-time)) + ""))) + (if (null result) + (if (member "value" result-params) + (message "Code block returned no value%s." time-info) + (message "Code block produced no output%s." time-info)) + (message "Code block evaluation complete%s." time-info))))) (when end (set-marker end nil)) (when outside-scope (narrow-to-region visible-beg visible-end)) (set-marker visible-beg nil) diff --git a/lisp/org/ob-ditaa.el b/lisp/org/ob-ditaa.el index ba8e65394f9..715d8ddf07e 100644 --- a/lisp/org/ob-ditaa.el +++ b/lisp/org/ob-ditaa.el @@ -113,8 +113,9 @@ This function is called by `org-babel-execute-src-block'." (unless (file-exists-p org-ditaa-jar-path) (error "Could not find ditaa.jar at %s" org-ditaa-jar-path)) (with-temp-file in-file (insert body)) - (message cmd) (shell-command cmd) - (when pdf-cmd (message pdf-cmd) (shell-command pdf-cmd)) + (unless noninteractive (message cmd)) + (shell-command cmd) + (when pdf-cmd (unless noninteractive (message pdf-cmd)) (shell-command pdf-cmd)) nil)) ;; signal that output has already been written to file (defun org-babel-prep-session:ditaa (_session _params) diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el index 657cb2b5265..5516530c5b7 100644 --- a/lisp/org/ob-exp.el +++ b/lisp/org/ob-exp.el @@ -265,8 +265,9 @@ this template." (if (not (eq type 'babel-call)) (progn (skip-chars-forward " \t") (point)) - (skip-chars-forward " \r\t\n") - (line-beginning-position))))) + (unless (eobp) + (skip-chars-forward " \r\t\n") + (line-beginning-position)))))) ((not rep) ;; Replacement code cannot be determined. ;; Leave the code block as is. @@ -291,8 +292,9 @@ this template." (cond ((not replacement) (goto-char end)) ((equal replacement "") (goto-char end) - (skip-chars-forward " \r\t\n") - (forward-line 0) + (unless (eobp) + (skip-chars-forward " \r\t\n") + (forward-line 0)) (delete-region begin (point))) (t (if (org-src-preserve-indentation-p element) diff --git a/lisp/org/ob-gnuplot.el b/lisp/org/ob-gnuplot.el index dc5cd0e5217..956763c587e 100644 --- a/lisp/org/ob-gnuplot.el +++ b/lisp/org/ob-gnuplot.el @@ -210,7 +210,7 @@ This function is called by `org-babel-execute-src-block'." (let ((script-file (org-babel-temp-file "gnuplot-script-"))) (with-temp-file script-file (insert (concat body "\n"))) - (message "gnuplot \"%s\"" script-file) + (unless noninteractive (message "gnuplot \"%s\"" script-file)) (setq output (shell-command-to-string (format @@ -219,7 +219,7 @@ This function is called by `org-babel-execute-src-block'." script-file (if (member system-type '(cygwin windows-nt ms-dos)) t nil))))) - (message "%s" output)) + (unless noninteractive (message "%s" output))) (with-temp-buffer (insert (concat body "\n")) (gnuplot-mode) @@ -232,7 +232,7 @@ This function is called by `org-babel-execute-src-block'." "Prepare SESSION according to the header arguments in PARAMS." (let* ((session (org-babel-gnuplot-initiate-session session)) (var-lines (org-babel-variable-assignments:gnuplot params))) - (message "%S" session) + (unless noninteractive (message "%S" session)) (org-babel-comint-in-buffer session (dolist (var-line var-lines) (insert var-line) diff --git a/lisp/org/ob-groovy.el b/lisp/org/ob-groovy.el index 908df93372a..d87ef4bb657 100644 --- a/lisp/org/ob-groovy.el +++ b/lisp/org/ob-groovy.el @@ -52,7 +52,7 @@ parameters may be used, like groovy -v" (defun org-babel-execute:groovy (body params) "Execute Groovy BODY according to PARAMS. This function is called by `org-babel-execute-src-block'." - (message "Executing Groovy source code block") + (unless noninteractive (message "Executing Groovy source code block")) (let* ((processed-params (org-babel-process-params params)) (session (org-babel-groovy-initiate-session (nth 0 processed-params))) (result-params (nth 2 processed-params)) diff --git a/lisp/org/ob-lilypond.el b/lisp/org/ob-lilypond.el index 35df76fc964..a8d85ce7c85 100644 --- a/lisp/org/ob-lilypond.el +++ b/lisp/org/ob-lilypond.el @@ -41,7 +41,7 @@ (declare-function org-fold-show-all "org-fold" (&optional types)) (add-to-list 'org-babel-tangle-lang-exts '("LilyPond" . "ly")) -(add-to-list 'org-src-lang-modes '("lilypond" . "LilyPond")) +(add-to-list 'org-src-lang-modes '("lilypond" . LilyPond)) (defvar org-babel-default-header-args:lilypond '() "Default header arguments for lilypond code blocks. diff --git a/lisp/org/ob-maxima.el b/lisp/org/ob-maxima.el index ef875cfe8a9..681154adfbf 100644 --- a/lisp/org/ob-maxima.el +++ b/lisp/org/ob-maxima.el @@ -131,7 +131,7 @@ Return nil if LINE is zero-length or it matches a regexp in (defun org-babel-execute:maxima (body params) "Execute Maxima BODY according to PARAMS. This function is called by `org-babel-execute-src-block'." - (message "Executing Maxima source code block") + (unless noninteractive (message "Executing Maxima source code block")) (let ((result-params (split-string (or (cdr (assq :results params)) ""))) (result (let* ((cmdline (or (cdr (assq :cmdline params)) "")) @@ -151,7 +151,7 @@ This function is called by `org-babel-execute-src-block'." (format "(linenum:0, %s(%S))$" batch/load in-file)) cmdline))) (with-temp-file in-file (insert (org-babel-maxima-expand body params))) - (message cmd) + (unless noninteractive (message cmd)) ;; " | grep -v batch | grep -v 'replaced' | sed '/^$/d' " (let ((raw (org-babel-eval cmd ""))) (mapconcat diff --git a/lisp/org/ob-screen.el b/lisp/org/ob-screen.el index ffb66d65967..a56afc7050e 100644 --- a/lisp/org/ob-screen.el +++ b/lisp/org/ob-screen.el @@ -52,7 +52,7 @@ In case you want to use a different screen than one selected by your $PATH") (defun org-babel-execute:screen (body params) "Send BODY via screen to a terminal using Babel, according to PARAMS. \"default\" session is used when none is specified in the PARAMS." - (message "Sending source code block to interactive terminal session...") + (unless noninteractive (message "Sending source code block to interactive terminal session...")) (save-window-excursion (let* ((session (cdr (assq :session params))) (socket (org-babel-screen-session-socketname session))) diff --git a/lisp/org/ob-sed.el b/lisp/org/ob-sed.el index fa6a2bb199d..83d9684ade2 100644 --- a/lisp/org/ob-sed.el +++ b/lisp/org/ob-sed.el @@ -65,7 +65,7 @@ BODY is the source inside a sed source block and PARAMS is an association list over the source block configurations. This function is called by `org-babel-execute-src-block'." - (message "Executing sed source code block") + (unless noninteractive (message "Executing sed source code block")) (let* ((result-params (cdr (assq :result-params params))) (cmd-line (cdr (assq :cmd-line params))) (in-file (cdr (assq :in-file params))) diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el index 6603b5e017a..f10e36937d3 100644 --- a/lisp/org/org-capture.el +++ b/lisp/org/org-capture.el @@ -408,8 +408,7 @@ you can escape ambiguous cases with a backward slash, e.g., \\%i." (let ((file-variants '(choice :tag "Filename " (file :tag "Literal") (function :tag "Function") - (variable :tag "Variable") - (sexp :tag "Form")))) + (variable :tag "Variable")))) `(repeat (choice :value ("" "" entry (file "~/org/notes.org") "") (list :tag "Multikey description" @@ -452,12 +451,12 @@ you can escape ambiguous cases with a backward slash, e.g., \\%i." (list :tag "File & function" (const :format "" file+function) ,file-variants - (sexp :tag " Function")) + (function :tag " Function")) (list :tag "Current clocking task" (const :format "" clock)) (list :tag "Function" (const :format "" function) - (sexp :tag " Function"))) + (function :tag " Function"))) (choice :tag "Template " (string) (list :tag "File" diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 5555bb1bc3d..c6fd507b08b 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -2048,28 +2048,31 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes." (cond ((and (eq element-type 'clock) (match-end 2)) ;; Two time stamps. - (let* ((timestamp (org-element-property :value element)) - (ts (float-time - (org-encode-time - (list 0 - (org-element-property :minute-start timestamp) - (org-element-property :hour-start timestamp) - (org-element-property :day-start timestamp) - (org-element-property :month-start timestamp) - (org-element-property :year-start timestamp) - nil -1 nil)))) - (te (float-time - (org-encode-time - (list 0 - (org-element-property :minute-end timestamp) - (org-element-property :hour-end timestamp) - (org-element-property :day-end timestamp) - (org-element-property :month-end timestamp) - (org-element-property :year-end timestamp) - nil -1 nil)))) - (dt (- (if tend (min te tend) te) - (if tstart (max ts tstart) ts)))) - (when (> dt 0) (cl-incf t1 (floor dt 60))))) + (condition-case nil + (let* ((timestamp (org-element-property :value element)) + (ts (float-time + (org-encode-time + (list 0 + (org-element-property :minute-start timestamp) + (org-element-property :hour-start timestamp) + (org-element-property :day-start timestamp) + (org-element-property :month-start timestamp) + (org-element-property :year-start timestamp) + nil -1 nil)))) + (te (float-time + (org-encode-time + (list 0 + (org-element-property :minute-end timestamp) + (org-element-property :hour-end timestamp) + (org-element-property :day-end timestamp) + (org-element-property :month-end timestamp) + (org-element-property :year-end timestamp) + nil -1 nil)))) + (dt (- (if tend (min te tend) te) + (if tstart (max ts tstart) ts)))) + (when (> dt 0) (cl-incf t1 (floor dt 60)))) + (error + (org-display-warning (format "org-clock-sum: Ignoring invalid %s" (org-current-line-string)))))) ((match-end 4) ;; A naked time. (setq t1 (+ t1 (string-to-number (match-string 5)) diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index d6620f9627f..41c26ad72fe 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el @@ -251,6 +251,17 @@ removed." default))) ": "))) +(if (fboundp 'list-of-strings-p) + (defalias 'org-list-of-strings-p #'list-of-strings-p) + ;; From Emacs subr.el. +;;;###autoload + (defun org-list-of-strings-p (object) + "Return t if OBJECT is nil or a list of strings." + (declare (pure t) (side-effect-free error-free)) + (while (and (consp object) (stringp (car object))) + (setq object (cdr object))) + (null object))) + ;;; Emacs < 27.1 compatibility diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el index b15f0b69d98..191bb5698d1 100644 --- a/lisp/org/org-element.el +++ b/lisp/org/org-element.el @@ -1188,7 +1188,7 @@ parse properties for property drawer at point." (property-name-symbol (intern property-name)) (property-value (org-element-deferred-create - nil #'org-element--substring + t #'org-element--substring (- (match-beginning 3) begin) (- (match-end 3) begin)))) (cond @@ -1355,7 +1355,7 @@ Throw `:org-element-deferred-retry' signal at the end." (title-end (point)) (raw-value (org-element-deferred-create - nil #'org-element--headline-raw-value + t #'org-element--headline-raw-value (- title-start begin) (- title-end begin)))) (org-element-put-property headline :raw-value raw-value) (org-element-put-property headline :level level) @@ -1386,12 +1386,12 @@ Throw `:org-element-deferred-retry' signal at the end." (defconst org-element--headline-parse-title-raw (org-element-deferred-create - nil #'org-element--headline-parse-title t) + t #'org-element--headline-parse-title t) "Constant holding deferred value for raw headline `:title' property.") (defconst org-element--headline-parse-title-parse (org-element-deferred-create - nil #'org-element--headline-parse-title nil) + t #'org-element--headline-parse-title nil) "Constant holding deferred value for parsed headline `:title' property.") (defconst org-element--headline-deferred @@ -2414,7 +2414,7 @@ Assume point is at comment block beginning." (if (eobp) (point) (line-beginning-position)))) (value (org-element-deferred-create - nil #'org-element--substring + t #'org-element--substring (- contents-begin begin) (- contents-end begin)))) (org-element-create @@ -2532,7 +2532,7 @@ Return a new syntax node of `example-block' type containing `:begin', (contents-begin (line-beginning-position 2)) (value (org-element-deferred-create - nil #'org-element--unescape-substring + t #'org-element--unescape-substring (- contents-begin begin) (- contents-end begin))) (pos-before-blank (progn (goto-char contents-end) @@ -2612,7 +2612,7 @@ Assume point is at export-block beginning." (if (eobp) (point) (line-beginning-position)))) (value (org-element-deferred-create - nil #'org-element--unescape-substring + t #'org-element--unescape-substring (- contents-begin begin) (- contents-end begin)))) (org-element-create @@ -2800,7 +2800,7 @@ Assume point is at the beginning of the latex environment." (begin (car affiliated)) (value (org-element-deferred-create - nil #'org-element--substring + t #'org-element--substring (- code-begin begin) (- code-end begin))) (end (progn (skip-chars-forward " \r\t\n" limit) @@ -3059,7 +3059,7 @@ Assume point is at the beginning of the block." ;; Retrieve code. (value (org-element-deferred-create - nil #'org-element--unescape-substring + t #'org-element--unescape-substring (- (line-beginning-position 2) begin) (- contents-end begin))) (pos-before-blank (progn (goto-char contents-end) @@ -3159,7 +3159,7 @@ Assume point is at the beginning of the table." :contents-end (and (eq type 'org) table-end) :value (and (eq type 'table.el) (org-element-deferred-create - nil #'org-element--substring + t #'org-element--substring (- table-begin begin) (- table-end begin))) :post-blank (count-lines pos-before-blank end) @@ -3322,7 +3322,7 @@ Assume point is at first MARK." (list :value (and (memq type '(code verbatim)) (org-element-deferred-create - nil #'org-element--substring + t #'org-element--substring (- contents-begin origin) (- contents-end origin)))) (list :contents-begin contents-begin @@ -3572,7 +3572,7 @@ Assume point is at the beginning of the snippet." (value (when contents-end (org-element-deferred-create - nil #'org-element--substring + t #'org-element--substring (- contents-begin begin) (- contents-end begin)))) (post-blank (skip-chars-forward " \t")) @@ -3667,7 +3667,7 @@ Assume point is at the beginning of the babel call." (replace-regexp-in-string "\n[ \t]*" " " (org-trim p))))) (value (org-element-deferred-create - nil #'org-element--substring + t #'org-element--substring 0 (- (point) begin))) (post-blank (skip-chars-forward " \t")) (end (point))) @@ -3801,7 +3801,7 @@ Assume point is at the beginning of the LaTeX fragment." 'latex-fragment (list :value (org-element-deferred-create - nil #'org-element--substring + t #'org-element--substring 0 (- after-fragment begin)) :begin begin :end end diff --git a/lisp/org/org-fold-core.el b/lisp/org/org-fold-core.el index 664846a619c..8372b86b087 100644 --- a/lisp/org/org-fold-core.el +++ b/lisp/org/org-fold-core.el @@ -641,13 +641,14 @@ This function is mostly intended to be used in `clone-indirect-buffer-hook'." ;; Add current buffer to the list of indirect buffers in the base buffer. (when (buffer-base-buffer) - (with-current-buffer (buffer-base-buffer) - (setq-local org-fold-core--indirect-buffers - (let (bufs) - (org-fold-core-cycle-over-indirect-buffers - (push (current-buffer) bufs)) - (push (current-buffer) bufs) - (delete-dups bufs))))) + (let ((new-buffer (current-buffer))) + (with-current-buffer (buffer-base-buffer) + (setq-local org-fold-core--indirect-buffers + (let (bufs) + (org-fold-core-cycle-over-indirect-buffers + (push (current-buffer) bufs)) + (push new-buffer bufs) + (delete-dups bufs)))))) (when (and (buffer-base-buffer) (eq org-fold-core-style 'text-properties) (not (memql 'ignore-indirect org-fold-core--optimise-for-huge-buffers))) diff --git a/lisp/org/org-lint.el b/lisp/org/org-lint.el index aed774ee2de..2d87ae270c4 100644 --- a/lisp/org/org-lint.el +++ b/lisp/org/org-lint.el @@ -388,14 +388,24 @@ called with one argument, the key used for comparison." (dolist (e originals reports) (funcall make-report (cdr e) (car e))))) (defun org-lint-misplaced-heading (ast) - "Check for accidentally misplaced heading lines." + "Check for accidentally misplaced heading lines. +Example: +** Heading 1 +** Heading 2** Oops heading 3 +** Heading 4" (org-with-point-at ast (goto-char (point-min)) (let (result) ;; Heuristics for 2+ level heading not at bol. (while (re-search-forward (rx (not (any "*\n\r ,")) ;; Not a bol; not escaped ,** heading; not " *** words" "*" (1+ "*") " ") nil t) - (unless (org-at-block-p) ; Inside a block, where the chances to have heading a slim. + ;; Limit false-positive rate by only complaining about + ;; ** Heading** Heading and + ;; ** Oops heading + ;; Paragraph** Oops heading + (when (org-element-type-p + (org-element-at-point) + '(paragraph headline)) (push (list (match-beginning 0) "Possibly misplaced heading line") result))) result))) diff --git a/lisp/org/org-num.el b/lisp/org/org-num.el index aebfef05079..a8fcf333361 100644 --- a/lisp/org/org-num.el +++ b/lisp/org/org-num.el @@ -144,7 +144,7 @@ control tag inheritance." :group 'org-appearance :package-version '(Org . "9.3") :type '(repeat (string :tag "Tag")) - :safe (lambda (val) (and (listp val) (cl-every #'stringp val)))) + :safe #'org-list-of-strings-p) ;;;###autoload (defcustom org-num-skip-unnumbered nil diff --git a/lisp/org/org-persist.el b/lisp/org/org-persist.el index c855c6604ba..52f4b0eef27 100644 --- a/lisp/org/org-persist.el +++ b/lisp/org/org-persist.el @@ -416,7 +416,7 @@ FORMAT and ARGS are passed to `message'." (defun org-persist--read-elisp-file (&optional buffer-or-file) "Read elisp data from BUFFER-OR-FILE or current buffer." (let (;; UTF-8 is explicitly used in `org-persist--write-elisp-file'. - (coding-system-for-read 'utf-8) + (coding-system-for-read 'emacs-internal) (buffer-or-file (or buffer-or-file (current-buffer)))) (with-temp-buffer (if (bufferp buffer-or-file) @@ -464,7 +464,7 @@ FORMAT and ARGS are passed to `message'." (let ((write-region-inhibit-fsync t) ;; We set UTF-8 here and in `org-persist--read-elisp-file' ;; to avoid the overhead from `find-auto-coding'. - (coding-system-for-write 'utf-8) + (coding-system-for-write 'emacs-internal) (print-circle (not no-circular)) print-level print-length diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index d152fbfe8b1..262bd462814 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el @@ -241,8 +241,8 @@ but the mode to use is `tuareg-mode'." :package-version '(Org . "9.7") :type '(repeat (cons - (string "Language name") - (symbol "Major mode")))) + (string :tag "Language name") + (symbol :tag "Major mode")))) (defcustom org-src-block-faces nil "Alist of faces to be used for source-block. diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index 37ce91570d2..4a2623b5538 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el @@ -5477,14 +5477,16 @@ a radio table." (goto-char (org-table-begin)) (let (rtn) (forward-line -1) - (while (looking-at "[ \t]*#\\+ORGTBL[: \t][ \t]*SEND[ \t]+\\([^ \t\r\n]+\\)[ \t]+\\([^ \t\r\n]+\\)\\([ \t]+.*\\)?") - (let ((name (org-no-properties (match-string 1))) - (transform (intern (match-string 2))) - (params (if (match-end 3) - (read (concat "(" (match-string 3) ")"))))) - (push (list :name name :transform transform :params params) - rtn) - (forward-line -1))) + (catch :bob + (while (looking-at "[ \t]*#\\+ORGTBL[: \t][ \t]*SEND[ \t]+\\([^ \t\r\n]+\\)[ \t]+\\([^ \t\r\n]+\\)\\([ \t]+.*\\)?") + (let ((name (org-no-properties (match-string 1))) + (transform (intern (match-string 2))) + (params (if (match-end 3) + (read (concat "(" (match-string 3) ")"))))) + (push (list :name name :transform transform :params params) + rtn) + (when (bobp) (throw :bob nil)) + (forward-line -1)))) rtn))) (defun orgtbl-send-replace-tbl (name text) diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index 4697e39a8dd..6bef3101bbe 100644 --- a/lisp/org/org-version.el +++ b/lisp/org/org-version.el @@ -5,13 +5,13 @@ (defun org-release () "The release version of Org. Inserted by installing Org mode or when a release is made." - (let ((org-release "9.7.3")) + (let ((org-release "9.7.4")) org-release)) ;;;###autoload (defun org-git-version () "The Git version of Org mode. Inserted by installing Org or when a release is made." - (let ((org-git-version "release_9.7.3")) + (let ((org-git-version "release_9.7.4-7-g165319")) org-git-version)) (provide 'org-version) diff --git a/lisp/org/org.el b/lisp/org/org.el index ff5b63212e0..2be404e368e 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -9,7 +9,7 @@ ;; URL: https://orgmode.org ;; Package-Requires: ((emacs "26.1")) -;; Version: 9.7.3 +;; Version: 9.7.4 ;; This file is part of GNU Emacs. ;; @@ -16981,10 +16981,11 @@ buffer boundaries with possible narrowing." (t nil)))) (defun org-image--align (link) - "Determine the alignment of the image link. + "Determine the alignment of the image LINK. +LINK is a link object. In decreasing order of priority, this is controlled: -- Per image by the value of `:center' or ``:align' in the +- Per image by the value of `:center' or `:align' in the affiliated keyword `#+attr_org'. - By the `#+attr_html' or `#+attr_latex` keywords with valid `:center' or `:align' values. @@ -16998,15 +16999,16 @@ will cause it to be right-aligned. A value of \"left\" or nil implies no special alignment." (let ((par (org-element-lineage link 'paragraph))) ;; Only align when image is not surrounded by paragraph text: - (when (and (= (org-element-begin link) + (when (and par ; when image is not in paragraph, but in table/headline/etc, do not align + (= (org-element-begin link) (save-excursion (goto-char (org-element-contents-begin par)) (skip-chars-forward "\t ") (point))) ;account for leading space ;before link (<= (- (org-element-contents-end par) - (org-element-end link)) - 1)) ;account for trailing newline + (org-element-end link)) + 1)) ;account for trailing newline ;at end of paragraph (save-match-data ;; Look for a valid ":center t" or ":align left|center|right" @@ -20871,11 +20873,25 @@ When nil, use `org-attach-method'." (defvar org-attach-method) (defun org--dnd-rmc (prompt choices) + "Display a menu or dialog and select with PROMPT among CHOICES. +PROMPT is the prompt string. CHOICES is a list of choices. Each +choice is a list of (key description value). VALUE from the selected +choice is returned." (if (null (and ;; Emacs <=28 does not have `use-dialog-box-p'. (fboundp 'use-dialog-box-p) (use-dialog-box-p))) - (caddr (read-multiple-choice prompt choices)) + (progn + (setq choices + (mapcar + (pcase-lambda (`(,key ,message ,val)) + ;; `read-multiple-choice' expects VAL to be a long + ;; description of the choice - string or nil. Move VAL + ;; further, so that it is not seen by the extended + ;; help in `read-multiple-choice'. + (list key message nil val)) + choices)) + (nth 3 (read-multiple-choice prompt choices))) (setq choices (mapcar (pcase-lambda (`(_key ,message ,val)) @@ -20939,15 +20955,18 @@ SEPARATOR is the string to insert after each link." ('private (or org-yank-dnd-default-attach-method org-attach-method))))) (if separatep - (funcall - (pcase method - ('cp #'copy-file) - ('mv #'rename-file) - ('ln #'add-name-to-file) - ('lns #'make-symbolic-link)) - filename - (expand-file-name (file-name-nondirectory filename) - org-yank-image-save-method)) + (progn + (unless (file-directory-p org-yank-image-save-method) + (make-directory org-yank-image-save-method t)) + (funcall + (pcase method + ('cp #'copy-file) + ('mv #'rename-file) + ('ln #'add-name-to-file) + ('lns #'make-symbolic-link)) + filename + (expand-file-name (file-name-nondirectory filename) + org-yank-image-save-method))) (org-attach-attach filename nil method)) (insert (org-link-make-string diff --git a/lisp/org/ox.el b/lisp/org/ox.el index 1c52ca2905e..35bbf84a0ca 100644 --- a/lisp/org/ox.el +++ b/lisp/org/ox.el @@ -1398,8 +1398,7 @@ external parameters overriding Org default settings, but still inferior to file-local settings." ;; First install #+BIND variables since these must be set before ;; global options are read. - (dolist (pair (org-export--list-bound-variables)) - (set (make-local-variable (car pair)) (nth 1 pair))) + (org-export--set-variables (org-export--list-bound-variables)) ;; Get and prioritize export options... (org-combine-plists ;; ... from global variables... @@ -2585,7 +2584,7 @@ Return the updated communication channel." (defun org-export--set-variables (variable-alist) "Set buffer-local variables according to VARIABLE-ALIST in current buffer." (pcase-dolist (`(,var . ,val) variable-alist) - (set (make-local-variable var) val))) + (set (make-local-variable var) (car val)))) (cl-defun org-export-copy-buffer (&key to-buffer drop-visibility drop-narrowing drop-contents @@ -6672,7 +6671,7 @@ and `org-export-to-file' for more specialized functions." (with-temp-message "Initializing asynchronous export process" (let ((copy-fun (org-element--generate-copy-script (current-buffer))) (temp-file (make-temp-file "org-export-process"))) - (let ((coding-system-for-write 'utf-8-emacs-unix)) + (let ((coding-system-for-write 'emacs-internal)) (write-region ;; Null characters (from variable values) are inserted ;; within the file. As a consequence, coding system for -- 2.39.2