From 92d421958424fa3a008e8f4dcfb2d7936ca784b6 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 5 Apr 2021 14:15:55 -0400 Subject: [PATCH 3/4] * lisp/progmodes/cc-*.el: Prefer #' to quote functions --- lisp/progmodes/cc-cmds.el | 18 ++-- lisp/progmodes/cc-defs.el | 8 +- lisp/progmodes/cc-engine.el | 8 +- lisp/progmodes/cc-fonts.el | 2 +- lisp/progmodes/cc-mode.el | 195 ++++++++++++++++++------------------ lisp/progmodes/cc-styles.el | 2 +- lisp/progmodes/cc-vars.el | 2 +- 7 files changed, 120 insertions(+), 115 deletions(-) diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 87ac076ee4..c1c7916309 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -327,7 +327,7 @@ c-toggle-auto-newline (c-update-modeline) (c-keep-region-active)) -(defalias 'c-toggle-auto-state 'c-toggle-auto-newline) +(defalias 'c-toggle-auto-state #'c-toggle-auto-newline) (make-obsolete 'c-toggle-auto-state 'c-toggle-auto-newline "22.1") (defun c-toggle-hungry-state (&optional arg) @@ -434,7 +434,7 @@ c-hungry-delete-backwards (delete-region (point) here) (funcall c-backspace-function 1)))) -(defalias 'c-hungry-backspace 'c-hungry-delete-backwards) +(defalias 'c-hungry-backspace #'c-hungry-delete-backwards) (defun c-electric-delete-forward (arg) "Delete the following character or whitespace. @@ -1526,10 +1526,10 @@ c-toggle-cpp-indent-to-body (if c-cpp-indent-to-body-flag (progn (c-clear-stale-indent-to-body-abbrevs) - (mapc 'c-add-indent-to-body-to-abbrev-table + (mapc #'c-add-indent-to-body-to-abbrev-table c-cpp-indent-to-body-directives) - (add-hook 'c-special-indent-hook 'c-align-cpp-indent-to-body nil t)) - (remove-hook 'c-special-indent-hook 'c-align-cpp-indent-to-body t)) + (add-hook 'c-special-indent-hook #'c-align-cpp-indent-to-body nil t)) + (remove-hook 'c-special-indent-hook #'c-align-cpp-indent-to-body t)) (message "c-cpp-indent-to-body %sabled" (if c-cpp-indent-to-body-flag "en" "dis"))) @@ -1541,8 +1541,8 @@ c-toggle-cpp-indent-to-body (cond ((and (fboundp 'subword-mode) (not (fboundp 'c-subword-mode))) ;; Recent Emacsen come with their own subword support. Use that. - (define-obsolete-function-alias 'c-subword-mode 'subword-mode "24.3") - (define-obsolete-variable-alias 'c-subword-mode 'subword-mode "24.3")) + (define-obsolete-function-alias 'c-subword-mode #'subword-mode "24.3") + (define-obsolete-variable-alias 'c-subword-mode #'subword-mode "24.3")) (t ;; Autoload directive for emacsen that doesn't have an older CC Mode ;; version in the dist. @@ -5003,8 +5003,8 @@ c-indent-new-comment-line (funcall do-line-break) (indent-to col)))))) -(defalias 'c-comment-line-break-function 'c-indent-new-comment-line) -(make-obsolete 'c-comment-line-break-function 'c-indent-new-comment-line "21.1") +(defalias 'c-comment-line-break-function #'c-indent-new-comment-line) +(make-obsolete 'c-comment-line-break-function #'c-indent-new-comment-line "21.1") ;; Advice for Emacsen older than 21.1 (!), released 2001/10 (unless (boundp 'comment-line-break-function) diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 3072733d4d..9e17356d59 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -1923,7 +1923,7 @@ c-face-name-p (defun c-concat-separated (list separator) "Like `concat' on LIST, but separate each element with SEPARATOR. Notably, null elements in LIST are ignored." - (mapconcat 'identity (delete nil (append list nil)) separator)) + (mapconcat #'identity (delete nil (append list nil)) separator)) (defun c-make-keywords-re (adorn list &optional mode) "Make a regexp that matches all the strings the list. @@ -2053,8 +2053,8 @@ c-make-bare-char-alt str)) ;; Leftovers from (X)Emacs 19 compatibility. -(defalias 'c-regexp-opt 'regexp-opt) -(defalias 'c-regexp-opt-depth 'regexp-opt-depth) +(defalias 'c-regexp-opt #'regexp-opt) +(defalias 'c-regexp-opt-depth #'regexp-opt-depth) ;; Figure out what features this Emacs has @@ -2474,7 +2474,7 @@ c-lang-defconst ;; definitions for this symbol, to make sure the order in the ;; `source' property is correct even when files are loaded out of ;; order. - (setq pre-files (mapcar 'car (get sym 'source))) + (setq pre-files (mapcar #'car (get sym 'source))) (if (memq file pre-files) ;; This can happen when the source file (e.g. cc-langs.el) is first ;; loaded as source, setting a 'source property entry, and then itself diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 56d33ac117..35f9146116 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -556,7 +556,7 @@ c-syntactic-content (setq from (point)))) (setcdr tail (list (buffer-substring-no-properties from to))) - (apply 'concat (cdr parts)))))) + (apply #'concat (cdr parts)))))) (defun c-shift-line-indentation (shift-amt) ;; Shift the indentation of the current line with the specified @@ -5730,7 +5730,7 @@ c-literal-start (car (cddr (c-semi-pp-to-literal (point)))))) ;; In case external callers use this; it did have a docstring. -(defalias 'c-literal-limits-fast 'c-literal-limits) +(defalias 'c-literal-limits-fast #'c-literal-limits) (defun c-collect-line-comments (range) "If the argument is a cons of two buffer positions (such as returned by @@ -6843,7 +6843,7 @@ c-list-found-types (maphash (lambda (type _) (setq type-list (cons type type-list))) c-found-types) - (sort type-list 'string-lessp))) + (sort type-list #'string-lessp))) ;; Shut up the byte compiler. (defvar c-maybe-stale-found-type) @@ -12558,7 +12558,7 @@ c-add-stmt-syntax on-label) ;; Use point as the anchor point for "namespace", "extern", etc. - (apply 'c-add-syntax syntax-symbol + (apply #'c-add-syntax syntax-symbol (if (rassq syntax-symbol c-other-decl-block-key-in-symbols-alist) (point) nil) syntax-extra-args) diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 3567f5e76e..8ac51be170 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -2585,7 +2585,7 @@ objc-font-lock-keywords ;; package. The value replaced here isn't relevant now anyway since ;; those types are builtin and therefore listed directly in ;; `c-primitive-type-kwds'. -(when (equal (sort (append objc-font-lock-extra-types nil) 'string-lessp) +(when (equal (sort (append objc-font-lock-extra-types nil) #'string-lessp) '("BOOL" "Class" "IMP" "SEL")) (setq objc-font-lock-extra-types (cc-eval-when-compile (list (concat "[" c-upper "]\\sw*"))))) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index f1f8f19cee..c7fc0db05c 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -227,7 +227,7 @@ c-initialize-cc-mode ;; Fix obsolete variables. (if (boundp 'c-comment-continuation-stars) (setq c-block-comment-prefix c-comment-continuation-stars)) - (add-hook 'change-major-mode-hook 'c-leave-cc-mode-mode) + (add-hook 'change-major-mode-hook #'c-leave-cc-mode-mode) ;; Connect up with Emacs's electric-pair-mode (eval-after-load "elec-pair" '(when (boundp 'electric-pair-inhibit-predicate) @@ -240,9 +240,9 @@ c-initialize-cc-mode (setq c-initialization-ok t) ;; Connect up with Emacs's electric-indent-mode, for >= Emacs 24.4 (when (fboundp 'electric-indent-local-mode) - (add-hook 'electric-indent-mode-hook 'c-electric-indent-mode-hook) + (add-hook 'electric-indent-mode-hook #'c-electric-indent-mode-hook) (add-hook 'electric-indent-local-mode-hook - 'c-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)))) @@ -325,38 +325,38 @@ c-bind-special-erase-keys ;; Separate M-BS from C-M-h. The former should remain ;; backward-kill-word. - (define-key c-mode-base-map [(control meta h)] 'c-mark-function) - (define-key c-mode-base-map "\e\C-q" 'c-indent-exp) - (substitute-key-definition 'backward-sentence - 'c-beginning-of-statement + (define-key c-mode-base-map [(control meta h)] #'c-mark-function) + (define-key c-mode-base-map "\e\C-q" #'c-indent-exp) + (substitute-key-definition #'backward-sentence + #'c-beginning-of-statement c-mode-base-map global-map) - (substitute-key-definition 'forward-sentence - 'c-end-of-statement + (substitute-key-definition #'forward-sentence + #'c-end-of-statement c-mode-base-map global-map) - (substitute-key-definition 'indent-new-comment-line - 'c-indent-new-comment-line + (substitute-key-definition #'indent-new-comment-line + #'c-indent-new-comment-line c-mode-base-map global-map) - (substitute-key-definition 'indent-for-tab-command + (substitute-key-definition #'indent-for-tab-command ;; XXX Is this the right thing to do ;; here? - 'c-indent-line-or-region + #'c-indent-line-or-region c-mode-base-map global-map) (when (fboundp 'comment-indent-new-line) ;; indent-new-comment-line has changed name to ;; comment-indent-new-line in Emacs 21. - (substitute-key-definition 'comment-indent-new-line - 'c-indent-new-comment-line + (substitute-key-definition #'comment-indent-new-line + #'c-indent-new-comment-line c-mode-base-map global-map)) ;; RMS says don't make these the default. ;; (April 2006): RMS has now approved these commands as defaults. (unless (memq 'argumentative-bod-function c-emacs-features) - (define-key c-mode-base-map "\e\C-a" 'c-beginning-of-defun) - (define-key c-mode-base-map "\e\C-e" 'c-end-of-defun)) + (define-key c-mode-base-map "\e\C-a" #'c-beginning-of-defun) + (define-key c-mode-base-map "\e\C-e" #'c-end-of-defun)) - (define-key c-mode-base-map "\C-c\C-n" 'c-forward-conditional) - (define-key c-mode-base-map "\C-c\C-p" 'c-backward-conditional) - (define-key c-mode-base-map "\C-c\C-u" 'c-up-conditional) + (define-key c-mode-base-map "\C-c\C-n" #'c-forward-conditional) + (define-key c-mode-base-map "\C-c\C-p" #'c-backward-conditional) + (define-key c-mode-base-map "\C-c\C-u" #'c-up-conditional) ;; It doesn't suffice to put `c-fill-paragraph' on ;; `fill-paragraph-function' since `c-fill-paragraph' must be called @@ -366,7 +366,7 @@ c-bind-special-erase-keys ;; before that. Also, `c-fill-paragraph' chains on to ;; `fill-paragraph' and the value on `fill-paragraph-function' to ;; do the actual filling work. - (substitute-key-definition 'fill-paragraph 'c-fill-paragraph + (substitute-key-definition #'fill-paragraph #'c-fill-paragraph c-mode-base-map global-map) ;; In XEmacs the default fill function is called ;; fill-paragraph-or-region. @@ -389,20 +389,20 @@ c-bind-special-erase-keys ;; automatically maps the [delete] and [backspace] keys to these two ;; depending on window system and user preferences. (In earlier ;; versions it's possible to do the same by using `function-key-map'.) - (define-key c-mode-base-map "\C-d" 'c-electric-delete-forward) - (define-key c-mode-base-map "\177" 'c-electric-backspace) - (define-key c-mode-base-map "\C-c\C-d" 'c-hungry-delete-forward) - (define-key c-mode-base-map [?\C-c ?\d] 'c-hungry-delete-backwards) - (define-key c-mode-base-map [?\C-c ?\C-\d] 'c-hungry-delete-backwards) - (define-key c-mode-base-map [?\C-c deletechar] 'c-hungry-delete-forward) ; C-c on a tty. + (define-key c-mode-base-map "\C-d" #'c-electric-delete-forward) + (define-key c-mode-base-map "\177" #'c-electric-backspace) + (define-key c-mode-base-map "\C-c\C-d" #'c-hungry-delete-forward) + (define-key c-mode-base-map [?\C-c ?\d] #'c-hungry-delete-backwards) + (define-key c-mode-base-map [?\C-c ?\C-\d] #'c-hungry-delete-backwards) + (define-key c-mode-base-map [?\C-c deletechar] #'c-hungry-delete-forward) ; C-c on a tty. (define-key c-mode-base-map [?\C-c (control deletechar)] ; C-c C- on a tty. - 'c-hungry-delete-forward) + #'c-hungry-delete-forward) (when (boundp 'normal-erase-is-backspace) ;; The automatic C-d and DEL mapping functionality doesn't extend ;; to special combinations like C-c C-, so we have to hook ;; into the `normal-erase-is-backspace' system to bind it directly ;; as appropriate. - (add-hook 'normal-erase-is-backspace-mode-hook 'c-bind-special-erase-keys) + (add-hook 'normal-erase-is-backspace-mode-hook #'c-bind-special-erase-keys) (c-bind-special-erase-keys)) (when (fboundp 'delete-forward-p) @@ -411,43 +411,43 @@ c-bind-special-erase-keys ;; directly, and use `delete-forward-p' to decide what [delete] ;; should do. That's done in the XEmacs specific ;; `c-electric-delete' and `c-hungry-delete' functions. - (define-key c-mode-base-map [delete] 'c-electric-delete) - (define-key c-mode-base-map [backspace] 'c-electric-backspace) - (define-key c-mode-base-map (kbd "C-c ") 'c-hungry-delete) - (define-key c-mode-base-map (kbd "C-c C-") 'c-hungry-delete) + (define-key c-mode-base-map [delete] #'c-electric-delete) + (define-key c-mode-base-map [backspace] #'c-electric-backspace) + (define-key c-mode-base-map (kbd "C-c ") #'c-hungry-delete) + (define-key c-mode-base-map (kbd "C-c C-") #'c-hungry-delete) (define-key c-mode-base-map (kbd "C-c ") - 'c-hungry-delete-backwards) + #'c-hungry-delete-backwards) (define-key c-mode-base-map (kbd "C-c C-") - 'c-hungry-delete-backwards)) - - (define-key c-mode-base-map "#" 'c-electric-pound) - (define-key c-mode-base-map "{" 'c-electric-brace) - (define-key c-mode-base-map "}" 'c-electric-brace) - (define-key c-mode-base-map "/" 'c-electric-slash) - (define-key c-mode-base-map "*" 'c-electric-star) - (define-key c-mode-base-map ";" 'c-electric-semi&comma) - (define-key c-mode-base-map "," 'c-electric-semi&comma) - (define-key c-mode-base-map ":" 'c-electric-colon) - (define-key c-mode-base-map "(" 'c-electric-paren) - (define-key c-mode-base-map ")" 'c-electric-paren) - - (define-key c-mode-base-map "\C-c\C-\\" 'c-backslash-region) - (define-key c-mode-base-map "\C-c\C-a" 'c-toggle-auto-newline) - (define-key c-mode-base-map "\C-c\C-b" 'c-submit-bug-report) - (define-key c-mode-base-map "\C-c\C-c" 'comment-region) - (define-key c-mode-base-map "\C-c\C-l" 'c-toggle-electric-state) - (define-key c-mode-base-map "\C-c\C-o" 'c-set-offset) - (define-key c-mode-base-map "\C-c\C-q" 'c-indent-defun) - (define-key c-mode-base-map "\C-c\C-s" 'c-show-syntactic-information) - ;; (define-key c-mode-base-map "\C-c\C-t" 'c-toggle-auto-hungry-state) Commented out by ACM, 2005-03-05. - (define-key c-mode-base-map "\C-c." 'c-set-style) + #'c-hungry-delete-backwards)) + + (define-key c-mode-base-map "#" #'c-electric-pound) + (define-key c-mode-base-map "{" #'c-electric-brace) + (define-key c-mode-base-map "}" #'c-electric-brace) + (define-key c-mode-base-map "/" #'c-electric-slash) + (define-key c-mode-base-map "*" #'c-electric-star) + (define-key c-mode-base-map ";" #'c-electric-semi&comma) + (define-key c-mode-base-map "," #'c-electric-semi&comma) + (define-key c-mode-base-map ":" #'c-electric-colon) + (define-key c-mode-base-map "(" #'c-electric-paren) + (define-key c-mode-base-map ")" #'c-electric-paren) + + (define-key c-mode-base-map "\C-c\C-\\" #'c-backslash-region) + (define-key c-mode-base-map "\C-c\C-a" #'c-toggle-auto-newline) + (define-key c-mode-base-map "\C-c\C-b" #'c-submit-bug-report) + (define-key c-mode-base-map "\C-c\C-c" #'comment-region) + (define-key c-mode-base-map "\C-c\C-l" #'c-toggle-electric-state) + (define-key c-mode-base-map "\C-c\C-o" #'c-set-offset) + (define-key c-mode-base-map "\C-c\C-q" #'c-indent-defun) + (define-key c-mode-base-map "\C-c\C-s" #'c-show-syntactic-information) + ;; (define-key c-mode-base-map "\C-c\C-t" #'c-toggle-auto-hungry-state) Commented out by ACM, 2005-03-05. + (define-key c-mode-base-map "\C-c." #'c-set-style) ;; conflicts with OOBR - ;;(define-key c-mode-base-map "\C-c\C-v" 'c-version) - ;; (define-key c-mode-base-map "\C-c\C-y" 'c-toggle-hungry-state) Commented out by ACM, 2005-11-22. + ;;(define-key c-mode-base-map "\C-c\C-v" #'c-version) + ;; (define-key c-mode-base-map "\C-c\C-y" #'c-toggle-hungry-state) Commented out by ACM, 2005-11-22. (define-key c-mode-base-map "\C-c\C-w" (if (fboundp 'c-subword-mode) #'c-subword-mode #'subword-mode)) - (define-key c-mode-base-map "\C-c\C-k" 'c-toggle-comment-style) - (define-key c-mode-base-map "\C-c\C-z" 'c-display-defun-name)) + (define-key c-mode-base-map "\C-c\C-k" #'c-toggle-comment-style) + (define-key c-mode-base-map "\C-c\C-z" #'c-display-defun-name)) ;; We don't require the outline package, but we configure it a bit anyway. (cc-bytecomp-defvar outline-level) @@ -619,12 +619,12 @@ c-basic-common-init ;; now set their values (set (make-local-variable 'parse-sexp-ignore-comments) t) - (set (make-local-variable 'indent-line-function) 'c-indent-line) - (set (make-local-variable 'indent-region-function) 'c-indent-region) - (set (make-local-variable 'normal-auto-fill-function) 'c-do-auto-fill) + (set (make-local-variable 'indent-line-function) #'c-indent-line) + (set (make-local-variable 'indent-region-function) #'c-indent-region) + (set (make-local-variable 'normal-auto-fill-function) #'c-do-auto-fill) (set (make-local-variable 'comment-multi-line) t) (set (make-local-variable 'comment-line-break-function) - 'c-indent-new-comment-line) + #'c-indent-new-comment-line) ;; Prevent time-wasting activity on C-y. (when (boundp 'yank-handled-properties) @@ -640,7 +640,7 @@ c-basic-common-init ;; Install `c-fill-paragraph' on `fill-paragraph-function' so that a ;; direct call to `fill-paragraph' behaves better. This still ;; doesn't work with filladapt but it's better than nothing. - (set (make-local-variable 'fill-paragraph-function) 'c-fill-paragraph) + (set (make-local-variable 'fill-paragraph-function) #'c-fill-paragraph) ;; Initialize the cache for `c-looking-at-or-maybe-in-bracelist'. (setq c-laomib-cache nil) @@ -717,7 +717,7 @@ c-basic-common-init (setq c-offsets-alist (copy-alist c-offsets-alist)) ;; setup the comment indent variable in an Emacs version portable way - (set (make-local-variable 'comment-indent-function) 'c-comment-indent) + (set (make-local-variable 'comment-indent-function) #'c-comment-indent) ;; What sort of comments are default for M-;? (setq c-block-comment-flag c-block-comment-is-default) @@ -742,15 +742,15 @@ c-basic-common-init (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) + (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) + (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 + #'c-extend-after-change-region))) ; Currently (2009-05) used by all ; languages with #define (C, C++,; ObjC), and by AWK. (defun c-setup-doc-comment-style () @@ -816,7 +816,7 @@ c-common-init c-before-font-lock-functions)))) (set (make-local-variable 'outline-regexp) "[^#\n\^M]") - (set (make-local-variable 'outline-level) 'c-outline-level) + (set (make-local-variable 'outline-level) #'c-outline-level) (set (make-local-variable 'add-log-current-defun-function) (lambda () (or (c-cpp-define-name) (car (c-defun-name-and-limits nil))))) @@ -965,8 +965,8 @@ c-postprocess-file-styles nil)))) (if (boundp 'before-hack-local-variables-hook) - (add-hook 'before-hack-local-variables-hook 'c-before-hack-hook) - (add-hook 'hack-local-variables-hook 'c-postprocess-file-styles)) + (add-hook 'before-hack-local-variables-hook #'c-before-hack-hook) + (add-hook 'hack-local-variables-hook #'c-postprocess-file-styles)) (defmacro c-run-mode-hooks (&rest hooks) ;; Emacs 21.1 has introduced a system with delayed mode hooks that @@ -2473,15 +2473,15 @@ c-font-lock-init ;; Emacs bug #19669. (when (boundp 'font-lock-extend-region-functions) (setq font-lock-extend-region-functions - (delq 'font-lock-extend-region-wholelines + (delq #'font-lock-extend-region-wholelines font-lock-extend-region-functions))) (make-local-variable 'font-lock-fontify-region-function) - (setq font-lock-fontify-region-function 'c-font-lock-fontify-region) + (setq font-lock-fontify-region-function #'c-font-lock-fontify-region) (if (featurep 'xemacs) (make-local-hook 'font-lock-mode-hook)) - (add-hook 'font-lock-mode-hook 'c-after-font-lock-init nil t)) + (add-hook 'font-lock-mode-hook #'c-after-font-lock-init nil t)) ;; Emacs 22 and later. (defun c-extend-after-change-region (beg end _old-len) @@ -2571,7 +2571,7 @@ c-mode-map map) "Keymap used in c-mode buffers.") ;; Add bindings which are only useful for C. -(define-key c-mode-map "\C-c\C-e" 'c-macro-expand) +(define-key c-mode-map "\C-c\C-e" #'c-macro-expand) (easy-menu-define c-c-menu c-mode-map "C Mode Commands" @@ -2634,7 +2634,7 @@ c-mode (when (featurep 'xemacs) (easy-menu-add c-c-menu)) (cc-imenu-init cc-imenu-c-generic-expression) - (add-hook 'flymake-diagnostic-functions 'flymake-cc nil t) + (add-hook 'flymake-diagnostic-functions #'flymake-cc nil t) (c-run-mode-hooks 'c-mode-common-hook)) (defconst c-or-c++-mode--regexp @@ -2692,10 +2692,10 @@ c++-mode-map map) "Keymap used in c++-mode buffers.") ;; Add bindings which are only useful for C++. -(define-key c++-mode-map "\C-c\C-e" 'c-macro-expand) -(define-key c++-mode-map "\C-c:" 'c-scope-operator) -(define-key c++-mode-map "<" 'c-electric-lt-gt) -(define-key c++-mode-map ">" 'c-electric-lt-gt) +(define-key c++-mode-map "\C-c\C-e" #'c-macro-expand) +(define-key c++-mode-map "\C-c:" #'c-scope-operator) +(define-key c++-mode-map "<" #'c-electric-lt-gt) +(define-key c++-mode-map ">" #'c-electric-lt-gt) (easy-menu-define c-c++-menu c++-mode-map "C++ Mode Commands" (cons "C++" (c-lang-const c-mode-menu c++))) @@ -2726,7 +2726,7 @@ c++-mode (when (featurep 'xemacs) (easy-menu-add c-c++-menu)) (cc-imenu-init cc-imenu-c++-generic-expression) - (add-hook 'flymake-diagnostic-functions 'flymake-cc nil t) + (add-hook 'flymake-diagnostic-functions #'flymake-cc nil t) (c-run-mode-hooks 'c-mode-common-hook)) @@ -2741,7 +2741,7 @@ objc-mode-map map) "Keymap used in objc-mode buffers.") ;; Add bindings which are only useful for Objective-C. -(define-key objc-mode-map "\C-c\C-e" 'c-macro-expand) +(define-key objc-mode-map "\C-c\C-e" #'c-macro-expand) (easy-menu-define c-objc-menu objc-mode-map "ObjC Mode Commands" (cons "ObjC" (c-lang-const c-mode-menu objc))) @@ -2882,7 +2882,7 @@ pike-mode-map map) "Keymap used in pike-mode buffers.") ;; Additional bindings. -(define-key pike-mode-map "\C-c\C-e" 'c-macro-expand) +(define-key pike-mode-map "\C-c\C-e" #'c-macro-expand) (easy-menu-define c-pike-menu pike-mode-map "Pike Mode Commands" (cons "Pike" (c-lang-const c-mode-menu pike))) @@ -2929,17 +2929,22 @@ awk-mode-map (let ((map (c-make-inherited-keymap))) map) "Keymap used in awk-mode buffers.") +;; FIXME: Maybe we should move `awk-mode-map' and `awk-mode' to `cc-awk.el' +;; to avoid the need for these `declare-function's as well as the +;; `awk-mode-syntax-table' workaround in `awk-mode'. +(declare-function c-awk-end-of-defun "cc-awk" (&optional arg)) +(declare-function c-awk-beginning-of-defun "cc-awk" (&optional arg)) ;; Add bindings which are only useful for awk. -(define-key awk-mode-map "#" 'self-insert-command);Overrides electric parent binding. -(define-key awk-mode-map "/" 'self-insert-command);Overrides electric parent binding. -(define-key awk-mode-map "*" 'self-insert-command);Overrides electric parent binding. -(define-key awk-mode-map "\C-c\C-n" 'undefined) ; #if doesn't exist in awk. -(define-key awk-mode-map "\C-c\C-p" 'undefined) -(define-key awk-mode-map "\C-c\C-u" 'undefined) -(define-key awk-mode-map "\M-a" 'c-beginning-of-statement) ; 2003/10/7 -(define-key awk-mode-map "\M-e" 'c-end-of-statement) ; 2003/10/7 -(define-key awk-mode-map "\C-\M-a" 'c-awk-beginning-of-defun) -(define-key awk-mode-map "\C-\M-e" 'c-awk-end-of-defun) +(define-key awk-mode-map "#" #'self-insert-command);Overrides electric parent binding. +(define-key awk-mode-map "/" #'self-insert-command);Overrides electric parent binding. +(define-key awk-mode-map "*" #'self-insert-command);Overrides electric parent binding. +(define-key awk-mode-map "\C-c\C-n" #'undefined) ; #if doesn't exist in awk. +(define-key awk-mode-map "\C-c\C-p" #'undefined) +(define-key awk-mode-map "\C-c\C-u" #'undefined) +(define-key awk-mode-map "\M-a" #'c-beginning-of-statement) ; 2003/10/7 +(define-key awk-mode-map "\M-e" #'c-end-of-statement) ; 2003/10/7 +(define-key awk-mode-map "\C-\M-a" #'c-awk-beginning-of-defun) +(define-key awk-mode-map "\C-\M-e" #'c-awk-end-of-defun) (easy-menu-define c-awk-menu awk-mode-map "AWK Mode Commands" (cons "AWK" (c-lang-const c-mode-menu awk))) diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el index f2ebaa48f3..0022da2fe0 100644 --- a/lisp/progmodes/cc-styles.el +++ b/lisp/progmodes/cc-styles.el @@ -450,7 +450,7 @@ c-read-offset ;; In principle completing-read is used here, but SPC is unbound ;; to make it less annoying to enter lists. (set-keymap-parent keymap minibuffer-local-completion-map) - (define-key keymap " " 'self-insert-command) + (define-key keymap " " #'self-insert-command) (while (not offset) (setq input (read-from-minibuffer prompt nil keymap t 'c-read-offset-history diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 88ee092da7..6537104aaa 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -330,7 +330,7 @@ c-syntactic-indentation :type 'boolean :group 'c) (make-variable-buffer-local 'c-syntactic-indentation) -(put 'c-syntactic-indentation 'safe-local-variable 'booleanp) +(put 'c-syntactic-indentation 'safe-local-variable #'booleanp) (defcustom c-syntactic-indentation-in-macros t "Enable syntactic analysis inside macros. -- 2.30.2