[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 2fecd96200 1/2: ox: Regain Emacs <28 compatibility
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 2fecd96200 1/2: ox: Regain Emacs <28 compatibility with #+include |
Date: |
Mon, 23 Jan 2023 10:57:56 -0500 (EST) |
branch: externals/org
commit 2fecd96200c84dfdee1113ae34ec2a1eeaf3471a
Author: TEC <git@tecosaur.net>
Commit: TEC <git@tecosaur.net>
ox: Regain Emacs <28 compatibility with #+include
* lisp/ox.el (org-export-expand-include-keyword): Replace the (pred (not
FUN)) `pcase' form introduced in Emacs 28 with a simple `cond' statement.
---
lisp/ox.el | 53 +++++++++++++++++++++++++++--------------------------
1 file changed, 27 insertions(+), 26 deletions(-)
diff --git a/lisp/ox.el b/lisp/ox.el
index 6fd72a2232..bb8de689a0 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -3323,34 +3323,35 @@ not have `buffer-file-name' assigned."
(beginning-of-line)
;; Extract arguments from keyword's value.
(let* ((value (org-element-property :value element))
- (parameters (org-export-parse-include-value value dir)))
+ (parameters (org-export-parse-include-value value dir))
+ (file (plist-get parameters :file)))
;; Remove keyword.
(delete-region (point) (line-beginning-position 2))
- (pcase (plist-get parameters :file)
- ((pred not) nil)
- ((and (pred (not org-url-p)) (pred (not file-readable-p)) f)
- (error "Cannot include file %s" f))
- ;; Check if files has already been parsed. Look after
- ;; inclusion lines too, as different parts of the same
- ;; file can be included too.
- ((and f (guard (member (list f (plist-get parameters :lines))
- included)))
- (error "Recursive file inclusion: %s" f))
- (_
- (org-export--blindly-expand-include
- parameters
- :includer-file includer-file
- :file-prefix file-prefix
- :footnotes footnotes
- :already-included included)
- ;; Expand footnotes after all files have been
- ;; included. Footnotes are stored at end of buffer.
- (unless included
- (org-with-wide-buffer
- (goto-char (point-max))
- (maphash (lambda (k v)
- (insert (format "\n[fn:%s] %s\n" k v)))
- footnotes))))))))))))
+ (cond
+ ((not file)) ; Do nothing.
+ ((and (not (org-url-p file))
+ (not (file-readable-p file)))
+ (error "Cannot include file %s" file))
+ ;; Check if files has already been parsed. Look after
+ ;; inclusion lines too, as different parts of the same
+ ;; file can be included too.
+ ((member (list file (plist-get parameters :lines)) included)
+ (error "Recursive file inclusion: %s" f))
+ (t
+ (org-export--blindly-expand-include
+ parameters
+ :includer-file includer-file
+ :file-prefix file-prefix
+ :footnotes footnotes
+ :already-included included)
+ ;; Expand footnotes after all files have been
+ ;; included. Footnotes are stored at end of buffer.
+ (unless included
+ (org-with-wide-buffer
+ (goto-char (point-max))
+ (maphash (lambda (k v)
+ (insert (format "\n[fn:%s] %s\n" k v)))
+ footnotes))))))))))))
(defun org-export-parse-include-value (value &optional dir)
"Extract the various parameters from #+include: VALUE.