aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2020-10-02 10:34:37 +0000
committerAlan Mackenzie2020-10-02 10:34:37 +0000
commit053d70660bcec9b66834e52c4860b32083da77a0 (patch)
tree84ec37324e38a7d631fb5acb0779b2c61541e710
parent4cb16b6f42ea7ea088fa4134f8fe4ccfec16a56d (diff)
downloademacs-053d70660bcec9b66834e52c4860b32083da77a0.tar.gz
emacs-053d70660bcec9b66834e52c4860b32083da77a0.zip
CC Mode: Convert the handling of c-special-indent-hook to standard usage
* lisp/progmodes/cc-styles.el (c-set-style): Use kill-local-variable rather than copying the hook's global value to the local binding. (c-make-styles-buffer-local): Remove redundant make-variable-buffer-local.
-rw-r--r--lisp/progmodes/cc-styles.el6
1 files changed, 2 insertions, 4 deletions
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el
index 36be9f6c74e..855e467571d 100644
--- a/lisp/progmodes/cc-styles.el
+++ b/lisp/progmodes/cc-styles.el
@@ -395,8 +395,7 @@ a null operation."
395 ;; remain. This is not necessary for c-offsets-alist, since 395 ;; remain. This is not necessary for c-offsets-alist, since
396 ;; c-get-style-variables contains every valid offset type in the 396 ;; c-get-style-variables contains every valid offset type in the
397 ;; fallback entry. 397 ;; fallback entry.
398 (setq c-special-indent-hook 398 (kill-local-variable 'c-special-indent-hook))
399 (default-value 'c-special-indent-hook)))
400 (mapc (lambda (elem) 399 (mapc (lambda (elem)
401 (c-set-style-1 elem dont-override)) 400 (c-set-style-1 elem dont-override))
402 ;; Need to go through the variables backwards when we 401 ;; Need to go through the variables backwards when we
@@ -644,7 +643,7 @@ CC Mode by making sure the proper entries are present on
644 643
645(defun c-make-styles-buffer-local (&optional this-buf-only-p) 644(defun c-make-styles-buffer-local (&optional this-buf-only-p)
646 "Make all CC Mode style variables buffer local. 645 "Make all CC Mode style variables buffer local.
647If `this-buf-only-p' is non-nil, the style variables will be made 646If THIS-BUF-ONLY-P is non-nil, the style variables will be made
648buffer local only in the current buffer. Otherwise they'll be made 647buffer local only in the current buffer. Otherwise they'll be made
649permanently buffer local in any buffer that changes their values. 648permanently buffer local in any buffer that changes their values.
650 649
@@ -662,7 +661,6 @@ any reason to call this function directly."
662 ;; Hooks must be handled specially 661 ;; Hooks must be handled specially
663 (if this-buf-only-p 662 (if this-buf-only-p
664 (if (featurep 'xemacs) (make-local-hook 'c-special-indent-hook)) 663 (if (featurep 'xemacs) (make-local-hook 'c-special-indent-hook))
665 (with-no-warnings (make-variable-buffer-local 'c-special-indent-hook))
666 (setq c-style-variables-are-local-p t)) 664 (setq c-style-variables-are-local-p t))
667 )) 665 ))
668 666