Hi,

I hit a minor bug with the function org-narrow-to-subtree.

When I narrow to a headline (subtree with just the headline) present
at the end of a file, the last character of the headline isn't present
in the narrowed region. [file1.org and file2.org shown at the end of
the message are examples]

I am attaching a possible patch for the same, but I don't think that
is the "cleanest" way to handle it. Hope it'll help some one else to
fix it in a better way.

Thanks,
Puneeth

file1.org
-----------------
* Hello
* World
* TestEOF
-----------------

file2.org
------------------
* Test
*** World
*** Hello 1EOF
------------------
diff --git a/lisp/org.el b/lisp/org.el
index 59caf41..06b9f9e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7501,7 +7501,7 @@ If yes, remember the marker and the distance to BEG."
       (narrow-to-region
        (progn (org-back-to-heading t) (point))
        (progn (org-end-of-subtree t t)
-             (if (org-on-heading-p) (backward-char 1))
+             (if (and (org-on-heading-p) (org-at-regexp-p "*")) (backward-char 
1))
              (point))))))
 
 (eval-when-compile
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to