Sandy Berkovski <[email protected]> writes:

> Backtrace, captured with debug-on-message:
>
> Debugger entered--Lisp error: "Cannot syntax-propertize 3578..48519 because 
> of narrowing!"
> syntax-propertize(54205)
> internal--syntax-propertize(53830)
> scan-lists(53829 1 1)
> up-list-default-function(nil nil nil)
> up-list()
> TeX-find-macro-boundaries(48519)
> TeX-find-macro-start(48519)
> font-latex-extend-region-backwards-command-with-args()
> font-lock-default-fontify-region(53599 54205 nil)
> font-latex-fontify-region(53599 54205 nil)
> font-lock-fontify-region(53599 54205)
> #f(compiled-function (fun) #<bytecode 
> 0x1b7b847fc10a578f>)(font-lock-fontify-region)
> jit-lock--run-functions(53599 54205)
> jit-lock-fontify-now(53599 54205)
> jit-lock-function(53599)
> redisplay_internal (C function)

Thanks for this detailed and very good report.

> Reproduction from emacs -Q:
>
> emacs -Q, then M-x package-initialize, so only installed packages
> (including AUCTeX) activate.

FWIW, you can narrow this down even further with:

(progn
  (package-initialize t)
  (package-activate 'auctex))

> (setq debug-on-message "Cannot syntax-propertize [0-9]") Open a .tex
> file of roughly 50k characters or more. Split the frame into two
> windows on that buffer, top window showing the beginning of the file,
> bottom window showing the end.  Insert a character near the top of the
> file and wait a moment.

I can reproduce this, I took pgfplotstodo.tex.

> As far as I can tell the warning is harmless in itself, but it flashes
> repeatedly during normal editing. A fix that works for me is to make
> sure syntax properties cover the bound before narrowing, for instance
> a (syntax-propertize lower-bound) at the top of
> TeX-find-macro-boundaries.

So we're talking about a change like this, correct?

--8<---------------cut here---------------start------------->8---
diff --git a/tex.el b/tex.el
index 069b76c9..0e51206a 100644
--- a/tex.el
+++ b/tex.el
@@ -5827,6 +5827,9 @@ returns non-nil, then no further macro arguments are 
consumed."
   ;; environments including gathered similarly.
   (save-restriction
     (when lower-bound
+      ;; `syntax-propertize' can't widen so make sure it won't
+      ;; need to (Emacs bug#81718).
+      (syntax-propertize lower-bound)
       (narrow-to-region lower-bound (point-max)))
     (let ((orig-point (point))
           start-point)
--8<---------------cut here---------------end--------------->8---

We had a similar issue with texmathp.el, so I presume this will work for
you; it did for me with the test case above.

Best, Arash



_______________________________________________
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to