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

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

[elpa] externals/org 2ea0830f07 2/3: org-capture-kill: Fix capture bound


From: ELPA Syncer
Subject: [elpa] externals/org 2ea0830f07 2/3: org-capture-kill: Fix capture boundaries when deleting empty lines above
Date: Sun, 31 Jul 2022 01:57:50 -0400 (EDT)

branch: externals/org
commit 2ea0830f07fa81b6e22ccdd43ad351ad76fcc097
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org-capture-kill: Fix capture boundaries when deleting empty lines above
    
    * lisp/org-capture.el (org-capture-place-entry):
    (org-capture-place-item):
    (org-capture-place-table-line):
    (org-capture-place-plain-text): Store beginning of the capture region
    as marker.  This will make the ORIGIN move if
    `org-capture-empty-lines-before` has to add/remove lines.
    
    Fixes 
https://orgmode.org/list/CAGyCDkPos+W_MEJffSZga83NsOLZx2XGTYEmSGQuHQvS-sNa8A@mail.gmail.com
---
 lisp/org-capture.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 08c6b9becf..5780ecbeea 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1180,7 +1180,7 @@ may have been stored before."
         ;; Make sure that last point is not folded.
         (org-fold-core-cycle-over-indirect-buffers
           (org-fold-region (max 1 (1- (point-max))) (point-max) nil))))
-    (let ((origin (point)))
+    (let ((origin (point-marker)))
       (unless (bolp) (insert "\n"))
       (org-capture-empty-lines-before)
       (let ((beg (point)))
@@ -1245,7 +1245,7 @@ may have been stored before."
                                     (point))
                                   beg)))))))
     ;; Insert template.
-    (let ((origin (point)))
+    (let ((origin (point-marker)))
       (unless (bolp) (insert "\n"))
       ;; When a new list is created, always obey to `:empty-lines' and
       ;; friends.
@@ -1346,7 +1346,7 @@ may have been stored before."
       ;; No table found.  Create it with an empty header.
       (goto-char end)
       (unless (bolp) (insert "\n"))
-      (let ((origin (point)))
+      (let ((origin (point-marker)))
        (insert "|   |\n|---|\n")
        (narrow-to-region origin (point))))
     ;; In the current table, find the appropriate location for TEXT.
@@ -1375,7 +1375,7 @@ may have been stored before."
      (t
       (goto-char (org-table-end))))
     ;; Insert text and position point according to template.
-    (let ((origin (point)))
+    (let ((origin (point-marker)))
       (unless (bolp) (insert "\n"))
       (let ((beg (point))
            (end (save-excursion
@@ -1407,7 +1407,7 @@ Of course, if exact position has been required, just put 
it there."
    (t
     ;; Beginning or end of file.
     (goto-char (if (org-capture-get :prepend) (point-min) (point-max)))))
-  (let ((origin (point)))
+  (let ((origin (point-marker)))
     (unless (bolp) (insert "\n"))
     (org-capture-empty-lines-before)
     (org-capture-position-for-last-stored (point))



reply via email to

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