[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#29767: 26.0.90; Failing auto-fill in message-mode because of bad sta
From: |
Stefan Monnier |
Subject: |
bug#29767: 26.0.90; Failing auto-fill in message-mode because of bad state (comment-skip-end) |
Date: |
Wed, 03 Jan 2018 23:59:39 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> Unfortunately, i cannot reproduce the bug reliably, but these are the
> symptoms:
I think I found the culprit: syntax-propertize relies incorrectly on
syntax-ppss to add syntax-ppss-flush-cache to before-change-functions.
This works fine as long as syntax-ppss is called, but in message-mode
buffers, syntax-propertize is always called but not syntax-ppss (it may
get called depending on the operations you perform, but it's not called
initially, e.g. because font-lock is told not to use the syntax-table to
highlight strings and comments).
The patch below seems to fix it for me. Is it OK to push it to emacs-26?
Stefan
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index a1b70b1869..a0493cc1ba 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -291,6 +291,9 @@ syntax-propertize
;; (message "Needs to syntax-propertize from %s to %s"
;; syntax-propertize--done pos)
(set (make-local-variable 'parse-sexp-lookup-properties) t)
+ (when (< syntax-propertize--done (point-min))
+ (add-hook 'before-change-functions
+ #'syntax-ppss-flush-cache t t))
(save-excursion
(with-silent-modifications
(make-local-variable 'syntax-propertize--done) ;Just in case!