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

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

[nongnu] elpa/annotate 85b01244ad 3/5: - do not skip 'annotate--remove-a


From: ELPA Syncer
Subject: [nongnu] elpa/annotate 85b01244ad 3/5: - do not skip 'annotate--remove-annotation-property' for narrowed buffer.
Date: Sat, 10 Dec 2022 10:58:30 -0500 (EST)

branch: elpa/annotate
commit 85b01244adebd0ed0f2f3f7c552a0294c9c76484
Author: cage <cage@invalid>
Commit: cage <cage@invalid>

    - do not skip 'annotate--remove-annotation-property' for narrowed buffer.
    
      Previously  the   function  above  just  skipped   narrowed  buffer,
      effectively preventing delete of  annotation's text. This patch just
      prevent the  function to try  to move  the cursor beyond  the buffer
      limit that would leads to a crash.
    
      The  test  for  narrowed  buffer was  added  because  command  like:
      'comment-dwim' narrows the buffer beyond  the curtains, but my patch
      was too  radical, this  changes supposed to  fix annotation  of info
      files and does not interferes with 'comment-dwim'.
---
 annotate.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/annotate.el b/annotate.el
index 9aae8d481a..2c0154b639 100644
--- a/annotate.el
+++ b/annotate.el
@@ -1330,8 +1330,7 @@ a        a**"
   "Cleans up annotation properties associated within a region
 surrounded by `BEGIN' and `END'."
   (when (and annotate-mode
-             (> (buffer-size) 0)
-             (not (buffer-narrowed-p)))
+             (> (buffer-size) 0))
     (with-silent-modifications
       (annotate-with-disable-read-only
        ;; copy undo list
@@ -1344,7 +1343,9 @@ surrounded by `BEGIN' and `END'."
            ;; annotated newline used to be
            (end-of-line)
            ;; strip dangling display property
-           (remove-text-properties (point) (1+ (point)) '(display nil)))
+           (when (< (1+ (point))
+                    (point-max))
+             (remove-text-properties (point) (1+ (point)) '(display nil))))
          ;; restore undo list
          (setf buffer-undo-list saved-undo-list)
          (buffer-enable-undo))))))



reply via email to

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