]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't ignore errors in diff-syntax-fontify-hunk.
authorJuri Linkov <juri@linkov.net>
Wed, 7 May 2025 06:20:18 +0000 (09:20 +0300)
committerEshel Yaron <me@eshelyaron.com>
Sat, 10 May 2025 08:53:31 +0000 (10:53 +0200)
* lisp/nxml/nxml-mode.el (nxml-extend-region):
Protect against error "Invalid search bound (wrong side of point)".

* lisp/vc/diff-mode.el (diff-syntax-fontify-hunk):
Use 'with-demoted-errors' instead of 'ignore-errors'.

(cherry picked from commit ddc7bd547a2b422c4b8dca30076c0d9b70de09ad)

lisp/nxml/nxml-mode.el
lisp/vc/diff-mode.el

index 7acc19b90586f1edaddf71c5c299c55ce6ed98b8..1f2c7e81a09e0f36f152c72cda16e276890a7b81 100644 (file)
@@ -817,7 +817,8 @@ Called with `font-lock-beg' and `font-lock-end' dynamically bound."
            (skip-syntax-forward " ")
 
            ;; find the beginning of the previous tag
-           (when (not (equal (char-after) ?\<))
+           (when (and (not (equal (char-after) ?\<))
+                      (< nxml-prolog-end (point)))
              (search-backward "<" nxml-prolog-end t))
            (nxml-ensure-scan-up-to-date)
            (nxml-move-outside-backwards)
index e13825c473e3dcc4b148767340aedce9cd7133e9..194b0f5cb554e8d8191b74c5f7cabeef4c30947d 100644 (file)
@@ -3143,11 +3143,7 @@ When OLD is non-nil, highlight the hunk from the old source."
               ((memq diff-font-lock-syntax '(hunk-also hunk-only))
                (with-temp-buffer
                  (insert text)
-                 ;; Enabling a major mode on a single hunk without
-                 ;; sufficient context often raises many errors such as
-                 ;; "Premature end of data", "Invalid search bound", etc.
-                 ;; So need to ignore all these errors.
-                 (ignore-errors
+                 (with-demoted-errors "%S"
                    (diff-syntax-fontify-props file text line-nb t)))))))))
 
     ;; Put properties over the hunk text