Fix Emacs 26 compatibility

* lisp/oc-biblatex.el (org-cite-biblatex-export-citation): Do not use
`seq-first'.
* lisp/org-persist.el (org-persist-collection-let): Suppress warnings.
* lisp/ox-latex.el (org-latex-src--engrave-mathescape-p): Do not use
`if-let'.
(org-latex-src--engrave-code): Do not use `string-trim-right'.
* lisp/ox.el (org-export-link-localise): Add require for subr-x for
`thread-first'.
This commit is contained in:
Ihor Radchenko 2022-07-24 20:57:07 +08:00
parent d8133e80d8
commit 22de2e26e7
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
4 changed files with 9 additions and 9 deletions

View File

@ -363,7 +363,7 @@ INFO is the export state, as a property list."
(_ nil))))
(apply
#'org-cite-biblatex--command citation info
(pcase (seq-first candidates)
(pcase (seq-elt candidates 0) ;; `seq-first' is not available in Emacs 26.
(`(,_ ,_ . ,command-parameters) command-parameters)
('nil
(user-error

View File

@ -358,15 +358,14 @@ FORMAT and ARGS are passed to `message'."
"Bind container and associated from COLLECTION and execute BODY."
(declare (debug (form body)) (indent 1))
`(with-no-warnings
;; FIXME: We only need to suppress warnings about unused
;; let-bindings. However, it is unclear how to achieve it with
;; `with-suppressed-warnings'.
(let* ((container (plist-get ,collection :container))
(associated (plist-get ,collection :associated))
(path (plist-get associated :file))
(inode (plist-get associated :inode))
(hash (plist-get associated :hash))
(key (plist-get associated :key)))
;; Suppress "unused variable" warnings.
(ignore container associated path inode hash key)
,@body)))
(defun org-persist--find-index (collection)

View File

@ -3420,10 +3420,10 @@ and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
(equal '("false") (cdr opt)))
'no)))))
opts))))
(if-let ((mathescape (or (funcall mathescape-status default-options)
(funcall mathescape-status options))))
(when (eq mathescape 'yes)
(or engrave-faces-latex-mathescape t)))))
(let ((mathescape (or (funcall mathescape-status default-options)
(funcall mathescape-status options))))
(when (eq mathescape 'yes)
(or engrave-faces-latex-mathescape t)))))
(defun org-latex-src--engrave-code (content lang &optional theme options inline)
"Engrave CONTENT to LaTeX in a LANG-mode buffer, and give the result.
@ -3443,7 +3443,7 @@ to the Verbatim environment or Verb command."
engrave-faces-current-preset-style))
(engraved-buffer
(with-temp-buffer
(insert (string-trim-right content "\n"))
(insert (replace-regexp-in-string "\n\\'" "" content))
(when lang-mode
(if (functionp lang-mode)
(funcall lang-mode)

View File

@ -4520,6 +4520,7 @@ Return value can be an object or an element:
(org-persist-register location-type path
:write-immediately t))))
(require 'subr-x) ;; FIXME: For `thread-first' in Emacs 26.
(defun org-export-link-localise (link)
"Convert remote LINK to local link.
If LINK refers to a remote resource, modify it to point to a local