From 15b09c16802446fd1771ead0a1162cabe7147681 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 30 Sep 2021 09:58:04 -0400 Subject: [PATCH 1/5] Backport commit a5b761ec3 from Emacs * lisp/org/ox-koma-letter.el: Use lexical-binding a5b761ec334cded8252e81c3887142a46752ec6a Stefan Monnier Thu Sep 30 09:58:04 2021 -0400 [ km: This was independently applied covered on the bugfix branch with the combination of 85e5540eb and f5b297292, but I'm applying it here too for bookkeeping/traceability purposes. ] --- lisp/ox-koma-letter.el | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/lisp/ox-koma-letter.el b/lisp/ox-koma-letter.el index 3bd2f684a..96704dbb9 100644 --- a/lisp/ox-koma-letter.el +++ b/lisp/ox-koma-letter.el @@ -1,4 +1,4 @@ -;;; ox-koma-letter.el --- KOMA Scrlttr2 Back-End for Org Export Engine +;;; ox-koma-letter.el --- KOMA Scrlttr2 Back-End for Org Export Engine -*- lexical-binding: t; -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. @@ -184,7 +184,6 @@ (defcustom org-koma-letter-class-option-file "NF" "Letter Class Option File. This option can also be set with the LCO keyword." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-author 'user-full-name @@ -196,7 +195,6 @@ Alternatively a string, nil or a function may be given. Functions must return a string. This option can also be set with the AUTHOR keyword." - :group 'org-export-koma-letter :type '(radio (function-item user-full-name) (string) (function) @@ -210,7 +208,6 @@ returns `user-mail-address'. Alternatively a string, nil or a function may be given. Functions must return a string. This option can also be set with the EMAIL keyword." - :group 'org-export-koma-letter :type '(radio (function-item org-koma-letter-email) (string) (function) @@ -220,33 +217,28 @@ This option can also be set with the EMAIL keyword." "Sender's address, as a string. This option can also be set with one or more FROM_ADDRESS keywords." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-phone-number "" "Sender's phone number, as a string. This option can also be set with the PHONE_NUMBER keyword." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-url "" "Sender's URL, e. g., the URL of her homepage. This option can also be set with the URL keyword." - :group 'org-export-koma-letter :type 'string :safe #'stringp) (defcustom org-koma-letter-from-logo "" "Commands for inserting the sender's logo, e. g., \\includegraphics{logo}. This option can also be set with the FROM_LOGO keyword." - :group 'org-export-koma-letter :type 'string :safe #'stringp) (defcustom org-koma-letter-place "" "Place from which the letter is sent, as a string. This option can also be set with the PLACE keyword." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-location "" @@ -264,7 +256,6 @@ special heading. The location field is typically printed right of the address field (See Figure 4.9. in the English manual of 2015-10-03)." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-opening "" @@ -278,7 +269,6 @@ when: (3) the letter contains a headline without a special tag (e.g. \"to\" or \"ps\"); then the opening will be implicitly set as the untagged headline title." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-closing "" @@ -292,7 +282,6 @@ when: tag \"closing\"; then the opening will be set as the title of the closing special heading title." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-signature "" @@ -308,14 +297,12 @@ then the signature will be set as the content of the closing special heading. Note if the content is empty the signature will not be set." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-prefer-special-headings nil "Non-nil means prefer headlines over keywords for TO and FROM. This option can also be set with the OPTIONS keyword, e.g.: \"special-headings:t\"." - :group 'org-export-koma-letter :type 'boolean) (defcustom org-koma-letter-subject-format t @@ -353,14 +340,12 @@ This option can also be set with the OPTIONS keyword, e.g.: (const :tag "Subject right-justified" right) (const :tag "Add title or description to subject" underlined) (const :tag "Set subject underlined" titled) - (const :tag "Do not add title or description to subject" untitled))) - :group 'org-export-koma-letter) + (const :tag "Do not add title or description to subject" untitled)))) (defcustom org-koma-letter-use-backaddress nil "Non-nil prints return address in line above to address. This option can also be set with the OPTIONS keyword, e.g.: \"backaddress:t\"." - :group 'org-export-koma-letter :type 'boolean) (defcustom org-koma-letter-use-foldmarks t @@ -393,7 +378,6 @@ following ones: This option can also be set with the OPTIONS keyword, e.g.: \"foldmarks:(b l m t)\"." - :group 'org-export-koma-letter :type '(choice (const :tag "Activate default folding marks" t) (const :tag "Deactivate folding marks" nil) @@ -418,14 +402,12 @@ This option can also be set with the OPTIONS keyword, e.g.: "Non-nil prints sender's phone number. This option can also be set with the OPTIONS keyword, e.g.: \"phone:t\"." - :group 'org-export-koma-letter :type 'boolean) (defcustom org-koma-letter-use-url nil "Non-nil prints sender's URL. This option can also be set with the OPTIONS keyword, e.g.: \"url:t\"." - :group 'org-export-koma-letter :type 'boolean :safe #'booleanp) @@ -433,7 +415,6 @@ This option can also be set with the OPTIONS keyword, e.g.: "Non-nil prints sender's FROM_LOGO. This option can also be set with the OPTIONS keyword, e.g.: \"from-logo:t\"." - :group 'org-export-koma-letter :type 'boolean :safe #'booleanp) @@ -441,34 +422,29 @@ This option can also be set with the OPTIONS keyword, e.g.: "Non-nil prints sender's email address. This option can also be set with the OPTIONS keyword, e.g.: \"email:t\"." - :group 'org-export-koma-letter :type 'boolean) (defcustom org-koma-letter-use-place t "Non-nil prints the letter's place next to the date. This option can also be set with the OPTIONS keyword, e.g.: \"place:nil\"." - :group 'org-export-koma-letter :type 'boolean) (defcustom org-koma-letter-default-class "default-koma-letter" "Default class for `org-koma-letter'. The value must be a member of `org-latex-classes'." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-headline-is-opening-maybe t "Non-nil means a headline may be used as an opening and closing. See also `org-koma-letter-opening' and `org-koma-letter-closing'." - :group 'org-export-koma-letter :type 'boolean) (defcustom org-koma-letter-prefer-subject nil "Non-nil means title should be interpreted as subject if subject is missing. This option can also be set with the OPTIONS keyword, e.g. \"title-subject:t\"." - :group 'org-export-koma-letter :type 'boolean) (defconst org-koma-letter-special-tags-in-letter '(to from closing location) From 7325cf186a5b482db57ef7845c7ad0d4a5462333 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 30 Sep 2021 10:02:29 -0400 Subject: [PATCH 2/5] Backport commit b5e3cc3bc from Emacs * lisp/ob-julia.el: Use lexical-binding. (ess-eval-visibly-p): Declare. (org-babel-julia-assign-elisp): Remove unused vars `header` and `row-names` and corespondingly remove now unused args `colnames-p` and `rownames-p`. (org-babel-variable-assignments:julia): Adjust call to `org-babel-julia-assign-elisp` accordingly. (org-babel-julia-initiate-session): Use `bound-and-true-p`. (org-babel-julia-evaluate-external-process) (org-babel-julia-evaluate-session, org-babel-julia-evaluate): Remove unused arg `row-names-p`. (org-babel-execute:julia): Adjust call to `org-babel-julia-evaluate` accordingly. * lisp/org/ob-julia.el: Use lexical-binding b5e3cc3bc597d56dfe09ee500717344649ea0354 Stefan Monnier Thu Sep 30 10:02:29 2021 -0400 [ km: This was independently applied covered on the bugfix branch with the combination of a3b6728f9 and efa498b67. I'm applying it here too for bookkeeping/traceability purposes, and to bring in one missing piece (see merge). ] --- lisp/ob-julia.el | 67 +++++++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/lisp/ob-julia.el b/lisp/ob-julia.el index 2f051a5c2..5ff6a7ca0 100644 --- a/lisp/ob-julia.el +++ b/lisp/ob-julia.el @@ -1,4 +1,4 @@ -;;; ob-julia.el --- org-babel functions for julia code evaluation +;;; ob-julia.el --- org-babel functions for julia code evaluation -*- lexical-binding: t; -*- ;; Copyright (C) 2013-2021 Free Software Foundation, Inc. ;; Authors: G. Jay Kerns, based on ob-R.el by Eric Schulte and Dan Davison @@ -44,7 +44,7 @@ (raw org html latex code pp wrap) (replace silent append prepend) (output value graphics)))) - "julia-specific header arguments.") + "Julia-specific header arguments.") (add-to-list 'org-babel-tangle-lang-exts '("julia" . "jl")) @@ -58,7 +58,8 @@ :type 'string) (defvar ess-current-process-name) ; dynamically scoped -(defvar ess-local-process-name) ; dynamically scoped +(defvar ess-local-process-name) ; dynamically scoped +(defvar ess-eval-visibly-p) ; dynamically scoped (defun org-babel-edit-prep:julia (info) (let ((session (cdr (assq :session (nth 2 info))))) (when (and session @@ -68,7 +69,7 @@ (defun org-babel-expand-body:julia (body params &optional _graphics-file) "Expand BODY according to PARAMS, return the expanded body." - (mapconcat 'identity + (mapconcat #'identity (append (when (cdr (assq :prologue params)) (list (cdr (assq :prologue params)))) @@ -89,7 +90,7 @@ This function is called by `org-babel-execute-src-block'." (graphics-file (and (member "graphics" (assq :result-params params)) (org-babel-graphical-output-file params))) (colnames-p (unless graphics-file (cdr (assq :colnames params)))) - (rownames-p (unless graphics-file (cdr (assq :rownames params)))) + ;; (rownames-p (unless graphics-file (cdr (assq :rownames params)))) (full-body (org-babel-expand-body:julia body params graphics-file)) (result (org-babel-julia-evaluate @@ -97,9 +98,10 @@ This function is called by `org-babel-execute-src-block'." (or (equal "yes" colnames-p) (org-babel-pick-name (cdr (assq :colname-names params)) colnames-p)) - (or (equal "yes" rownames-p) - (org-babel-pick-name - (cdr (assq :rowname-names params)) rownames-p))))) + ;; (or (equal "yes" rownames-p) + ;; (org-babel-pick-name + ;; (cdr (assq :rowname-names params)) rownames-p)) + ))) (if graphics-file nil result)))) (defun org-babel-normalize-newline (result) @@ -136,8 +138,9 @@ This function is called by `org-babel-execute-src-block'." (lambda (pair) (org-babel-julia-assign-elisp (car pair) (cdr pair) - (equal "yes" (cdr (assq :colnames params))) - (equal "yes" (cdr (assq :rownames params))))) + ;; (equal "yes" (cdr (assq :colnames params))) + ;; (equal "yes" (cdr (assq :rownames params))) + )) (mapcar (lambda (i) (cons (car (nth i vars)) @@ -150,21 +153,22 @@ This function is called by `org-babel-execute-src-block'." (defun org-babel-julia-quote-csv-field (s) "Quote field S for export to julia." (if (stringp s) - (concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"") "\"") + (concat "\"" (mapconcat #'identity (split-string s "\"") "\"\"") "\"") (format "%S" s))) -(defun org-babel-julia-assign-elisp (name value colnames-p rownames-p) +(defun org-babel-julia-assign-elisp (name value) ;; colnames-p rownames-p "Construct julia code assigning the elisp VALUE to a variable named NAME." (if (listp value) - (let* ((lengths (mapcar 'length (cl-remove-if-not 'sequencep value))) - (max (if lengths (apply 'max lengths) 0)) - (min (if lengths (apply 'min lengths) 0))) + (let* ((lengths (mapcar #'length (cl-remove-if-not #'sequencep value))) + (max (if lengths (apply #'max lengths) 0)) + (min (if lengths (apply #'min lengths) 0))) ;; Ensure VALUE has an orgtbl structure (depth of at least 2). (unless (listp (car value)) (setq value (list value))) (let ((file (orgtbl-to-csv value '(:fmt org-babel-julia-quote-csv-field))) - (header (if (or (eq (nth 1 value) 'hline) colnames-p) - "TRUE" "FALSE")) - (row-names (if rownames-p "1" "NULL"))) + ;; (header (if (or (eq (nth 1 value) 'hline) colnames-p) + ;; "TRUE" "FALSE")) + ;; (row-names (if rownames-p "1" "NULL")) + ) (if (= max min) (format "%s = begin using CSV @@ -183,11 +187,15 @@ end" (unless (string= session "none") (let ((session (or session "*Julia*")) (ess-ask-for-ess-directory - (and (boundp 'ess-ask-for-ess-directory) - ess-ask-for-ess-directory + (and (bound-and-true-p ess-ask-for-ess-directory) (not (cdr (assq :dir params)))))) (if (org-babel-comint-buffer-livep session) session + ;; FIXME: Depending on `display-buffer-alist', (julia) may end up + ;; popping up a new frame which `save-window-excursion' won't be able + ;; to "undo", so we really should call a kind of + ;; `julia-no-select' instead so we don't need to undo any + ;; window-changes afterwards. (save-window-excursion (when (get-buffer session) ;; Session buffer exists, but with dead process @@ -251,16 +259,16 @@ end" end") (defun org-babel-julia-evaluate - (session body result-type result-params column-names-p row-names-p) + (session body result-type result-params column-names-p) ;; row-names-p "Evaluate julia code in BODY." (if session (org-babel-julia-evaluate-session - session body result-type result-params column-names-p row-names-p) + session body result-type result-params column-names-p) ;; row-names-p (org-babel-julia-evaluate-external-process - body result-type result-params column-names-p row-names-p))) + body result-type result-params column-names-p))) ;; row-names-p (defun org-babel-julia-evaluate-external-process - (body result-type result-params column-names-p row-names-p) + (body result-type result-params column-names-p) ;; row-names-p "Evaluate BODY in external julia process. If RESULT-TYPE equals 'output then return standard output as a string. If RESULT-TYPE equals 'value then return the value of the @@ -284,7 +292,7 @@ last statement in BODY, as elisp." (output (org-babel-eval org-babel-julia-command body)))) (defun org-babel-julia-evaluate-session - (session body result-type result-params column-names-p row-names-p) + (session body result-type result-params column-names-p) ;; row-names-p "Evaluate BODY in SESSION. If RESULT-TYPE equals 'output then return standard output as a string. If RESULT-TYPE equals 'value then return the value of the @@ -314,7 +322,7 @@ last statement in BODY, as elisp." column-names-p))) (output (mapconcat - 'org-babel-chomp + #'org-babel-chomp (butlast (delq nil (mapcar @@ -327,13 +335,14 @@ last statement in BODY, as elisp." (substring line (match-end 1)) line)) (org-babel-comint-with-output (session org-babel-julia-eoe-output) - (insert (mapconcat 'org-babel-chomp + (insert (mapconcat #'org-babel-chomp (list body org-babel-julia-eoe-indicator) "\n")) - (inferior-ess-send-input)))))) "\n")))) + (inferior-ess-send-input)))))) + "\n")))) (defun org-babel-julia-process-value-result (result column-names-p) - "julia-specific processing of return value. + "Julia-specific processing of return value. Insert hline if column names in output have been requested." (if column-names-p (cons (car result) (cons 'hline (cdr result))) From c763b9ae61d46a8395a578cfc2246b9985ab5424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Thu, 30 Sep 2021 17:10:41 +0200 Subject: [PATCH 3/5] Backport commit 58102466e from Emacs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/org-element.el (org-element-headline-parser): Pretty sure this one should be `skip-chars-backward`, not `skip-syntax-backward`, since \t isn't a valid syntax code. org-element: use correct function 58102466e32d4dd9c7d816cdc3f4595a2145f332 Mattias EngdegÄrd Thu Sep 30 17:16:25 2021 +0200 --- lisp/org-element.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 1c971b2f8..ed684df17 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -1024,7 +1024,7 @@ Assume point is at beginning of the headline." (title-start (prog1 (point) (unless (or todo priority commentedp) ;; Headline like "* :tag:" - (skip-syntax-backward " \t")))) + (skip-chars-backward " \t")))) (tags (when (re-search-forward "[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$" (line-end-position) From 7de3d3cb3274f29e53bdeb9e6d0b2640614cf79a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Thu, 30 Sep 2021 17:13:12 +0200 Subject: [PATCH 4/5] Backport commit 2075411ed from Emacs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/org-element.el (org-element-citation-key-re): * lisp/ox-org.el (org-org-identity): Remove repeated chars in alternatives. * lisp/ob-java.el (org-babel-execute:java): Remove superfluous backslash. * lisp/ob-java.el (org-babel-java--main-re) (org-babel-java--any-method-re): Remove (0+ space) expressions subsumed by adjacent expressions. Fix regexp snags in org 2075411edbad954c0fdf2aa141757d834a6708b7 Mattias EngdegÄrd Thu Sep 30 17:16:41 2021 +0200 --- lisp/ob-java.el | 44 +++++++++++++++++++++++--------------------- lisp/org-element.el | 2 +- lisp/ox-org.el | 2 +- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/lisp/ob-java.el b/lisp/ob-java.el index 60ef33bc6..dd3538743 100644 --- a/lisp/ob-java.el +++ b/lisp/ob-java.el @@ -96,27 +96,29 @@ like javac -verbose." (group (1+ (in alnum ?_))) ; capture the class name (0+ space) ?{) "Regexp for the class declaration.") -(defconst org-babel-java--main-re (rx line-start (0+ space) "public" - (1+ space) "static" - (1+ space) "void" - (1+ space) "main" - (0+ space) ?\( - (0+ space) "String" - (0+ space) (1+ (in alnum ?_ ?\[ ?\] space)) ; "[] args" or "args[]" - (0+ space) ?\) - (0+ space) (opt "throws" (1+ (in alnum ?_ ?, ?. space))) - ?{) +(defconst org-babel-java--main-re + (rx line-start (0+ space) "public" + (1+ space) "static" + (1+ space) "void" + (1+ space) "main" + (0+ space) ?\( + (0+ space) "String" + (1+ (in alnum ?_ ?\[ ?\] space)) ; "[] args" or "args[]" + ?\) + (0+ space) (opt "throws" (1+ (in alnum ?_ ?, ?. space))) + ?{) "Regexp for the main method declaration.") -(defconst org-babel-java--any-method-re (rx line-start - (0+ space) (opt (seq (1+ alnum) (1+ space))) ; visibility - (opt (seq "static" (1+ space))) ; binding - (1+ (in alnum ?_ ?\[ ?\])) ; return type - (1+ space) (1+ (in alnum ?_)) ; method name - (0+ space) ?\( - (0+ space) (0+ (in alnum ?_ ?\[ ?\] ?, space)) ; params - (0+ space) ?\) - (0+ space) (opt "throws" (1+ (in alnum ?_ ?, ?. space))) - ?{) +(defconst org-babel-java--any-method-re + (rx line-start + (0+ space) (opt (seq (1+ alnum) (1+ space))) ; visibility + (opt (seq "static" (1+ space))) ; binding + (1+ (in alnum ?_ ?\[ ?\])) ; return type + (1+ space) (1+ (in alnum ?_)) ; method name + (0+ space) ?\( + (0+ (in alnum ?_ ?\[ ?\] ?, space)) ; params + ?\) + (0+ space) (opt "throws" (1+ (in alnum ?_ ?, ?. space))) + ?{) "Regexp for any method.") (defconst org-babel-java--result-wrapper "\n public static String __toString(Object val) { if (val instanceof String) { @@ -192,7 +194,7 @@ replaced in this string.") ;; the dir to write the source file (packagedir (if (and (not run-from-temp) packagename) (file-name-as-directory - (concat basedir (replace-regexp-in-string "\\\." "/" packagename))) + (concat basedir (replace-regexp-in-string "\\." "/" packagename))) basedir)) ;; the filename of the source file (src-file (concat packagedir classname ".java")) diff --git a/lisp/org-element.el b/lisp/org-element.el index ed684df17..f8334ccbc 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -118,7 +118,7 @@ ;; to current setup. (defconst org-element-citation-key-re - (rx "@" (group (one-or-more (any word "-.:?!`'/*@+|(){}<>&_^$#%&~")))) + (rx "@" (group (one-or-more (any word "-.:?!`'/*@+|(){}<>&_^$#%~")))) "Regexp matching a citation key. Key is located in match group 1.") diff --git a/lisp/ox-org.el b/lisp/ox-org.el index 11d9c09eb..fcf876854 100644 --- a/lisp/ox-org.el +++ b/lisp/ox-org.el @@ -141,7 +141,7 @@ CONTENTS and INFO are ignored." CONTENTS is its contents, as a string or nil. INFO is ignored." (let ((case-fold-search t)) (replace-regexp-in-string - "^[ \t]*#\\+attr_[-_a-za-z0-9]+:\\(?: .*\\)?\n" "" + "^[ \t]*#\\+attr_[-_a-z0-9]+:\\(?: .*\\)?\n" "" (org-export-expand blob contents t)))) (defun org-org-headline (headline contents info) From 8bc222bce6f8daa9758e27e04f6c5027a949843b Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 30 Sep 2021 21:27:41 -0400 Subject: [PATCH 5/5] org-src: Silence byte-compiler under 'make single' This warning shows up when compiling in the Emacs repo, too. --- lisp/org-src.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/org-src.el b/lisp/org-src.el index 0e16e236b..8d02cf434 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -38,6 +38,7 @@ (require 'org-keys) (declare-function org-mode "org" ()) +(declare-function org--get-expected-indentation "org" (element contentsp)) (declare-function org-element-at-point "org-element" ()) (declare-function org-element-class "org-element" (datum &optional parent)) (declare-function org-element-context "org-element" (&optional element))