emacs-diffs
[Top][All Lists]
Advanced

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

master 729eae1: Fix args-out-of-range error in format.el


From: Eli Zaretskii
Subject: master 729eae1: Fix args-out-of-range error in format.el
Date: Sat, 20 Mar 2021 04:49:24 -0400 (EDT)

branch: master
commit 729eae14eb648ad508b7963899d441c3e72fafea
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix args-out-of-range error in format.el
    
    * lisp/format.el (format-deannotate-region): Ignore todo items
    with FROM > TO.  (Bug#47277)
---
 lisp/format.el | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/lisp/format.el b/lisp/format.el
index 4209fc6..3e2d92f 100644
--- a/lisp/format.el
+++ b/lisp/format.el
@@ -747,13 +747,17 @@ to write these unknown annotations back into the file."
 
            (if (numberp val)   ; add to ambient value if numeric
                (format-property-increment-region from to prop val 0)
-             (put-text-property
-              from to prop
-              (cond ((get prop 'format-list-valued) ; value gets consed onto
-                                                    ; list-valued properties
-                     (let ((prev (get-text-property from prop)))
-                       (cons val (if (listp prev) prev (list prev)))))
-                    (t val))))) ; normally, just set to val.
+              ;; Kludge alert: ignore items with reversed order of
+              ;; FROM and TO.  They seem to be redundant anyway, and
+              ;; in one case I've seen them refer to EOB.
+              (when (<= from to)
+               (put-text-property
+                from to prop
+                (cond ((get prop 'format-list-valued) ; value gets consed onto
+                                                      ; list-valued properties
+                       (let ((prev (get-text-property from prop)))
+                         (cons val (if (listp prev) prev (list prev)))))
+                      (t val)))))) ; normally, just set to val.
          (setq todo (cdr todo)))
 
        (if unknown-ans



reply via email to

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