diff options
author | Eli Zaretskii <eliz@gnu.org> | 2021-03-20 10:48:07 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2021-03-20 10:48:07 +0200 |
commit | 729eae14eb648ad508b7963899d441c3e72fafea (patch) | |
tree | 2ebd93aad6356254eaecb478b1bf6911e0bebf37 /lisp/format.el | |
parent | 31544bc908d35bff513450bc4bea1d0283a7ddb0 (diff) | |
download | emacs-729eae14eb648ad508b7963899d441c3e72fafea.tar.gz emacs-729eae14eb648ad508b7963899d441c3e72fafea.tar.bz2 emacs-729eae14eb648ad508b7963899d441c3e72fafea.zip |
Fix args-out-of-range error in format.el
* lisp/format.el (format-deannotate-region): Ignore todo items
with FROM > TO. (Bug#47277)
Diffstat (limited to 'lisp/format.el')
-rw-r--r-- | lisp/format.el | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lisp/format.el b/lisp/format.el index 4209fc6401a..3e2d92fef13 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 |