summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-mode.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2010-12-10 15:00:25 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2010-12-10 15:00:25 -0500
commit175069efeb080517afefdd44a06f7a779ea8c25c (patch)
tree830e1af997994dd8d9b3fb3d6000810d138f9a9d /lisp/progmodes/cc-mode.el
parentfe646d2c4e800f7174915b26b9fdb6252bbd0453 (diff)
downloademacs-175069efeb080517afefdd44a06f7a779ea8c25c.tar.gz
emacs-175069efeb080517afefdd44a06f7a779ea8c25c.tar.bz2
emacs-175069efeb080517afefdd44a06f7a779ea8c25c.zip
Derive from prog-mode, use derived-mode-p, and fix up various
minor style issues in lisp/progmodes. * lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init) (vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable -> make-local-hook. * lisp/progmodes/sh-script.el (sh-require-final-newline): Remove. (sh-set-shell): Don't set require-final-newline since it's already done by prog-mode. * lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column since we never set it. * lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation): Use read-string and standard prompt. * lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration. * lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl. (meta-common-mode-syntax-table): Rename from meta-mode-syntax-table. (meta-common-mode-map): Rename from meta-mode-map. Remove C-m binding, which is a user preference, not mode specific. (meta-common-mode): New major mode; replace meta-common-initialization. * lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing around with font-lock. * lisp/progmodes/etags.el (select-tags-table-mode): Derive from special-mode. * lisp/progmodes/octave-mod.el (octave-mode): * lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode) (gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode) (gdb-frames-mode, gdb-locals-mode, gdb-registers-mode): Let define-derived-mode do its job. * lisp/progmodes/cpp.el (cpp-edit-mode-map): Move initialization into declaration. (cpp-edit-mode): Use define-derived-mode. (cpp-edit-load): Use derived-mode-p. * lisp/progmodes/mixal-mode.el (mixal-mode): * lisp/progmodes/f90.el (f90-mode): * lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting require-final-newline since prog-mode does it already. * lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string. * lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup. * lisp/progmodes/antlr-mode.el: Require cc-mode upfront. (antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in the declaration. (antlr-directory-dependencies, antlr-show-makefile-rules): Use derived-mode-p. (antlr-language-option): Don't assume point-min==1. (antlr-mode): Use define-derived-mode. * lisp/progmodes/ada-mode.el: Use derived-mode-p. (ada-mode): Use define-derived-mode. Use hack-local-variables-hook. * lisp/progmodes/vhdl-mode.el (vhdl-mode): * lisp/progmodes/verilog-mode.el (verilog-mode): * lisp/progmodes/vera-mode.el (vera-mode): * lisp/progmodes/sql.el (sql-mode): * lisp/progmodes/scheme.el (scheme-mode): * lisp/progmodes/perl-mode.el (perl-mode): * lisp/progmodes/octave-inf.el (inferior-octave-mode): * lisp/progmodes/autoconf.el (autoconf-mode): * lisp/progmodes/m4-mode.el (m4-mode): * lisp/progmodes/inf-lisp.el (inferior-lisp-mode): * lisp/progmodes/idlwave.el (idlwave-mode): * lisp/progmodes/icon.el (icon-mode): * lisp/progmodes/idlw-help.el (idlwave-help-mode): * lisp/progmodes/dcl-mode.el (dcl-mode): * lisp/progmodes/idlw-shell.el (idlwave-shell-mode): * lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode) (ebrowse-member-mode, ebrowse-electric-position-mode): Use define-derived-mode. * lisp/progmodes/xscheme.el (xscheme-start) (local-set-scheme-interaction-buffer, scheme-interaction-mode): * lisp/progmodes/which-func.el (which-function): * lisp/progmodes/vhdl-mode.el (vhdl-set-style): * lisp/progmodes/verilog-mode.el (verilog-set-compile-command) (verilog-modify-compile-command, verilog-error-regexp-add-xemacs) (verilog-set-define, verilog-auto-reeval-locals): * lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode): * lisp/progmodes/simula.el (simula-mode): * lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode): * lisp/progmodes/python.el (python-check, python-mode): * lisp/progmodes/prolog.el (prolog-mode-variables): * lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions): * lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame): * lisp/progmodes/delphi.el (delphi-mode): * lisp/progmodes/cc-styles.el (c-setup-paragraph-variables): * lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init) (c-font-lock-init): Move make-local-variable to their setq. * lisp/progmodes/xscheme.el (exit-scheme-interaction-mode) (xscheme-enter-interaction-mode, xscheme-enter-debugger-mode) (xscheme-debugger-mode-p, xscheme-send-string-1): * lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word) (tcl-load-file, tcl-restart-with-file): * lisp/progmodes/ps-mode.el (ps-run-running): * lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint): * lisp/progmodes/js.el (js--get-all-known-symbols): * lisp/progmodes/inf-lisp.el (inferior-lisp-proc): * lisp/progmodes/idlwave.el (idlwave-beginning-of-statement) (idlwave-template, idlwave-update-buffer-routine-info) (idlwave-update-current-buffer-info) (idlwave-get-routine-info-from-buffers, idlwave-choose) (idlwave-scan-class-info, idlwave-fix-keywords) (idlwave-list-buffer-load-path-shadows): * lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add) (idlwave-toolbar-remove): * lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action) (idlwave-shell-file-name, idlwave-shell-electric-debug-all-off) (idlwave-shell-menu-def): * lisp/progmodes/idlw-complete-structtag.el (idlwave-prepare-structure-tag-completion): * lisp/progmodes/gud.el (gud-set-buffer): * lisp/progmodes/f90.el (f90-backslash-not-special): * lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
Diffstat (limited to 'lisp/progmodes/cc-mode.el')
-rw-r--r--lisp/progmodes/cc-mode.el66
1 files changed, 27 insertions, 39 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 9524ff27d24..3196fc59023 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -487,15 +487,10 @@ that requires a literal mode spec at compile time."
;; these variables should always be buffer local; they do not affect
;; indentation style.
- (make-local-variable 'parse-sexp-ignore-comments)
- (make-local-variable 'indent-line-function)
- (make-local-variable 'indent-region-function)
- (make-local-variable 'normal-auto-fill-function)
(make-local-variable 'comment-start)
(make-local-variable 'comment-end)
(make-local-variable 'comment-start-skip)
- (make-local-variable 'comment-multi-line)
- (make-local-variable 'comment-line-break-function)
+
(make-local-variable 'paragraph-start)
(make-local-variable 'paragraph-separate)
(make-local-variable 'paragraph-ignore-fill-prefix)
@@ -503,18 +498,18 @@ that requires a literal mode spec at compile time."
(make-local-variable 'adaptive-fill-regexp)
;; now set their values
- (setq parse-sexp-ignore-comments t
- indent-line-function 'c-indent-line
- indent-region-function 'c-indent-region
- normal-auto-fill-function 'c-do-auto-fill
- comment-multi-line t
- comment-line-break-function 'c-indent-new-comment-line)
+ (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 'comment-multi-line) t)
+ (set (make-local-variable 'comment-line-break-function)
+ 'c-indent-new-comment-line)
;; 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.
- (make-local-variable 'fill-paragraph-function)
- (setq fill-paragraph-function 'c-fill-paragraph)
+ (set (make-local-variable 'fill-paragraph-function) 'c-fill-paragraph)
;; Initialise the cache of brace pairs, and opening braces/brackets/parens.
(c-state-cache-init)
@@ -532,22 +527,19 @@ that requires a literal mode spec at compile time."
;; Emacs.
(when (boundp 'parse-sexp-lookup-properties)
- (make-local-variable 'parse-sexp-lookup-properties)
- (setq parse-sexp-lookup-properties t))
+ (set (make-local-variable 'parse-sexp-lookup-properties) t))
;; Same as above for XEmacs.
(when (boundp 'lookup-syntax-properties)
- (make-local-variable 'lookup-syntax-properties)
- (setq lookup-syntax-properties t)))
+ (set (make-local-variable 'lookup-syntax-properties) t)))
;; Use this in Emacs 21+ to avoid meddling with the rear-nonsticky
;; property on each character.
(when (boundp 'text-property-default-nonsticky)
- (make-local-variable 'text-property-default-nonsticky)
(mapc (lambda (tprop)
(unless (assq tprop text-property-default-nonsticky)
- (setq text-property-default-nonsticky
- (cons `(,tprop . t) text-property-default-nonsticky))))
+ (set (make-local-variable 'text-property-default-nonsticky)
+ (cons `(,tprop . t) text-property-default-nonsticky))))
'(syntax-table category c-type)))
;; In Emacs 21 and later it's possible to turn off the ad-hoc
@@ -587,8 +579,7 @@ that requires a literal mode spec at compile time."
(setq c-offsets-alist (copy-alist c-offsets-alist))
;; setup the comment indent variable in a Emacs version portable way
- (make-local-variable 'comment-indent-function)
- (setq comment-indent-function 'c-comment-indent)
+ (set (make-local-variable 'comment-indent-function) 'c-comment-indent)
;; ;; Put submode indicators onto minor-mode-alist, but only once.
;; (or (assq 'c-submode-indicators minor-mode-alist)
@@ -660,16 +651,14 @@ compatible with old code; callers should always specify it."
(funcall c-before-font-lock-function (point-min) (point-max)
(- (point-max) (point-min))))))
- (make-local-variable 'outline-regexp)
- (make-local-variable 'outline-level)
- (setq outline-regexp "[^#\n\^M]"
- outline-level 'c-outline-level)
+ (set (make-local-variable 'outline-regexp) "[^#\n\^M]")
+ (set (make-local-variable 'outline-level) 'c-outline-level)
(let ((rfn (assq mode c-require-final-newline)))
(when rfn
- (make-local-variable 'require-final-newline)
(and (cdr rfn)
- (setq require-final-newline mode-require-final-newline)))))
+ (set (make-local-variable 'require-final-newline)
+ mode-require-final-newline)))))
(defun c-count-cfss (lv-alist)
;; LV-ALIST is an alist like `file-local-variables-alist'. Count how many
@@ -1100,8 +1089,7 @@ Note that the style variables are always made local to the buffer."
This does not load the font-lock package. Use after
`c-basic-common-init' and after cc-fonts has been loaded."
- (make-local-variable 'font-lock-defaults)
- (setq font-lock-defaults
+ (set (make-local-variable 'font-lock-defaults)
`(,(if (c-major-mode-is 'awk-mode)
;; awk-mode currently has only one font lock level.
'awk-font-lock-keywords
@@ -1206,7 +1194,7 @@ Key bindings:
(kill-all-local-variables)
(c-initialize-cc-mode t)
(set-syntax-table c-mode-syntax-table)
- (setq major-mode 'c-mode
+ (setq major-mode 'c-mode ; FIXME: Use define-derived-mode.
mode-name "C"
local-abbrev-table c-mode-abbrev-table
abbrev-mode t)
@@ -1269,7 +1257,7 @@ Key bindings:
(kill-all-local-variables)
(c-initialize-cc-mode t)
(set-syntax-table c++-mode-syntax-table)
- (setq major-mode 'c++-mode
+ (setq major-mode 'c++-mode ; FIXME: Use define-derived-mode.
mode-name "C++"
local-abbrev-table c++-mode-abbrev-table
abbrev-mode t)
@@ -1330,7 +1318,7 @@ Key bindings:
(kill-all-local-variables)
(c-initialize-cc-mode t)
(set-syntax-table objc-mode-syntax-table)
- (setq major-mode 'objc-mode
+ (setq major-mode 'objc-mode ; FIXME: Use define-derived-mode.
mode-name "ObjC"
local-abbrev-table objc-mode-abbrev-table
abbrev-mode t)
@@ -1400,7 +1388,7 @@ Key bindings:
(kill-all-local-variables)
(c-initialize-cc-mode t)
(set-syntax-table java-mode-syntax-table)
- (setq major-mode 'java-mode
+ (setq major-mode 'java-mode ; FIXME: Use define-derived-mode.
mode-name "Java"
local-abbrev-table java-mode-abbrev-table
abbrev-mode t)
@@ -1459,7 +1447,7 @@ Key bindings:
(kill-all-local-variables)
(c-initialize-cc-mode t)
(set-syntax-table idl-mode-syntax-table)
- (setq major-mode 'idl-mode
+ (setq major-mode 'idl-mode ; FIXME: Use define-derived-mode.
mode-name "IDL"
local-abbrev-table idl-mode-abbrev-table)
(use-local-map idl-mode-map)
@@ -1520,7 +1508,7 @@ Key bindings:
(kill-all-local-variables)
(c-initialize-cc-mode t)
(set-syntax-table pike-mode-syntax-table)
- (setq major-mode 'pike-mode
+ (setq major-mode 'pike-mode ; FIXME: Use define-derived-mode.
mode-name "Pike"
local-abbrev-table pike-mode-abbrev-table
abbrev-mode t)
@@ -1594,7 +1582,7 @@ Key bindings:
(kill-all-local-variables)
(c-initialize-cc-mode t)
(set-syntax-table awk-mode-syntax-table)
- (setq major-mode 'awk-mode
+ (setq major-mode 'awk-mode ; FIXME: Use define-derived-mode.
mode-name "AWK"
local-abbrev-table awk-mode-abbrev-table
abbrev-mode t)
@@ -1680,7 +1668,7 @@ Key bindings:
adaptive-fill-regexp)
nil)))
(mapc (lambda (var) (unless (boundp var)
- (setq vars (delq var vars))))
+ (setq vars (delq var vars))))
'(signal-error-on-buffer-boundary
filladapt-mode
defun-prompt-regexp