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

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

[elpa] externals/org d2a459d259: org-fold-check-before-invisible-edit: B


From: ELPA Syncer
Subject: [elpa] externals/org d2a459d259: org-fold-check-before-invisible-edit: Be smart about editing at border
Date: Wed, 4 May 2022 10:57:37 -0400 (EDT)

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

    org-fold-check-before-invisible-edit: Be smart about editing at border
    
    *
    lisp/org-fold.el (org-fold-check-before-invisible-edit--text-properties):
    Consider `border-and-ok-direction' value when deciding whether to
    throw an error and reveal the fold.  Never throw an error when editing
    at border without affecting the text inside.
    
    Fixes https://orgmode.org/list/m2ilqle995.fsf@gmail.com
---
 lisp/org-fold.el | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/lisp/org-fold.el b/lisp/org-fold.el
index 64492f6042..5085778dcd 100644
--- a/lisp/org-fold.el
+++ b/lisp/org-fold.el
@@ -1125,16 +1125,18 @@ The detailed reaction depends on the user option
             (and (not invisible-at-point) invisible-before-point
                  (memq kind '(insert delete))))))
       (when (or invisible-at-point invisible-before-point)
-       (when (eq org-fold-catch-invisible-edits 'error)
+       (when (and (eq org-fold-catch-invisible-edits 'error)
+                   (not border-and-ok-direction))
          (user-error "Editing in invisible areas is prohibited, make them 
visible first"))
        (if (and org-custom-properties-overlays
                 (y-or-n-p "Display invisible properties in this buffer? "))
            (org-toggle-custom-properties-visibility)
          ;; Make the area visible
-          (save-excursion
-           (org-fold-show-set-visibility 'local))
-          (when invisible-before-point
-            (org-with-point-at (1- (point)) (org-fold-show-set-visibility 
'local)))
+          (unless (eq org-fold-catch-invisible-edits 'error)
+            (save-excursion
+             (org-fold-show-set-visibility 'local))
+            (when invisible-before-point
+              (org-with-point-at (1- (point)) (org-fold-show-set-visibility 
'local))))
          (cond
           ((eq org-fold-catch-invisible-edits 'show)
            ;; That's it, we do the edit after showing
@@ -1144,6 +1146,9 @@ The detailed reaction depends on the user option
           ((and (eq org-fold-catch-invisible-edits 'smart)
                 border-and-ok-direction)
            (message "Unfolding invisible region around point before editing"))
+           (border-and-ok-direction
+            ;; Just continue editing.
+            nil)
           (t
            ;; Don't do the edit, make the user repeat it in full visibility
            (user-error "Edit in invisible region aborted, repeat to confirm 
with text visible"))))))))



reply via email to

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