emacs-orgmode
[Top][All Lists]
Advanced

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

[PATCH] Fix org-narrow-to-subtree smaller than subtree


From: Kevin Liu
Subject: [PATCH] Fix org-narrow-to-subtree smaller than subtree
Date: Sat, 30 May 2020 06:29:47 -0700
User-agent: mu4e 1.5.1; emacs 27.0.91

I noticed that when I narrow to a subtree and then hit org-mark-element,
I can’t kill the text because the narrow is actually 1 char smaller.
This seemed like an unpleasant workaround, and I think the behavior can
be changed without any real negative consequences.

>From 61260469a9ad37ad4011cc489dc4372b02491b4d Mon Sep 17 00:00:00 2001
From: nivekuil <mail@nivekuil.com>
Date: Tue, 26 May 2020 23:17:43 -0700
Subject: [PATCH] Narrow to whole subtree instead of 1 char less

---
 lisp/org.el                       | 1 -
 testing/lisp/test-org-datetree.el | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 0808fc210..e9771512d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7749,7 +7749,6 @@ 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)
-              (when (and (org-at-heading-p) (not (eobp))) (backward-char 1))
               (point)))))))
 
 (defun org-toggle-narrow-to-subtree ()
diff --git a/testing/lisp/test-org-datetree.el 
b/testing/lisp/test-org-datetree.el
index 5557d5e23..f7247766a 100644
--- a/testing/lisp/test-org-datetree.el
+++ b/testing/lisp/test-org-datetree.el
@@ -58,7 +58,7 @@
   ;; Sort new entry in right place.
   (should
    (string-match
-    "\\`\\* 2012\n\\*\\* 2012-02 .*\n\\*\\*\\* 2012-02-01 .*\n\n\\*\\* 2012-03 
.*\n\\*\\*\\* 2012-03-29 .*\\'"
+    "\\`\\* 2012\n\\*\\* 2012-02 .*\n\\*\\*\\* 2012-02-01 .*\n\\*\\* 2012-03 
.*\n\\*\\*\\* 2012-03-29 .*\\'"
     (org-test-with-temp-text "* 2012\n** 2012-03 month\n*** 2012-03-29 day"
       (let ((org-datetree-add-timestamp nil))
        (org-datetree-find-date-create '(3 29 2012))
@@ -161,7 +161,7 @@
   ;; Sort new entry in right place.
   (should
    (string-match
-    "\\`\\* 2015\n\\*\\* 2015-W01\n\\*\\*\\* 2014-12-31 .*\n\n\\*\\* 
2015-W36\n\\*\\*\\* 2015-09-01 .*\\'"
+    "\\`\\* 2015\n\\*\\* 2015-W01\n\\*\\*\\* 2014-12-31 .*\n\\*\\* 
2015-W36\n\\*\\*\\* 2015-09-01 .*\\'"
     (org-test-with-temp-text "* 2015"
       (let ((org-datetree-add-timestamp nil))
        (org-datetree-find-iso-week-create '(9 1 2015))
-- 
2.26.2


reply via email to

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