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

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

[nongnu] elpa/annotate 4c3ba3a5da 331/372: - prevented calling 'annotate


From: ELPA Syncer
Subject: [nongnu] elpa/annotate 4c3ba3a5da 331/372: - prevented calling 'annotate--remove-annotation-property' on a narrowed buffer
Date: Fri, 4 Feb 2022 16:59:17 -0500 (EST)

branch: elpa/annotate
commit 4c3ba3a5da9b67a16c114822e7943ca873dbfe1c
Author: cage <cage@invalid>
Commit: cage <cage@invalid>

    - prevented calling 'annotate--remove-annotation-property' on a narrowed 
buffer
    
    For  some reason  (perhaps related  to font-locking?)   comment-region
    command  was calling  this  function,  the fact  is  that the  command
    narrows the  buffer before  actually adding comments,  so the  call to
    `point'  inside  the annotate--remove-annotation-property's  body  may
    fall  outside of  the buffer  raising  an error.  This patch  prevents
    calling this function on narrowed buffer.
---
 annotate.el | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/annotate.el b/annotate.el
index 4b9d932ed7..162e418b1a 100644
--- a/annotate.el
+++ b/annotate.el
@@ -1228,8 +1228,8 @@ a        a**
 
 (defun annotate--remove-annotation-property (begin end)
   "Cleans up annotation properties associated with a region."
-  (when (> (buffer-size)
-           0)
+  (when (and (> (buffer-size) 0)
+             (not (buffer-narrowed-p)))
     (annotate-with-inhibit-modification-hooks
      (annotate-with-disable-read-only
       ;; copy undo list
@@ -1242,8 +1242,7 @@ a        a**
           ;; annotated newline used to be
           (end-of-line)
           ;; strip dangling display property
-          (remove-text-properties
-           (point) (1+ (point)) '(display nil)))
+          (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]