(defvar c-doc-line-join-re)
(defvar c-doc-bright-comment-start-re)
(defvar c-doc-line-join-end-ch)
+(defvar c-syntax-table-hwm)
\f
;; Make declarations for all the `c-lang-defvar' variables in cc-langs.
;; higher than that position.
(setq c-lit-pos-cache-limit (min c-lit-pos-cache-limit pos)
c-semi-near-cache-limit (min c-semi-near-cache-limit pos)
- c-full-near-cache-limit (min c-full-near-cache-limit pos)))
+ c-full-near-cache-limit (min c-full-near-cache-limit pos))
+ (when (fboundp 'syntax-ppss)
+ ;; Also keep track of where we need to truncate `syntax-ppss''s cache to.
+ ;; Actually we shouldn't have to touch this thing (which we do not use),
+ ;; but its design forces us to. Hopefully this will be fixed in a future
+ ;; version of Emacs.
+ (setq c-syntax-table-hwm (min c-syntax-table-hwm pos))))
\f
;; A system for finding noteworthy parens before the point.
\f
;;; Change hooks, linking with Font Lock and electric-indent-mode.
+(defvar c-syntax-table-hwm most-positive-fixnum)
+;; A workaround for `syntax-ppss''s failure to take account of changes in
+;; syntax-table text properties. This variable gets set to the lowest
+;; position where the syntax-table text property is changed, and that value
+;; gets supplied to `syntax-ppss-flush-cache' just before a font locking is
+;; due to take place.
(defun c-called-from-text-property-change-p ()
;; Is the primitive which invoked `before-change-functions' or
;; (c-new-BEG c-new-END) will be the region to fontify.
(setq c-new-BEG beg c-new-END end)
(setq c-maybe-stale-found-type nil)
+ ;; A workaround for syntax-ppss's failure to notice syntax-table text
+ ;; property changes.
+ (when (fboundp 'syntax-ppss)
+ (setq c-syntax-table-hwm most-positive-fixnum))
(save-restriction
(save-match-data
(widen)
(save-excursion
(mapc (lambda (fn)
(funcall fn beg end old-len))
- c-before-font-lock-functions)))))))
+ c-before-font-lock-functions))))))
+ ;; A workaround for syntax-ppss's failure to notice syntax-table text
+ ;; property changes.
+ (when (fboundp 'syntax-ppss)
+ (syntax-ppss-flush-cache c-syntax-table-hwm)))
(defun c-doc-fl-decl-start (pos)
;; If the line containing POS is in a doc comment continued line (as defined