diff options
| author | Eli Zaretskii | 2021-03-20 10:48:07 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2021-03-20 10:48:07 +0200 |
| commit | 729eae14eb648ad508b7963899d441c3e72fafea (patch) | |
| tree | 2ebd93aad6356254eaecb478b1bf6911e0bebf37 | |
| parent | 31544bc908d35bff513450bc4bea1d0283a7ddb0 (diff) | |
| download | emacs-729eae14eb648ad508b7963899d441c3e72fafea.tar.gz 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)
| -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." | |||
| 747 | 747 | ||
| 748 | (if (numberp val) ; add to ambient value if numeric | 748 | (if (numberp val) ; add to ambient value if numeric |
| 749 | (format-property-increment-region from to prop val 0) | 749 | (format-property-increment-region from to prop val 0) |
| 750 | (put-text-property | 750 | ;; Kludge alert: ignore items with reversed order of |
| 751 | from to prop | 751 | ;; FROM and TO. They seem to be redundant anyway, and |
| 752 | (cond ((get prop 'format-list-valued) ; value gets consed onto | 752 | ;; in one case I've seen them refer to EOB. |
| 753 | ; list-valued properties | 753 | (when (<= from to) |
| 754 | (let ((prev (get-text-property from prop))) | 754 | (put-text-property |
| 755 | (cons val (if (listp prev) prev (list prev))))) | 755 | from to prop |
| 756 | (t val))))) ; normally, just set to val. | 756 | (cond ((get prop 'format-list-valued) ; value gets consed onto |
| 757 | ; list-valued properties | ||
| 758 | (let ((prev (get-text-property from prop))) | ||
| 759 | (cons val (if (listp prev) prev (list prev))))) | ||
| 760 | (t val)))))) ; normally, just set to val. | ||
| 757 | (setq todo (cdr todo))) | 761 | (setq todo (cdr todo))) |
| 758 | 762 | ||
| 759 | (if unknown-ans | 763 | (if unknown-ans |