From efa498b679653eb68f3a32e18020541ad4d17b04 Mon Sep 17 00:00:00 2001 From: Bastien Date: Thu, 30 Sep 2021 23:15:24 +0200 Subject: [PATCH 1/2] lisp/ob-julia.el: Backport modifications from Emacs b5e3cc3 * (org-babel-julia-initiate-session): Use `bound-and-true-p`. --- lisp/ob-julia.el | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/lisp/ob-julia.el b/lisp/ob-julia.el index ad90f0645..b44db4c24 100644 --- a/lisp/ob-julia.el +++ b/lisp/ob-julia.el @@ -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,8 +58,8 @@ :type 'string) (defvar ess-current-process-name) ; dynamically scoped -(defvar ess-local-process-name) ; dynamically scoped -(defvar ess-eval-visibly-p) ; 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 @@ -69,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)))) @@ -143,15 +143,15 @@ 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) "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)))) @@ -173,11 +173,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 - (not (cdr (assq :dir params)))))) + (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 @@ -191,14 +195,6 @@ end" (buffer-name)))) (current-buffer)))))) - ; (defun org-babel-julia-associate-session (session) - ; "Associate julia code buffer with a julia session. - ; Make SESSION be the inferior ESS process associated with the - ; current code buffer." - ; (setq ess-local-process-name - ; (process-name (get-buffer-process session))) - ; (ess-make-buffer-current)) - (defun org-babel-julia-graphical-output-file (params) "Name of file to which julia should send graphical output." (and (member "graphics" (cdr (assq :result-params params))) @@ -304,7 +300,7 @@ last statement in BODY, as elisp." column-names-p))) (output (mapconcat - 'org-babel-chomp + #'org-babel-chomp (butlast (delq nil (mapcar @@ -317,13 +313,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 f5b297292e20e31a4fbdecbdb834a7a9d0c5e249 Mon Sep 17 00:00:00 2001 From: Bastien Date: Thu, 30 Sep 2021 23:19:30 +0200 Subject: [PATCH 2/2] lisp/ox-koma-letter.el: Backport Emacs commit a5b761ec * lisp/org/ox-koma-letter.el: Remove redundant `:group` args. --- lisp/ox-koma-letter.el | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/lisp/ox-koma-letter.el b/lisp/ox-koma-letter.el index 70e996ab9..87ed9ed2d 100644 --- a/lisp/ox-koma-letter.el +++ b/lisp/ox-koma-letter.el @@ -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)