summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-mode.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2019-06-26 10:24:59 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2019-06-26 10:24:59 -0400
commit0b4e003766f15225dede9bdba4ead33e493856e2 (patch)
tree99de57fe8feeca540f398acb232b75e9c802418c /lisp/progmodes/cc-mode.el
parent699fce296b13d7db386b1cb5cecf2710e5196691 (diff)
downloademacs-0b4e003766f15225dede9bdba4ead33e493856e2.tar.gz
emacs-0b4e003766f15225dede9bdba4ead33e493856e2.tar.bz2
emacs-0b4e003766f15225dede9bdba4ead33e493856e2.zip
Revert "* lisp/calc/calc-ext.el (math-scalarp): Fix typo"
This reverts commit 698ff554ac2699ec48fefc85a1307cbc4a183b0d.
Diffstat (limited to 'lisp/progmodes/cc-mode.el')
-rw-r--r--lisp/progmodes/cc-mode.el59
1 files changed, 20 insertions, 39 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 8d6cce690d1..5c18879712c 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -525,8 +525,6 @@ preferably use the `c-mode-menu' language constant directly."
;; and `after-change-functions'. Note that this variable is not set when
;; `c-before-change' is invoked by a change to text properties.
-(defvar c--use-syntax-propertize t)
-
(defun c-basic-common-init (mode default-style)
"Do the necessary initialization for the syntax handling routines
and the line breaking/filling code. Intended to be used by other
@@ -671,20 +669,15 @@ that requires a literal mode spec at compile time."
;; Install the functions that ensure that various internal caches
;; don't become invalid due to buffer changes.
- (if c--use-syntax-propertize
- (setq-local syntax-propertize-function
- (lambda (start end)
- (c-before-change start (point-max))
- (c-after-change start end (- end start))))
- (when (featurep 'xemacs)
- (make-local-hook 'before-change-functions)
- (make-local-hook 'after-change-functions))
- (add-hook 'before-change-functions 'c-before-change nil t)
- (setq c-just-done-before-change nil)
- ;; FIXME: We should use the new `depth' arg in Emacs-27 (e.g. a depth of -10
- ;; would do since font-lock uses a(n implicit) depth of 0) so we don't need
- ;; c-after-font-lock-init.
- (add-hook 'after-change-functions 'c-after-change nil t))
+ (when (featurep 'xemacs)
+ (make-local-hook 'before-change-functions)
+ (make-local-hook 'after-change-functions))
+ (add-hook 'before-change-functions 'c-before-change nil t)
+ (setq c-just-done-before-change nil)
+ ;; FIXME: We should use the new `depth' arg in Emacs-27 (e.g. a depth of -10
+ ;; would do since font-lock uses a(n implicit) depth of 0) so we don't need
+ ;; c-after-font-lock-init.
+ (add-hook 'after-change-functions 'c-after-change nil t)
(when (boundp 'font-lock-extend-after-change-region-function)
(set (make-local-variable 'font-lock-extend-after-change-region-function)
'c-extend-after-change-region))) ; Currently (2009-05) used by all
@@ -742,17 +735,15 @@ compatible with old code; callers should always specify it."
(widen)
(setq c-new-BEG (point-min))
(setq c-new-END (point-max))
- (unless c--use-syntax-propertize
- (save-excursion
- (let (before-change-functions after-change-functions)
- (mapc (lambda (fn)
- (funcall fn (point-min) (point-max)))
- c-get-state-before-change-functions)
- (mapc (lambda (fn)
- (funcall fn (point-min) (point-max)
- (- (point-max) (point-min))))
- c-before-font-lock-functions)
- ))))
+ (save-excursion
+ (let (before-change-functions after-change-functions)
+ (mapc (lambda (fn)
+ (funcall fn (point-min) (point-max)))
+ c-get-state-before-change-functions)
+ (mapc (lambda (fn)
+ (funcall fn (point-min) (point-max)
+ (- (point-max) (point-min))))
+ c-before-font-lock-functions))))
(set (make-local-variable 'outline-regexp) "[^#\n\^M]")
(set (make-local-variable 'outline-level) 'c-outline-level)
@@ -2059,12 +2050,6 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".")
;;
;; Type a space in the first blank line, and the fontification of the next
;; line was fouled up by context fontification.
- (when c--use-syntax-propertize
- ;; This should also update c-new-END and c-new-BEG.
- (syntax-propertize end)
- ;; FIXME: Apparently `c-new-END' may be left unchanged to a stale value,
- ;; presumably when the buffer gets truncated.
- (if (> c-new-END (point-max)) (setq c-new-END (point-max))))
(let (new-beg new-end new-region case-fold-search)
(if (and c-in-after-change-fontification
(< beg c-new-END) (> end c-new-BEG))
@@ -2103,8 +2088,7 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".")
(defun c-after-font-lock-init ()
;; Put on `font-lock-mode-hook'. This function ensures our after-change
;; function will get executed before the font-lock one.
- (when (and c--use-syntax-propertize
- (memq #'c-after-change after-change-functions))
+ (when (memq #'c-after-change after-change-functions)
(remove-hook 'after-change-functions #'c-after-change t)
(add-hook 'after-change-functions #'c-after-change nil t)))
@@ -2158,14 +2142,11 @@ This function is called from `c-common-init', once per mode initialization."
(when (eq font-lock-support-mode 'jit-lock-mode)
(save-restriction
(widen)
- ;; FIXME: This presumes that c-new-BEG and c-new-END have been set
- ;; I guess from the before-change-function.
(c-save-buffer-state () ; Protect the undo-list from put-text-property.
(if (< c-new-BEG beg)
(put-text-property c-new-BEG beg 'fontified nil))
(if (> c-new-END end)
- (put-text-property end (min c-new-END (point-max))
- 'fontified nil)))))
+ (put-text-property end c-new-END 'fontified nil)))))
(cons c-new-BEG c-new-END))
;; Emacs < 22 and XEmacs