mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-21 06:55:39 +00:00
lisp/org: Backport org-mode.git fix for if-let/when-let obsolescence
Backporting this acked by Org maintainer Ihor Radchenko. * lisp/org/ob-R.el (org-babel-R-associate-session): * lisp/org/ob-clojure.el (ob-clojure-nbb-command) (ob-clojure-cli-command): * lisp/org/ob-core.el (org-babel-execute-src-block): * lisp/org/ob-exp.el (org-babel-exp-code): * lisp/org/ob-julia.el (org-babel-julia-associate-session): * lisp/org/ob-python.el (org-babel-python--python-util-comint-end-of-output-p): * lisp/org/ol.el (org-insert-link): * lisp/org/org-attach.el (org-attach): * lisp/org/org-clock.el (org-clock-select-task): * lisp/org/org-compat.el (fboundp): * lisp/org/org-element-ast.el (org-element-property-raw) (org-element-put-property, org-element-copy): * lisp/org/org-element.el (org-element-timestamp-interpreter) (org-element--cache-key): * lisp/org/org-goto.el (org-goto-location): * lisp/org/org-lint.el (org-lint-suspicious-language-in-src-block) (org-lint-export-option-keywords): * lisp/org/org-macs.el (org-mks): * lisp/org/org-persist.el: (org-persist-write:elisp): * lisp/org/org-table.el (org-table-fedit-finish): * lisp/org/org.el (org-entry-get-with-inheritance): * lisp/org/ox-html.el (org-html--reference) (org-html--build-mathjax-config, org-html-example-block): * lisp/org/ox-latex.el (org-latex-table-row): * lisp/org/ox.el (org-export--prune-tree) (org-export--blindly-expand-include): Replace use of if-let and when-let, obsolete in Emacs 31.0.50.
This commit is contained in:
parent
2030b8c7f2
commit
d354300993
@ -288,7 +288,7 @@ Use PARAMS to set default directory when creating a new session."
|
||||
"Associate R code buffer with an R session.
|
||||
Make SESSION be the inferior ESS process associated with the
|
||||
current code buffer."
|
||||
(when-let ((process (get-buffer-process session)))
|
||||
(when-let* ((process (get-buffer-process session)))
|
||||
(setq ess-local-process-name (process-name process))
|
||||
(ess-make-buffer-current))
|
||||
(setq-local ess-gen-proc-buffer-name-function (lambda (_) session)))
|
||||
|
@ -120,14 +120,14 @@
|
||||
:package-version '(Org . "9.6"))
|
||||
|
||||
(defcustom ob-clojure-nbb-command (or (executable-find "nbb")
|
||||
(when-let (npx (executable-find "npx"))
|
||||
(when-let* ((npx (executable-find "npx")))
|
||||
(concat npx " nbb")))
|
||||
"Nbb command used by the ClojureScript `nbb' backend."
|
||||
:type '(choice string (const nil))
|
||||
:group 'org-babel
|
||||
:package-version '(Org . "9.7"))
|
||||
|
||||
(defcustom ob-clojure-cli-command (when-let (cmd (executable-find "clojure"))
|
||||
(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 '(choice string (const nil))
|
||||
|
@ -870,7 +870,7 @@ guess will be made."
|
||||
(default-directory
|
||||
(cond
|
||||
((not dir) default-directory)
|
||||
((when-let ((session (org-babel-session-buffer info)))
|
||||
((when-let* ((session (org-babel-session-buffer info)))
|
||||
(buffer-local-value 'default-directory (get-buffer session))))
|
||||
((member mkdirp '("no" "nil" nil))
|
||||
(file-name-as-directory (expand-file-name dir)))
|
||||
|
@ -441,7 +441,7 @@ replaced with its value."
|
||||
("header-args"
|
||||
.
|
||||
,(org-babel-exp--at-source
|
||||
(when-let ((params (org-element-property :parameters (org-element-context))))
|
||||
(when-let* ((params (org-element-property :parameters (org-element-context))))
|
||||
(concat " " params))))
|
||||
,@(mapcar (lambda (pair)
|
||||
(cons (substring (symbol-name (car pair)) 1)
|
||||
|
@ -75,7 +75,7 @@
|
||||
"Associate R code buffer with an R session.
|
||||
Make SESSION be the inferior ESS process associated with the
|
||||
current code buffer."
|
||||
(when-let ((process (get-buffer-process session)))
|
||||
(when-let* ((process (get-buffer-process session)))
|
||||
(setq ess-local-process-name (process-name process))
|
||||
(ess-make-buffer-current))
|
||||
(setq-local ess-gen-proc-buffer-name-function (lambda (_) session)))
|
||||
|
@ -269,7 +269,7 @@ results as a string."
|
||||
"Return non-nil if the last prompt matches input prompt.
|
||||
Backport of `python-util-comint-end-of-output-p' to emacs28. To
|
||||
be removed after minimum supported version reaches emacs29."
|
||||
(when-let ((prompt (python-util-comint-last-prompt)))
|
||||
(when-let* ((prompt (python-util-comint-last-prompt)))
|
||||
(python-shell-comint-end-of-output-p
|
||||
(buffer-substring-no-properties
|
||||
(car prompt) (cdr prompt)))))
|
||||
|
@ -2028,7 +2028,7 @@ non-interactively, don't allow editing the default description."
|
||||
(setq link (substring link 0 -1))))
|
||||
(setq link (with-current-buffer origbuf
|
||||
(org-link--try-special-completion link)))))
|
||||
(when-let ((window (get-buffer-window "*Org Links*" t)))
|
||||
(when-let* ((window (get-buffer-window "*Org Links*" t)))
|
||||
(quit-window 'kill window))
|
||||
(set-window-configuration wcf)
|
||||
(when (get-buffer "*Org Links*")
|
||||
|
@ -357,7 +357,7 @@ Shows a list of commands and prompts for another key to execute a command."
|
||||
(while (and (setq c (read-char-exclusive))
|
||||
(memq c '(?\C-n ?\C-p ?\C-v ?\M-v)))
|
||||
(org-scroll c t)))
|
||||
(when-let ((window (get-buffer-window "*Org Attach*" t)))
|
||||
(when-let* ((window (get-buffer-window "*Org Attach*" t)))
|
||||
(quit-window 'kill window))
|
||||
(and (get-buffer "*Org Attach*") (kill-buffer "*Org Attach*")))))
|
||||
(let ((command (cl-some (lambda (entry)
|
||||
|
@ -698,7 +698,7 @@ there is no recent clock to choose from."
|
||||
(fit-window-to-buffer nil nil (if (< chl 10) chl (+ 5 chl)))
|
||||
(message (or prompt "Select task for clocking:"))
|
||||
(unwind-protect (setq cursor-type nil rpl (read-char-exclusive))
|
||||
(when-let ((window (get-buffer-window "*Clock Task Select*" t)))
|
||||
(when-let* ((window (get-buffer-window "*Clock Task Select*" t)))
|
||||
(quit-window 'kill window))
|
||||
(when (get-buffer "*Clock Task Select*")
|
||||
(kill-buffer "*Clock Task Select*")))
|
||||
|
@ -115,7 +115,7 @@ This is an action function for buffer display, see Info
|
||||
node `(elisp) Buffer Display Action Functions'. It should be
|
||||
called only by `display-buffer' or a function directly or
|
||||
indirectly called by the latter."
|
||||
(when-let ((window (or (display-buffer-reuse-window buffer alist)
|
||||
(when-let* ((window (or (display-buffer-reuse-window buffer alist)
|
||||
(display-buffer-same-window buffer alist)
|
||||
(display-buffer-pop-up-window buffer alist)
|
||||
(display-buffer-use-some-window buffer alist))))
|
||||
|
@ -410,7 +410,7 @@ If PROPERTY is not present, return DFLT."
|
||||
(let ((idx (org-element--property-idx (inline-const-val property))))
|
||||
(inline-quote
|
||||
(let ((idx (or ,idx (org-element--property-idx ,property))))
|
||||
(if-let ((parray (and idx (org-element--parray ,node))))
|
||||
(if-let* ((parray (and idx (org-element--parray ,node))))
|
||||
(pcase (aref parray idx)
|
||||
(`org-element-ast--nil ,dflt)
|
||||
(val val))
|
||||
@ -456,7 +456,7 @@ Return modified NODE."
|
||||
(inline-quote
|
||||
(let ((idx (org-element--property-idx ,property)))
|
||||
(if (and idx (not (org-element-type-p ,node 'plain-text)))
|
||||
(when-let
|
||||
(when-let*
|
||||
((parray
|
||||
(or (org-element--parray ,node)
|
||||
(org-element--put-parray ,node))))
|
||||
@ -796,7 +796,7 @@ When DATUM is `plain-text', all the properties are removed."
|
||||
(type
|
||||
(let ((node-copy (append (list type (copy-sequence (cadr datum))) (copy-sequence (cddr datum)))))
|
||||
;; Copy `:standard-properties'
|
||||
(when-let ((parray (org-element-property-raw :standard-properties node-copy)))
|
||||
(when-let* ((parray (org-element-property-raw :standard-properties node-copy)))
|
||||
(org-element-put-property node-copy :standard-properties (copy-sequence parray)))
|
||||
;; Clear `:parent'.
|
||||
(org-element-put-property node-copy :parent nil)
|
||||
@ -810,7 +810,7 @@ When DATUM is `plain-text', all the properties are removed."
|
||||
;; properties. So, we need to reassign inner `:parent'
|
||||
;; properties to the DATUM copy explicitly.
|
||||
(dolist (secondary-prop (org-element-property :secondary node-copy))
|
||||
(when-let ((secondary-value (org-element-property secondary-prop node-copy)))
|
||||
(when-let* ((secondary-value (org-element-property secondary-prop node-copy)))
|
||||
(setq secondary-value (org-element-copy secondary-value t))
|
||||
(if (org-element-type secondary-value)
|
||||
(org-element-put-property secondary-value :parent node-copy)
|
||||
|
@ -4455,7 +4455,7 @@ Assume point is at the beginning of the timestamp."
|
||||
(and val (number-to-string val)))
|
||||
(pcase (org-element-property :repeater-unit timestamp)
|
||||
(`hour "h") (`day "d") (`week "w") (`month "m") (`year "y"))
|
||||
(when-let ((repeater-deadline-value
|
||||
(when-let* ((repeater-deadline-value
|
||||
(org-element-property :repeater-deadline-value timestamp))
|
||||
(repeater-deadline-unit
|
||||
(org-element-property :repeater-deadline-unit timestamp)))
|
||||
@ -6012,7 +6012,7 @@ cache during the synchronization get a new key generated with
|
||||
Such keys are stored inside the element property
|
||||
`:org-element--cache-sync-key'. The property is a cons containing
|
||||
current `org-element--cache-sync-keys-value' and the element key."
|
||||
(or (when-let ((key-cons (org-element-property :org-element--cache-sync-key element)))
|
||||
(or (when-let* ((key-cons (org-element-property :org-element--cache-sync-key element)))
|
||||
(when (eq org-element--cache-sync-keys-value (car key-cons))
|
||||
(cdr key-cons)))
|
||||
(let* ((begin (org-element-begin element))
|
||||
|
@ -241,7 +241,7 @@ position or nil."
|
||||
(message "Select location and press RET")
|
||||
(use-local-map org-goto-map)
|
||||
(unwind-protect (recursive-edit)
|
||||
(when-let ((window (get-buffer-window "*Org Help*" t)))
|
||||
(when-let* ((window (get-buffer-window "*Org Help*" t)))
|
||||
(quit-window 'kill window)))))
|
||||
(when (get-buffer "*org-goto*") (kill-buffer "*org-goto*"))
|
||||
(cons org-goto-selected-point org-goto-exit-command)))
|
||||
|
@ -551,7 +551,7 @@ Use :header-args: instead"
|
||||
(defun org-lint-suspicious-language-in-src-block (ast)
|
||||
(org-element-map ast 'src-block
|
||||
(lambda (b)
|
||||
(when-let ((lang (org-element-property :language b)))
|
||||
(when-let* ((lang (org-element-property :language b)))
|
||||
(unless (or (functionp (intern (format "org-babel-execute:%s" lang)))
|
||||
;; No babel backend, but there is corresponding
|
||||
;; major mode.
|
||||
@ -859,7 +859,7 @@ Use \"export %s\" instead"
|
||||
(when (member prop common-options)
|
||||
"global ")
|
||||
prop
|
||||
(if-let ((backends
|
||||
(if-let* ((backends
|
||||
(and (not (member prop common-options))
|
||||
(cdr (assoc-string prop options-alist)))))
|
||||
(format
|
||||
|
@ -573,7 +573,7 @@ is selected, only the bare key is returned."
|
||||
((assoc current specials) (throw 'exit current))
|
||||
(t (error "No entry available")))))))
|
||||
(when buffer
|
||||
(when-let ((window (get-buffer-window buffer t)))
|
||||
(when-let* ((window (get-buffer-window buffer t)))
|
||||
(quit-window 'kill window))
|
||||
(kill-buffer buffer))))))
|
||||
|
||||
|
@ -810,7 +810,7 @@ COLLECTION is the plist holding data collection."
|
||||
(let ((scope (nth 2 container)))
|
||||
(pcase scope
|
||||
((pred stringp)
|
||||
(when-let ((buf (or (get-buffer scope)
|
||||
(when-let* ((buf (or (get-buffer scope)
|
||||
(get-file-buffer scope))))
|
||||
;; FIXME: There is `buffer-local-boundp' introduced in Emacs 28.
|
||||
;; Not using it yet to keep backward compatibility.
|
||||
@ -821,7 +821,7 @@ COLLECTION is the plist holding data collection."
|
||||
(when (boundp (cadr container))
|
||||
(symbol-value (cadr container))))
|
||||
(`nil
|
||||
(if-let ((buf (and (plist-get (plist-get collection :associated) :file)
|
||||
(if-let* ((buf (and (plist-get (plist-get collection :associated) :file)
|
||||
(get-file-buffer (plist-get (plist-get collection :associated) :file)))))
|
||||
;; FIXME: There is `buffer-local-boundp' introduced in Emacs 28.
|
||||
;; Not using it yet to keep backward compatibility.
|
||||
|
@ -3709,7 +3709,7 @@ With prefix ARG, apply the new formulas to the table."
|
||||
(org-table-store-formulas eql)
|
||||
(set-marker pos nil)
|
||||
(set-marker source nil)
|
||||
(when-let ((window (get-buffer-window "*Edit Formulas*" t)))
|
||||
(when-let* ((window (get-buffer-window "*Edit Formulas*" t)))
|
||||
(quit-window 'kill window))
|
||||
(when (get-buffer "*Edit Formulas*") (kill-buffer "*Edit Formulas*"))
|
||||
(if arg
|
||||
|
@ -13219,7 +13219,7 @@ However, if LITERAL-NIL is set, return the string value \"nil\" instead."
|
||||
;; Consider global properties, if we found no PROPERTY (or maybe
|
||||
;; only PROPERTY+).
|
||||
(unless found-inherited?
|
||||
(when-let ((global (org--property-global-or-keyword-value
|
||||
(when-let* ((global (org--property-global-or-keyword-value
|
||||
property t)))
|
||||
(setq values (cons global values))))
|
||||
(when values
|
||||
|
@ -1732,7 +1732,7 @@ targets and targets."
|
||||
(and (memq type '(radio-target target))
|
||||
(org-element-property :value datum))
|
||||
(org-element-property :name datum)
|
||||
(when-let ((id (org-element-property :ID datum)))
|
||||
(when-let* ((id (org-element-property :ID datum)))
|
||||
(concat org-html--id-attr-prefix id)))))
|
||||
|
||||
(cond
|
||||
@ -2052,7 +2052,7 @@ INFO is a plist used as a communication channel."
|
||||
(when value
|
||||
(pcase symbol
|
||||
(`font
|
||||
(when-let
|
||||
(when-let*
|
||||
((value-new
|
||||
(pcase value
|
||||
("TeX" "mathjax-tex")
|
||||
@ -2697,7 +2697,7 @@ information."
|
||||
(let ((attributes (org-export-read-attribute :attr_html example-block)))
|
||||
(if (plist-get attributes :textarea)
|
||||
(org-html--textarea-block example-block)
|
||||
(if-let ((class-val (plist-get attributes :class)))
|
||||
(if-let* ((class-val (plist-get attributes :class)))
|
||||
(setq attributes (plist-put attributes :class (concat "example " class-val)))
|
||||
(setq attributes (plist-put attributes :class "example")))
|
||||
(format "<pre%s>\n%s</pre>"
|
||||
|
@ -4097,7 +4097,7 @@ a communication channel."
|
||||
(unless (hash-table-p table-head-cache)
|
||||
(setq table-head-cache (make-hash-table :test #'eq))
|
||||
(plist-put info :org-latex-table-head-cache table-head-cache))
|
||||
(if-let ((head-contents (gethash (org-element-parent table-row) table-head-cache)))
|
||||
(if-let* ((head-contents (gethash (org-element-parent table-row) table-head-cache)))
|
||||
(puthash (org-element-parent table-row) (concat head-contents "\\\\\n" contents)
|
||||
table-head-cache)
|
||||
(puthash (org-element-parent table-row) contents table-head-cache))))
|
||||
|
@ -2672,7 +2672,7 @@ from tree."
|
||||
(let ((type (org-element-type data)))
|
||||
(if (org-export--skip-p data info selected excluded)
|
||||
(if (memq type '(table-cell table-row)) (push data ignore)
|
||||
(if-let ((keep-spaces (org-export--keep-spaces data info)))
|
||||
(if-let* ((keep-spaces (org-export--keep-spaces data info)))
|
||||
;; Keep spaces in place of removed
|
||||
;; element, if necessary.
|
||||
;; Example: "Foo.[10%] Bar" would become
|
||||
@ -3456,7 +3456,7 @@ file."
|
||||
(with-temp-buffer
|
||||
(let ((org-inhibit-startup t)
|
||||
(lines
|
||||
(if-let ((location (plist-get parameters :location)))
|
||||
(if-let* ((location (plist-get parameters :location)))
|
||||
(org-export--inclusion-absolute-lines
|
||||
file location
|
||||
(plist-get parameters :only-contents)
|
||||
|
Loading…
Reference in New Issue
Block a user