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

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

[elpa] externals/org-transclusion fe298bb394 1/2: fix:Another Emacs remo


From: ELPA Syncer
Subject: [elpa] externals/org-transclusion fe298bb394 1/2: fix:Another Emacs remove-all leaves superfluous text prop after kill
Date: Wed, 29 Dec 2021 12:57:38 -0500 (EST)

branch: externals/org-transclusion
commit fe298bb3946dd5c108a22ae231f08678388dfb0c
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>

    fix:Another Emacs remove-all leaves superfluous text prop after kill
    
    Fix a very rare but destructive bug.
    
    Repro:
    1. Launch Emacs session
    2. Visit an Org file with transclusions
    3. `org-transcludion-add-all`
    4. Keep it open. Save to remove `buffer-modified-p` to return nil
    
    5. Launch a second Emacs session
    6. Visit the same Org file with transclusions
    7. `org-transcludion-add-all`
    8. While the transclusions are still on, kill the buffer or kill Emacs
    
    10. Back in the first Emacs session, observe that all the transclusions of 
the
    first session are now removed
    
    11. `org-transclusion-remove-all` again
    
    12. A large chunk of text disappears, especially when the last transclusion
    occupies a large region
    
    The last transclusion leaves the text properties only one point at end of 
the
    `#+transclude` line, keeping all the text properties from when the 
transclusion
    was on. With this one-point text properties, remove-all removes all the 
region
    that the transclusion used to be, removing a large chunk of 
non-transclusion text
    content.
    
    This was a problem especially when eshell session was used to generate
    documentation while it is being edited.
    
    Rare bug, probably only for the author of the package. High impact, 
nonetheless.
---
 org-transclusion.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/org-transclusion.el b/org-transclusion.el
index fbb932c04c..a0f351c0e7 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -751,7 +751,8 @@ turned off (removed)."
   ;; --, check is done for `buffer-file-name' to see if there is a file visited
   ;; by the buffer. If a "temp" buffer, there is no file being visited.
   (when (and (org-transclusion-remove-all)
-             (buffer-file-name))
+             (buffer-file-name)
+             (buffer-modified-p))
     (restore-buffer-modified-p t)
     (save-buffer)))
 



reply via email to

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