]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix tex-validate-buffer
authorMattias Engdegård <mattiase@acm.org>
Sun, 25 Jul 2021 11:04:43 +0000 (13:04 +0200)
committerMattias Engdegård <mattiase@acm.org>
Sun, 25 Jul 2021 14:41:46 +0000 (16:41 +0200)
* 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

index ababd775d5f115ce326e07b78e6f0a08de6341d0..d9d8059f9601f1cef95fef981647924b6e879ddf 100644 (file)
@@ -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))