From f4d04931b7a2f32dd24bd45307cf4efb050793af Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mattias=20Engdeg=C3=A5rd?= Date: Sun, 25 Jul 2021 13:04:43 +0200 Subject: [PATCH] Fix tex-validate-buffer * lisp/textmodes/tex-mode.el (tex-validate-buffer): Set `inhibit-read-only` around all modifications of the read-protected *Occur* buffer (bug#19326). Add the `occur-match` property, and adjust the extent of the `occur-target` property, so that next-error and previous-error work correctly (bug#39121). --- lisp/textmodes/tex-mode.el | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index ababd775d5f..d9d8059f960 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -1426,20 +1426,22 @@ on the line for the invalidity you want to see." ;; Skip "Mismatches:" header line. (forward-line 1) (setq num-matches (1+ num-matches)) - (insert-buffer-substring buffer start end) - (let ((text-end (point-marker)) - (inhibit-read-only t) - text-beg) - (forward-char (- start end)) - (setq text-beg (point-marker)) - (insert (format "%3d: " linenum)) - (add-text-properties - text-beg (- text-end 1) - '(mouse-face highlight - help-echo - "mouse-2: go to this invalidity")) - (put-text-property text-beg (- text-end 1) - 'occur-target tem)))))))) + (let ((inhibit-read-only t)) + (insert-buffer-substring buffer start end) + (let ((text-end (point-marker)) + text-beg) + (forward-char (- start end)) + (setq text-beg (point-marker)) + (insert (format "%3d: " linenum)) + (add-text-properties + text-beg (- text-end 1) + '(mouse-face highlight + help-echo + "mouse-2: go to this invalidity")) + (put-text-property (point) (- text-end 1) + 'occur-match t) + (put-text-property text-beg text-end + 'occur-target tem))))))))) (with-current-buffer standard-output (let ((no-matches (zerop num-matches)) (inhibit-read-only t)) -- 2.39.2