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

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

[elpa] externals-release/org a52d0f0918 2/2: org-export-as: Fix subtree


From: ELPA Syncer
Subject: [elpa] externals-release/org a52d0f0918 2/2: org-export-as: Fix subtree export when metadata ends right before heading
Date: Thu, 12 Jan 2023 04:58:02 -0500 (EST)

branch: externals-release/org
commit a52d0f09181d8d21170717c3ad5e4a4b3908b22e
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    org-export-as: Fix subtree export when metadata ends right before heading
    
    * lisp/ox.el (org-export-as): Only include first newline after heading
    line when the metadata is non-empty.
    * testing/lisp/test-ox.el (test-org-export/export-scope): Add test.
    
    Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
    Link: 
https://orgmode.org/list/CAFyQvY1d=UEJ-6ZPG1X+st=fCfBAnTfgbVNhxyxH_xKcLGG4cQ@mail.gmail.com
---
 lisp/ox.el              |  2 +-
 testing/lisp/test-ox.el | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index 12767267a7..a5f2249cad 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -3040,7 +3040,7 @@ Return code as a string."
                ;; This way, we will be able to retrieve its export
                ;; options when calling
                ;; `org-export--get-subtree-options'.
-               (backward-char)
+               (when (bolp) (backward-char))
               (narrow-to-region (point) (point-max))))
         ;; Initialize communication channel with original buffer
         ;; attributes, unavailable in its copy.
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index cdb549df4b..99f5c0f0f7 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -1113,6 +1113,16 @@ Text"
            (org-export-as (org-test-default-backend)
                           'subtree nil nil
                           '(:with-planning t :with-properties t)))))
+  (should
+   (equal ""
+         (org-test-with-temp-text "
+* H
+:PROPERTIES:
+:A: 1
+:END:<point>
+* H2"
+           (org-export-as (org-test-default-backend)
+                          'subtree))))
   ;; Visible.
   (should
    (equal "* H1\n"



reply via email to

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