emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 0e5de0ff64 1/2: org-export-expand-include-keyword:


From: ELPA Syncer
Subject: [elpa] externals/org 0e5de0ff64 1/2: org-export-expand-include-keyword: Fix relative links in recursive includes
Date: Wed, 18 Jan 2023 03:58:07 -0500 (EST)

branch: externals/org
commit 0e5de0ff6476ac9ee95ccb0ded17540e7b22b5ff
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    org-export-expand-include-keyword: Fix relative links in recursive includes
    
    * lisp/ox.el (org-export-expand-include-keyword): Add new optional
    argument INCLUDER-FILE to explicitly pass the includer file path when
    expanding inside a temporary buffer.  Pass the INCLUDER-FILE later
    during recursive expansion.
    
    Reported-by: Gabriel Petrini da Silveira <gpetrinidasilveira@gmail.com>
    Link: 
https://orgmode.org/list/CAHCA-UvaqnegPYfpPcJCqiY8+dDoj0pfX0vDckUui-MCj3wq5A@mail.gmail.com
---
 lisp/ox.el | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index 07f7893618..b9c57321f6 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -3283,15 +3283,24 @@ locally for the subtree through node properties."
                   (downcase (car key))
                   (if (org-string-nw-p val) (format " %s" val) ""))))))))
 
-(defun org-export-expand-include-keyword (&optional included dir footnotes)
+(defun org-export-expand-include-keyword (&optional included dir footnotes 
includer-file)
   "Expand every include keyword in buffer.
+
 Optional argument INCLUDED is a list of included file names along
 with their line restriction, when appropriate.  It is used to
-avoid infinite recursion.  Optional argument DIR is the current
-working directory.  It is used to properly resolve relative
-paths.  Optional argument FOOTNOTES is a hash-table used for
-storing and resolving footnotes.  It is created automatically."
-  (let ((includer-file (buffer-file-name (buffer-base-buffer)))
+avoid infinite recursion.
+
+Optional argument DIR is the current working directory.  It is used to
+properly resolve relative paths.
+
+Optional argument FOOTNOTES is a hash-table used for
+storing and resolving footnotes.  It is created automatically.
+
+Optional argument INCLUDER-FILE is the file path corresponding to the
+buffer contents being included.  It is used when current buffer does
+not have `buffer-file-name' assigned."
+  (let ((includer-file (or includer-file
+                           (buffer-file-name (buffer-base-buffer))))
        (case-fold-search t)
        (file-prefix (make-hash-table :test #'equal))
        (current-prefix 0)
@@ -3422,7 +3431,7 @@ storing and resolving footnotes.  It is created 
automatically."
                      (cons (list file lines) included)
                       (unless (org-url-p file)
                         (file-name-directory file))
-                      footnotes)
+                      footnotes includer-file)
                     (buffer-string)))))
                ;; Expand footnotes after all files have been
                ;; included.  Footnotes are stored at end of buffer.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]