aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer2021-10-02 14:27:55 -0400
committerKyle Meyer2021-10-02 14:41:27 -0400
commitbb209cd5ab819c72784de7278092705e59ff41d5 (patch)
treee169d918d7090a10a8e30bf0ff9e914cc9d2d733 /lisp
parent4341e79a5fad3e5e668a3eeb1b688d1986011481 (diff)
downloademacs-bb209cd5ab819c72784de7278092705e59ff41d5.tar.gz
emacs-bb209cd5ab819c72784de7278092705e59ff41d5.zip
Update to Org 9.5-30-g10dc9d
The plan is to cut the Org 9.5.1 release and include it in Emacs 28.1, but in the meantime regularly sync changes from Org's bugfix branch to emacs-28. This sync includes files from Org 9.5's new etc/csl/ directory that should have been synced in bf9ec3d91a (Update to Org 9.5, 2021-09-29).
Diffstat (limited to 'lisp')
-rw-r--r--lisp/org/ob-gnuplot.el2
-rw-r--r--lisp/org/ob-julia.el42
-rw-r--r--lisp/org/oc-csl.el24
-rw-r--r--lisp/org/org-macs.el9
-rw-r--r--lisp/org/org-src.el19
-rw-r--r--lisp/org/org-version.el2
-rw-r--r--lisp/org/org.el1
7 files changed, 49 insertions, 50 deletions
diff --git a/lisp/org/ob-gnuplot.el b/lisp/org/ob-gnuplot.el
index 3c84e4da14f..8c4a5957b99 100644
--- a/lisp/org/ob-gnuplot.el
+++ b/lisp/org/ob-gnuplot.el
@@ -290,7 +290,7 @@ Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE."
290 (orgtbl-to-generic 290 (orgtbl-to-generic
291 table 291 table
292 (org-combine-plists 292 (org-combine-plists
293 '(:sep "\t" :fmt org-babel-gnuplot-quote-tsv-field) 293 '(:sep "\t" :fmt org-babel-gnuplot-quote-tsv-field :raw t :backend ascii)
294 params))))) 294 params)))))
295 data-file) 295 data-file)
296 296
diff --git a/lisp/org/ob-julia.el b/lisp/org/ob-julia.el
index 434b414b614..4fae0d142b2 100644
--- a/lisp/org/ob-julia.el
+++ b/lisp/org/ob-julia.el
@@ -90,18 +90,13 @@ This function is called by `org-babel-execute-src-block'."
90 (graphics-file (and (member "graphics" (assq :result-params params)) 90 (graphics-file (and (member "graphics" (assq :result-params params))
91 (org-babel-graphical-output-file params))) 91 (org-babel-graphical-output-file params)))
92 (colnames-p (unless graphics-file (cdr (assq :colnames params)))) 92 (colnames-p (unless graphics-file (cdr (assq :colnames params))))
93 ;; (rownames-p (unless graphics-file (cdr (assq :rownames params))))
94 (full-body (org-babel-expand-body:julia body params graphics-file)) 93 (full-body (org-babel-expand-body:julia body params graphics-file))
95 (result 94 (result
96 (org-babel-julia-evaluate 95 (org-babel-julia-evaluate
97 session full-body result-type result-params 96 session full-body result-type result-params
98 (or (equal "yes" colnames-p) 97 (or (equal "yes" colnames-p)
99 (org-babel-pick-name 98 (org-babel-pick-name
100 (cdr (assq :colname-names params)) colnames-p)) 99 (cdr (assq :colname-names params)) colnames-p)))))
101 ;; (or (equal "yes" rownames-p)
102 ;; (org-babel-pick-name
103 ;; (cdr (assq :rowname-names params)) rownames-p))
104 )))
105 (if graphics-file nil result)))) 100 (if graphics-file nil result))))
106 101
107(defun org-babel-normalize-newline (result) 102(defun org-babel-normalize-newline (result)
@@ -135,12 +130,7 @@ This function is called by `org-babel-execute-src-block'."
135 "Return list of julia statements assigning the block's variables." 130 "Return list of julia statements assigning the block's variables."
136 (let ((vars (org-babel--get-vars params))) 131 (let ((vars (org-babel--get-vars params)))
137 (mapcar 132 (mapcar
138 (lambda (pair) 133 (lambda (pair) (org-babel-julia-assign-elisp (car pair) (cdr pair)))
139 (org-babel-julia-assign-elisp
140 (car pair) (cdr pair)
141 ;; (equal "yes" (cdr (assq :colnames params)))
142 ;; (equal "yes" (cdr (assq :rownames params)))
143 ))
144 (mapcar 134 (mapcar
145 (lambda (i) 135 (lambda (i)
146 (cons (car (nth i vars)) 136 (cons (car (nth i vars))
@@ -156,7 +146,7 @@ This function is called by `org-babel-execute-src-block'."
156 (concat "\"" (mapconcat #'identity (split-string s "\"") "\"\"") "\"") 146 (concat "\"" (mapconcat #'identity (split-string s "\"") "\"\"") "\"")
157 (format "%S" s))) 147 (format "%S" s)))
158 148
159(defun org-babel-julia-assign-elisp (name value) ;; colnames-p rownames-p 149(defun org-babel-julia-assign-elisp (name value)
160 "Construct julia code assigning the elisp VALUE to a variable named NAME." 150 "Construct julia code assigning the elisp VALUE to a variable named NAME."
161 (if (listp value) 151 (if (listp value)
162 (let* ((lengths (mapcar #'length (cl-remove-if-not #'sequencep value))) 152 (let* ((lengths (mapcar #'length (cl-remove-if-not #'sequencep value)))
@@ -164,11 +154,7 @@ This function is called by `org-babel-execute-src-block'."
164 (min (if lengths (apply #'min lengths) 0))) 154 (min (if lengths (apply #'min lengths) 0)))
165 ;; Ensure VALUE has an orgtbl structure (depth of at least 2). 155 ;; Ensure VALUE has an orgtbl structure (depth of at least 2).
166 (unless (listp (car value)) (setq value (list value))) 156 (unless (listp (car value)) (setq value (list value)))
167 (let ((file (orgtbl-to-csv value '(:fmt org-babel-julia-quote-csv-field))) 157 (let ((file (orgtbl-to-csv value '(:fmt org-babel-julia-quote-csv-field))))
168 ;; (header (if (or (eq (nth 1 value) 'hline) colnames-p)
169 ;; "TRUE" "FALSE"))
170 ;; (row-names (if rownames-p "1" "NULL"))
171 )
172 (if (= max min) 158 (if (= max min)
173 (format "%s = begin 159 (format "%s = begin
174 using CSV 160 using CSV
@@ -188,7 +174,7 @@ end"
188 (let ((session (or session "*Julia*")) 174 (let ((session (or session "*Julia*"))
189 (ess-ask-for-ess-directory 175 (ess-ask-for-ess-directory
190 (and (bound-and-true-p ess-ask-for-ess-directory) 176 (and (bound-and-true-p ess-ask-for-ess-directory)
191 (not (cdr (assq :dir params)))))) 177 (not (cdr (assq :dir params))))))
192 (if (org-babel-comint-buffer-livep session) 178 (if (org-babel-comint-buffer-livep session)
193 session 179 session
194 ;; FIXME: Depending on `display-buffer-alist', (julia) may end up 180 ;; FIXME: Depending on `display-buffer-alist', (julia) may end up
@@ -209,14 +195,6 @@ end"
209 (buffer-name)))) 195 (buffer-name))))
210 (current-buffer)))))) 196 (current-buffer))))))
211 197
212 ; (defun org-babel-julia-associate-session (session)
213 ; "Associate julia code buffer with a julia session.
214 ; Make SESSION be the inferior ESS process associated with the
215 ; current code buffer."
216 ; (setq ess-local-process-name
217 ; (process-name (get-buffer-process session)))
218 ; (ess-make-buffer-current))
219
220(defun org-babel-julia-graphical-output-file (params) 198(defun org-babel-julia-graphical-output-file (params)
221 "Name of file to which julia should send graphical output." 199 "Name of file to which julia should send graphical output."
222 (and (member "graphics" (cdr (assq :result-params params))) 200 (and (member "graphics" (cdr (assq :result-params params)))
@@ -259,16 +237,16 @@ end"
259end") 237end")
260 238
261(defun org-babel-julia-evaluate 239(defun org-babel-julia-evaluate
262 (session body result-type result-params column-names-p) ;; row-names-p 240 (session body result-type result-params column-names-p)
263 "Evaluate julia code in BODY." 241 "Evaluate julia code in BODY."
264 (if session 242 (if session
265 (org-babel-julia-evaluate-session 243 (org-babel-julia-evaluate-session
266 session body result-type result-params column-names-p) ;; row-names-p 244 session body result-type result-params column-names-p)
267 (org-babel-julia-evaluate-external-process 245 (org-babel-julia-evaluate-external-process
268 body result-type result-params column-names-p))) ;; row-names-p 246 body result-type result-params column-names-p)))
269 247
270(defun org-babel-julia-evaluate-external-process 248(defun org-babel-julia-evaluate-external-process
271 (body result-type result-params column-names-p) ;; row-names-p 249 (body result-type result-params column-names-p)
272 "Evaluate BODY in external julia process. 250 "Evaluate BODY in external julia process.
273If RESULT-TYPE equals 'output then return standard output as a 251If RESULT-TYPE equals 'output then return standard output as a
274string. If RESULT-TYPE equals 'value then return the value of the 252string. If RESULT-TYPE equals 'value then return the value of the
@@ -292,7 +270,7 @@ last statement in BODY, as elisp."
292 (output (org-babel-eval org-babel-julia-command body)))) 270 (output (org-babel-eval org-babel-julia-command body))))
293 271
294(defun org-babel-julia-evaluate-session 272(defun org-babel-julia-evaluate-session
295 (session body result-type result-params column-names-p) ;; row-names-p 273 (session body result-type result-params column-names-p)
296 "Evaluate BODY in SESSION. 274 "Evaluate BODY in SESSION.
297If RESULT-TYPE equals 'output then return standard output as a 275If RESULT-TYPE equals 'output then return standard output as a
298string. If RESULT-TYPE equals 'value then return the value of the 276string. If RESULT-TYPE equals 'value then return the value of the
diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el
index b847fbbc4f6..3d138807592 100644
--- a/lisp/org/oc-csl.el
+++ b/lisp/org/oc-csl.el
@@ -186,15 +186,21 @@ Used only when `second-field-align' is activated by the used CSL style."
186 186
187;;; Internal variables 187;;; Internal variables
188(defconst org-cite-csl--etc-dir 188(defconst org-cite-csl--etc-dir
189 (let* ((oc-root (file-name-directory (locate-library "oc"))) 189 (let ((oc-root (file-name-directory (locate-library "oc"))))
190 (oc-etc-dir-1 (expand-file-name "../etc/csl/" oc-root))) 190 (cond
191 ;; package.el and straight will put all of org-mode/lisp/ in org-mode/. 191 ;; First check whether it looks like we're running from the main
192 ;; This will cause .. to resolve to the directory above Org. 192 ;; Org repository.
193 ;; To make life easier for people using package.el or straight, we can 193 ((let ((csl-org (expand-file-name "../etc/csl/" oc-root)))
194 ;; check to see if ../etc/csl exists, and if it doesn't try ./etc/csl. 194 (and (file-directory-p csl-org) csl-org)))
195 (if (file-exists-p oc-etc-dir-1) oc-etc-dir-1 195 ;; Next look for the directory alongside oc.el because package.el
196 (expand-file-name "etc/csl/" oc-root))) 196 ;; and straight will put all of org-mode/lisp/ in org-mode/.
197 "Directory \"etc/\" from repository.") 197 ((let ((csl-pkg (expand-file-name "etc/csl/" oc-root)))
198 (and (file-directory-p csl-pkg) csl-pkg)))
199 ;; Finally fall back the location used by shared system installs
200 ;; and when running directly from Emacs repository.
201 (t
202 (expand-file-name "org/csl/" data-directory))))
203 "Directory containing CSL-related data files.")
198 204
199(defconst org-cite-csl--fallback-locales-dir org-cite-csl--etc-dir 205(defconst org-cite-csl--fallback-locales-dir org-cite-csl--etc-dir
200 "Fallback CSL locale files directory.") 206 "Fallback CSL locale files directory.")
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index a8fb79ea3cd..0779c3a82c8 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -326,17 +326,19 @@ it for output."
326 326
327;;; Indentation 327;;; Indentation
328 328
329(defun org-do-remove-indentation (&optional n) 329(defun org-do-remove-indentation (&optional n skip-fl)
330 "Remove the maximum common indentation from the buffer. 330 "Remove the maximum common indentation from the buffer.
331When optional argument N is a positive integer, remove exactly 331When optional argument N is a positive integer, remove exactly
332that much characters from indentation, if possible. Return nil 332that much characters from indentation, if possible. When
333if it fails." 333optional argument SKIP-FL is non-nil, skip the first
334line. Return nil if it fails."
334 (catch :exit 335 (catch :exit
335 (goto-char (point-min)) 336 (goto-char (point-min))
336 ;; Find maximum common indentation, if not specified. 337 ;; Find maximum common indentation, if not specified.
337 (let ((n (or n 338 (let ((n (or n
338 (let ((min-ind (point-max))) 339 (let ((min-ind (point-max)))
339 (save-excursion 340 (save-excursion
341 (when skip-fl (forward-line))
340 (while (re-search-forward "^[ \t]*\\S-" nil t) 342 (while (re-search-forward "^[ \t]*\\S-" nil t)
341 (let ((ind (current-indentation))) 343 (let ((ind (current-indentation)))
342 (if (zerop ind) (throw :exit nil) 344 (if (zerop ind) (throw :exit nil)
@@ -344,6 +346,7 @@ if it fails."
344 min-ind)))) 346 min-ind))))
345 (if (zerop n) (throw :exit nil) 347 (if (zerop n) (throw :exit nil)
346 ;; Remove exactly N indentation, but give up if not possible. 348 ;; Remove exactly N indentation, but give up if not possible.
349 (when skip-fl (forward-line))
347 (while (not (eobp)) 350 (while (not (eobp))
348 (let ((ind (progn (skip-chars-forward " \t") (current-column)))) 351 (let ((ind (progn (skip-chars-forward " \t") (current-column))))
349 (cond ((eolp) (delete-region (line-beginning-position) (point))) 352 (cond ((eolp) (delete-region (line-beginning-position) (point)))
diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el
index 91a3d415dfa..8d02cf43450 100644
--- a/lisp/org/org-src.el
+++ b/lisp/org/org-src.el
@@ -38,6 +38,7 @@
38(require 'org-keys) 38(require 'org-keys)
39 39
40(declare-function org-mode "org" ()) 40(declare-function org-mode "org" ())
41(declare-function org--get-expected-indentation "org" (element contentsp))
41(declare-function org-element-at-point "org-element" ()) 42(declare-function org-element-at-point "org-element" ())
42(declare-function org-element-class "org-element" (datum &optional parent)) 43(declare-function org-element-class "org-element" (datum &optional parent))
43(declare-function org-element-context "org-element" (&optional element)) 44(declare-function org-element-context "org-element" (&optional element))
@@ -327,7 +328,8 @@ a cons cell (LINE . COLUMN) or symbol `end'. See also
327 (if (>= pos end) 'end 328 (if (>= pos end) 'end
328 (org-with-wide-buffer 329 (org-with-wide-buffer
329 (goto-char (max beg pos)) 330 (goto-char (max beg pos))
330 (cons (count-lines beg (line-beginning-position)) 331 (cons (count-lines (save-excursion (goto-char beg) (line-beginning-position))
332 (line-beginning-position))
331 ;; Column is relative to the end of line to avoid problems of 333 ;; Column is relative to the end of line to avoid problems of
332 ;; comma escaping or colons appended in front of the line. 334 ;; comma escaping or colons appended in front of the line.
333 (- (point) (min end (line-end-position))))))) 335 (- (point) (min end (line-end-position)))))))
@@ -445,6 +447,7 @@ Assume point is in the corresponding edit buffer."
445 org-src--content-indentation 447 org-src--content-indentation
446 0)))) 448 0))))
447 (use-tabs? (and (> org-src--tab-width 0) t)) 449 (use-tabs? (and (> org-src--tab-width 0) t))
450 (preserve-fl (eq org-src--source-type 'latex-fragment))
448 (source-tab-width org-src--tab-width) 451 (source-tab-width org-src--tab-width)
449 (contents (org-with-wide-buffer 452 (contents (org-with-wide-buffer
450 (let ((eol (line-end-position))) 453 (let ((eol (line-end-position)))
@@ -466,7 +469,8 @@ Assume point is in the corresponding edit buffer."
466 ;; Add INDENTATION-OFFSET to every line in buffer, 469 ;; Add INDENTATION-OFFSET to every line in buffer,
467 ;; unless indentation is meant to be preserved. 470 ;; unless indentation is meant to be preserved.
468 (when (> indentation-offset 0) 471 (when (> indentation-offset 0)
469 (while (not (eobp)) 472 (when preserve-fl (forward-line))
473 (while (not (eobp))
470 (skip-chars-forward " \t") 474 (skip-chars-forward " \t")
471 (when (or (not (eolp)) ; not a blank line 475 (when (or (not (eolp)) ; not a blank line
472 (and (eq (point) (marker-position marker)) ; current line 476 (and (eq (point) (marker-position marker)) ; current line
@@ -518,7 +522,13 @@ Leave point in edit buffer."
518 (source-tab-width (if indent-tabs-mode tab-width 0)) 522 (source-tab-width (if indent-tabs-mode tab-width 0))
519 (type (org-element-type datum)) 523 (type (org-element-type datum))
520 (block-ind (org-with-point-at (org-element-property :begin datum) 524 (block-ind (org-with-point-at (org-element-property :begin datum)
521 (current-indentation))) 525 (cond
526 ((save-excursion (skip-chars-backward " \t") (bolp))
527 (current-indentation))
528 ((org-element-property :parent datum)
529 (org--get-expected-indentation
530 (org-element-property :parent datum) nil))
531 (t (current-indentation)))))
522 (content-ind org-edit-src-content-indentation) 532 (content-ind org-edit-src-content-indentation)
523 (blank-line (save-excursion (beginning-of-line) 533 (blank-line (save-excursion (beginning-of-line)
524 (looking-at-p "^[[:space:]]*$"))) 534 (looking-at-p "^[[:space:]]*$")))
@@ -548,7 +558,8 @@ Leave point in edit buffer."
548 (insert contents) 558 (insert contents)
549 (remove-text-properties (point-min) (point-max) 559 (remove-text-properties (point-min) (point-max)
550 '(display nil invisible nil intangible nil)) 560 '(display nil invisible nil intangible nil))
551 (unless preserve-ind (org-do-remove-indentation)) 561 (let ((lf (eq type 'latex-fragment)))
562 (unless preserve-ind (org-do-remove-indentation (and lf block-ind) lf)))
552 (set-buffer-modified-p nil) 563 (set-buffer-modified-p nil)
553 (setq buffer-file-name nil) 564 (setq buffer-file-name nil)
554 ;; Initialize buffer. 565 ;; Initialize buffer.
diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el
index ef363dc3901..5bccbe497cc 100644
--- a/lisp/org/org-version.el
+++ b/lisp/org/org-version.el
@@ -11,7 +11,7 @@ Inserted by installing Org mode or when a release is made."
11(defun org-git-version () 11(defun org-git-version ()
12 "The Git version of Org mode. 12 "The Git version of Org mode.
13Inserted by installing Org or when a release is made." 13Inserted by installing Org or when a release is made."
14 (let ((org-git-version "release_9.5")) 14 (let ((org-git-version "release_9.5-30-g10dc9d"))
15 org-git-version)) 15 org-git-version))
16 16
17(provide 'org-version) 17(provide 'org-version)
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 723de649429..bc0ea24bee7 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -5113,6 +5113,7 @@ stacked delimiters is N. Escaping delimiters is not possible."
5113 '(invisible t)) 5113 '(invisible t))
5114 (add-text-properties (match-beginning 3) (match-end 3) 5114 (add-text-properties (match-beginning 3) (match-end 3)
5115 '(invisible t))) 5115 '(invisible t)))
5116 (goto-char (match-end 0))
5116 (throw :exit t)))))))) 5117 (throw :exit t))))))))
5117 5118
5118(defun org-emphasize (&optional char) 5119(defun org-emphasize (&optional char)