Merge branch 'bugfix' into emacs-sync

This commit is contained in:
Kyle Meyer 2024-06-15 14:23:31 -04:00
commit e38ff040bb
34 changed files with 245 additions and 162 deletions

View File

@ -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
@ -276,7 +285,7 @@ passing universal argument.
When using this feature, IDs should not include =::=, which is used in
links to indicate the start of the search string. For backwards
compability, existing IDs including =::= will still be matched (but
compatibility, existing IDs including =::= will still be matched (but
cannot be used together with search option). A new org-lint checker
has been added to warn about this.
@ -417,8 +426,8 @@ in the dynamic block.
A global default formatting function for =colview= dynamic blocks can
be set via the new option ~org-columns-dblock-formatter~ which
defaults to the new function ~org-columns-dblock-write-default~, that
implements the previous (fixed) formatting behaviour. Hence, the
default behaviour is identical to previous versions.
implements the previous (fixed) formatting behavior. Hence, the
default behavior is identical to previous versions.
The global default function can be overridden for any given =colview=
dynamic block individually by specifying a custom formatter function
@ -884,7 +893,7 @@ order to remain backward-compatible.
Before, a ClojureScript source block used the same backend as Clojure,
configured in ~org-babel-clojure-backend~ and relied on an undocumented
~:target~ paramter.
~:target~ parameter.
Now, there's ~org-babel-clojurescript-backend~ to determine the
backend used for evaluation of ClojureScript.
@ -962,7 +971,7 @@ manner with ~run-python~.
*** New hook option ~org-indent-post-buffer-init-functions~
This allows to run functions after ~org-indent~ intializes a buffer to
This allows to run functions after ~org-indent~ initializes a buffer to
enrich its properties.
*** New option ~org-agenda-start-with-archives-mode~
@ -1025,7 +1034,7 @@ of the dynamic block. This new option can be used to set the global
default formatting function that will be used for =colview= dynamic
blocks that do not specify any ~:formatter~ parameter. Its default
value (the new function ~org-columns-dblock-write-default~) yields the
previous (fixed) formatting behaviour.
previous (fixed) formatting behavior.
*** New allowed value of ~org-md-headline-style~ to mix ATX and Setext style headlines
@ -1569,12 +1578,12 @@ is initiated only when user explicitly executes R/Julia-mode commands
that trigger session interactions (requires ESS 24.01.0 or newer).
The same session will remain available in the context of Org babel.
*** ~org-store-link~ behaviour storing additional =CUSTOM_ID= links has changed
*** ~org-store-link~ behavior storing additional =CUSTOM_ID= links has changed
Previously, when storing =id:= link, ~org-store-link~ stored an
additional "human readable" link using a node's =CUSTOM_ID= property.
This behaviour has been expanded to store an additional =CUSTOM_ID=
This behavior has been expanded to store an additional =CUSTOM_ID=
link when storing any type of external link type in an Org file, not
just =id:= links.
@ -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.

View File

@ -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

View File

@ -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)))

View File

@ -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"))

View File

@ -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))
@ -909,7 +915,7 @@ guess will be made."
;; insert a link to `:file'.
(when (and result
(not (or (member "link" result-params)
(member "graphics" result-params))))
(member "graphics" result-params))))
(with-temp-file file
(insert (org-babel-format-result
result
@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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))

View File

@ -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.

View File

@ -131,13 +131,13 @@ 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)) ""))
(batch/load (or (cdr (assq :batch params)) "batchload"))
(cmdline (if (or (equal cmdline "") (equal batch/load "batchload"))
;; legacy behaviour:
;; legacy behavior:
;; ensure that --very-quiet is on command-line by default
(concat cmdline " " org-babel-maxima--command-arguments-default)
;; if using an alternate loader, :cmdline overwrites default
@ -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

View File

@ -230,7 +230,7 @@ convert them into an Emacs-lisp table. Otherwise return the
results as a string."
(let ((res (if (and (> (length results) 0)
(string-equal "{" (substring results 0 1)))
results ;don't covert dicts to elisp
results ;don't convert dicts to elisp
(org-babel-script-escape results))))
(if (listp res)
(mapcar (lambda (el) (if (eq el 'None)

View File

@ -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)))

View File

@ -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)))

View File

@ -369,7 +369,7 @@ another window."
(const wl-other-frame)))))
(defcustom org-link-search-must-match-exact-headline 'query-to-create
"Control fuzzy link behaviour when specific matches not found.
"Control fuzzy link behavior when specific matches not found.
When nil, if a fuzzy link does not match a more specific
target (such as a heading, named block, target, or code ref),
@ -378,7 +378,7 @@ attempt a regular text search. When set to the special value
link instead. Otherwise, signal an error rather than attempting
a regular text search.
This option only affects behaviour in Org buffers. Spaces and
This option only affects behavior in Org buffers. Spaces and
statistics cookies are ignored during heading searches."
:group 'org-link-follow
:version "24.1"

View File

@ -530,7 +530,7 @@ DIR-property exists (that is different from the unset one)."
"Turn the autotag on or (if OFF is set) off."
(when org-attach-auto-tag
;; FIXME: There is currently no way to set #+FILETAGS
;; programatically. Do nothing when before first heading
;; programmatically. Do nothing when before first heading
;; (attaching to file) to avoid blocking error.
(unless (org-before-first-heading-p)
(save-excursion

View File

@ -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"

View File

@ -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))

View File

@ -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

View File

@ -633,7 +633,7 @@ With a numeric prefix, show all headlines up to that level."
(org-cycle-content 5))
;; `nofold' and `showall' are technically not allowed values, but
;; they are often intuitively tried by users by analogy with
;; #+STARTUP: nofold or #STARUP: showall.
;; #+STARTUP: nofold or #STARTUP: showall.
((memq org-startup-folded '(showeverything nil nofold showall))
(org-fold-show-all)))
(unless (eq org-startup-folded 'showeverything)

View File

@ -648,7 +648,7 @@ IMPORTANT: The buffer copy may also have variable `buffer-file-name'
copied.
To prevent Emacs overwriting the original buffer file,
`write-contents-functions' is set to \='(always). Do not alter this
`write-contents-functions' is set to \\='(always). Do not alter this
variable and do not do anything that might alter it (like calling a
major mode) to prevent data corruption. Also, do note that Emacs may
jump into the created buffer if the original file buffer is closed and
@ -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
@ -4489,7 +4489,7 @@ Assume point is at the beginning of the timestamp."
(and (org-string-nw-p warning-string) (concat " " warning-string))
(cdr brackets))))
(concat
;; Opening backet: [ or <
;; Opening bracket: [ or <
(car brackets)
;; Starting date/time: YYYY-MM-DD DAY[ HH:MM]
(if (eq type 'diary)

View File

@ -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)))

View File

@ -148,7 +148,7 @@ random Automatically generate a unique, random label."
(const :tag "Prompt for label" nil)
(const :tag "Create automatic [fn:N]" t)
(const :tag "Offer automatic [fn:N] for editing" confirm)
(const :tag "Create anoymous [fn::]" anonymous)
(const :tag "Create anonymous [fn::]" anonymous)
(const :tag "Create a random label" random))
:safe #'symbolp)

View File

@ -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)))

View File

@ -815,7 +815,7 @@ Match at beginning of line when WITH-BOL is non-nil."
(and (not (bobp))
(save-excursion
(forward-line n)
(skip-chars-forward "[ \t]")
(skip-chars-forward " \t")
(eolp))))
(defun org-previous-line-empty-p ()

View File

@ -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

View File

@ -24,7 +24,7 @@
;;; Commentary:
;; This library implementes completion support in Org mode buffers.
;; This library implements completion support in Org mode buffers.
;;; Code:

View File

@ -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)
@ -452,7 +452,7 @@ FORMAT and ARGS are passed to `message'."
"Write elisp DATA to FILE."
;; Fsync slightly reduces the chance of an incomplete filesystem
;; write, however on modern hardware its effectiveness is
;; questionable and it is insufficient to garantee complete writes.
;; questionable and it is insufficient to guarantee complete writes.
;; Coupled with the significant performance hit if writing many
;; small files, it simply does not make sense to use fsync here,
;; particularly as cache corruption is only a minor inconvenience.
@ -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

View File

@ -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.

View File

@ -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)

View File

@ -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.
;;
@ -8738,7 +8738,7 @@ there is one, return it."
(save-window-excursion
;; We have no direct control over how
;; `with-output-to-temp-buffer' displays the buffer. Try
;; to gain more space, makign sure that only the Org
;; to gain more space, making sure that only the Org
;; buffer and the *Select link* buffer are displayed for
;; the duration of selection.
(ignore-errors (delete-other-windows))
@ -10041,7 +10041,7 @@ where CURRENT-TODO-KEYWORD belongs over on in another sequence."
org-todo-key-alist))))
field-number ; current todo keyword column in the completion buffer.
todo-binding-spec todo-keyword todo-char input-char)
;; Display todo selection dialogue, read the user input, and return.
;; Display todo selection dialog, read the user input, and return.
(save-excursion
(save-window-excursion
;; Select todo keyword list buffer, and display it unless EXPERT-INTERFACE.
@ -12224,7 +12224,7 @@ Returns the new tags string, or nil to not change the current settings."
(move-overlay org-tags-overlay ov-start ov-end)
;; Highlight tags overlay in Org buffer.
(org-set-current-tags-overlay current-tags ov-prefix)
;; Display tag selection dialogue, read the user input, and return.
;; Display tag selection dialog, read the user input, and return.
(save-excursion
(save-window-excursion
;; Select tag list buffer, and display it unless EXPERT-INTERFACE.
@ -12239,7 +12239,7 @@ Returns the new tags string, or nil to not change the current settings."
;; Insert current tags.
(org-fast-tag-insert "Inherited" inherited-tags inherited-face "\n")
(org-fast-tag-insert "Current" current-tags current-face "\n\n")
;; Display whether next change exits selection dialogue.
;; Display whether next change exits selection dialog.
(org-fast-tag-show-exit exit-after-next)
;; Show tags, tag groups, and bindings in a grid.
;; Each tag in the grid occupies FIELD-WIDTH characters.
@ -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"
@ -20749,7 +20751,7 @@ it has a `diary' type."
(yank-media-handler "image/.*" #'org--image-yank-media-handler)
;; Looks like different DEs go for different handler names,
;; https://larsee.com/blog/2019/05/clipboard-files/.
(yank-media-handler "x/special-\\(?:gnome\|KDE\|mate\\)-files"
(yank-media-handler "x/special-\\(?:gnome\\|KDE\\|mate\\)-files"
#'org--copied-files-yank-media-handler))
(when (boundp 'x-dnd-direct-save-function)
(setq-local x-dnd-direct-save-function #'org--dnd-xds-function)))
@ -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
@ -20965,7 +20984,7 @@ SEPARATOR is the string to insert after each link."
"The method to use for dropped file.")
(defun org--dnd-xds-function (need-name filename)
"Handle file with FILENAME dropped via XDS protocol.
When NEED-NAME is t, FILNAME is the base name of the file to be
When NEED-NAME is t, FILENAME is the base name of the file to be
saved.
When NEED-NAME is nil, the drop is complete."
(if need-name

View File

@ -185,7 +185,7 @@ All these properties should be backend agnostic. Backend
specific properties are set through `org-export-define-backend'.
Properties redefined there have precedence over these.")
(defconst org-export-filters-alist
(defvar org-export-filters-alist
'((:filter-body . org-export-filter-body-functions)
(:filter-bold . org-export-filter-bold-functions)
(:filter-babel-call . org-export-filter-babel-call-functions)
@ -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
@ -6254,7 +6253,7 @@ them."
("no" :default "Illustrasjon")
("nb" :default "Illustrasjon")
("nn" :default "Illustrasjon")
("pl" :default "Obrazek") ; alternativly "Rysunek"
("pl" :default "Obrazek") ; alternatively "Rysunek"
("pt_BR" :default "Figura")
("ro" :default "Imaginea")
("ru" :html "&#1056;&#1080;&#1089;&#1091;&#1085;&#1086;&#1082;" :utf-8 "Рисунок")
@ -6277,7 +6276,7 @@ them."
("no" :default "Illustrasjon %d")
("nb" :default "Illustrasjon %d")
("nn" :default "Illustrasjon %d")
("pl" :default "Obrazek %d") ; alternativly "Rysunek %d"
("pl" :default "Obrazek %d") ; alternatively "Rysunek %d"
("pt_BR" :default "Figura %d:")
("ro" :default "Imaginea %d:")
("ru" :html "&#1056;&#1080;&#1089;. %d.:" :utf-8 "Рис. %d.:")
@ -6438,7 +6437,7 @@ them."
("nl" :default "Zie figuur %s"
:html "Zie figuur&nbsp;%s" :latex "Zie figuur~%s")
("nn" :default "Sjå figur %s")
("pl" :default "Patrz obrazek %s") ; alternativly "Patrz rysunek %s"
("pl" :default "Patrz obrazek %s") ; alternatively "Patrz rysunek %s"
("pt_BR" :default "Veja a figura %s")
("ro" :default "Vezi figura %s")
("sl" :default "Glej sliko %s")
@ -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

View File

@ -30,14 +30,18 @@
"Generate the Texinfo file out of the Org manual."
(require 'ox-texinfo)
(find-file "../doc/org-manual.org")
(let ((org-confirm-babel-evaluate nil))
(let ((org-confirm-babel-evaluate nil)
;; We do not want to search local user files when building manuals.
(org-id-track-globally nil))
(org-texinfo-export-to-texinfo)))
(defun org-make-guide ()
"Generate the Texinfo file out of the Org guide."
(require 'ox-texinfo)
(find-file "../doc/org-guide.org")
(let ((org-confirm-babel-evaluate nil))
(let ((org-confirm-babel-evaluate nil)
;; We do not want to search local user files when building manuals.
(org-id-track-globally nil))
(org-texinfo-export-to-texinfo)))
(make-obsolete 'org-make-manuals
@ -48,7 +52,9 @@
(require 'ox-texinfo)
(dolist (manual '("../doc/org-manual.org" "../doc/org-guide.org"))
(find-file manual)
(let ((org-confirm-babel-evaluate nil))
(let ((org-confirm-babel-evaluate nil)
;; We do not want to search local user files when building manuals.
(org-id-track-globally nil))
(org-texinfo-export-to-texinfo))))
(defun org-make-org-version (org-release org-git-version)

View File

@ -133,7 +133,18 @@ variable, and communication channel under `info'."
(org-export-create-backend
:transcoders
'((section . (lambda (s c i)
(if (eq test-ox-var 'value) "Yes" "No")))))))))))
(if (eq test-ox-var 'value) "Yes" "No"))))))))))
;; Seen from elisp code blocks as well.
(should
(string-match-p "::: \"test value\""
(org-test-with-temp-text "#+BIND: test-ox-var \"test value\"
#+begin_src emacs-lisp :results value :exports results :eval yes
(format \"::: %S\" test-ox-var)
#+end_src"
(let ((org-export-allow-bind-keywords t))
(org-export-as
(org-test-default-backend)))))))
(ert-deftest test-org-export/parse-option-keyword ()
"Test reading all standard #+OPTIONS: items."