summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/cc-mode.el')
-rw-r--r--lisp/progmodes/cc-mode.el34
1 files changed, 16 insertions, 18 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 9b18bbf82a9..1ce076734ff 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -75,7 +75,7 @@
;; For Emacs < 22.2.
(eval-and-compile
- (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
+ (unless (fboundp 'declare-function) (defmacro declare-function (&rest _r))))
(eval-when-compile
(let ((load-path
@@ -190,11 +190,10 @@ control). See \"cc-mode.el\" for more info."
(add-hook 'change-major-mode-hook 'c-leave-cc-mode-mode)
(setq c-initialization-ok t)
;; Connect up with Emacs's electric-indent-mode, for >= Emacs 24.4
- (when (fboundp 'electric-indent-mode)
+ (when (fboundp 'electric-indent-local-mode)
(add-hook 'electric-indent-mode-hook 'c-electric-indent-mode-hook)
- (when (fboundp 'electric-indent-local-mode)
- (add-hook 'electric-indent-local-mode-hook
- 'c-electric-indent-local-mode-hook))))
+ (add-hook 'electric-indent-local-mode-hook
+ 'c-electric-indent-local-mode-hook)))
;; Will try initialization hooks again if they failed.
(put 'c-initialize-cc-mode initprop c-initialization-ok))))
@@ -588,8 +587,9 @@ that requires a literal mode spec at compile time."
;; messing up CC Mode's, and set `c-electric-flag' if `electric-indent-mode'
;; has been called by the user.
(when (boundp 'electric-indent-inhibit) (setq electric-indent-inhibit t))
- (when (and (boundp 'electric-indent-mode-has-been-called)
- (> electric-indent-mode-has-been-called 1))
+ ;; CC-mode should obey Emacs's generic preferences, tho only do it if
+ ;; Emacs's generic preferences can be set per-buffer (Emacs>=24.4).
+ (when (fboundp 'electric-indent-local-mode)
(setq c-electric-flag electric-indent-mode))
;; ;; Put submode indicators onto minor-mode-alist, but only once.
@@ -1165,7 +1165,7 @@ Note that the style variables are always made local to the buffer."
(backward-char))
new-pos)) ; back over (, [, <.
-(defun c-change-set-fl-decl-start (beg end old-len)
+(defun c-change-set-fl-decl-start (_beg _end _old-len)
;; Set c-new-BEG to the beginning of a "local" declaration if it('s BOL) is
;; inside one. This is called from an after-change-function, but the
;; parameters BEG END and OLD-LEN are ignored. See `c-set-fl-decl-start'
@@ -1239,7 +1239,7 @@ This function is called from `c-common-init', once per mode initialization."
(make-local-hook 'font-lock-mode-hook))
(add-hook 'font-lock-mode-hook 'c-after-font-lock-init nil t))
-(defun c-extend-after-change-region (beg end old-len)
+(defun c-extend-after-change-region (_beg _end _old-len)
"Extend the region to be fontified, if necessary."
;; Note: the parameters are ignored here. This somewhat indirect
;; implementation exists because it is minimally different from the
@@ -1256,15 +1256,13 @@ This function is called from `c-common-init', once per mode initialization."
(defun c-electric-indent-mode-hook ()
;; Emacs has en/disabled `electric-indent-mode'. Propagate this through to
;; each CC Mode buffer.
- (when (and (boundp 'electric-indent-mode-has-been-called)
- (> electric-indent-mode-has-been-called 1))
- (mapc (lambda (buf)
- (with-current-buffer buf
- (when c-buffer-is-cc-mode
- ;; Don't use `c-toggle-electric-state' here due to recursion.
- (setq c-electric-flag electric-indent-mode)
- (c-update-modeline))))
- (buffer-list))))
+ (mapc (lambda (buf)
+ (with-current-buffer buf
+ (when c-buffer-is-cc-mode
+ ;; Don't use `c-toggle-electric-state' here due to recursion.
+ (setq c-electric-flag electric-indent-mode)
+ (c-update-modeline))))
+ (buffer-list)))
(defun c-electric-indent-local-mode-hook ()
;; Emacs has en/disabled `electric-indent-local-mode' for this buffer.