aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2010-12-10 15:00:25 -0500
committerStefan Monnier2010-12-10 15:00:25 -0500
commit175069efeb080517afefdd44a06f7a779ea8c25c (patch)
tree830e1af997994dd8d9b3fb3d6000810d138f9a9d
parentfe646d2c4e800f7174915b26b9fdb6252bbd0453 (diff)
downloademacs-175069efeb080517afefdd44a06f7a779ea8c25c.tar.gz
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.
-rw-r--r--lisp/ChangeLog115
-rw-r--r--lisp/progmodes/ada-mode.el91
-rw-r--r--lisp/progmodes/ada-prj.el17
-rw-r--r--lisp/progmodes/antlr-mode.el94
-rw-r--r--lisp/progmodes/asm-mode.el25
-rw-r--r--lisp/progmodes/autoconf.el11
-rw-r--r--lisp/progmodes/cc-cmds.el4
-rw-r--r--lisp/progmodes/cc-mode.el66
-rw-r--r--lisp/progmodes/cc-styles.el13
-rw-r--r--lisp/progmodes/cfengine.el1
-rw-r--r--lisp/progmodes/compile.el2
-rw-r--r--lisp/progmodes/cpp.el92
-rw-r--r--lisp/progmodes/dcl-mode.el162
-rw-r--r--lisp/progmodes/delphi.el7
-rw-r--r--lisp/progmodes/ebrowse.el127
-rw-r--r--lisp/progmodes/etags.el8
-rw-r--r--lisp/progmodes/f90.el4
-rw-r--r--lisp/progmodes/gdb-mi.el48
-rw-r--r--lisp/progmodes/gud.el8
-rw-r--r--lisp/progmodes/icon.el54
-rw-r--r--lisp/progmodes/idlw-complete-structtag.el2
-rw-r--r--lisp/progmodes/idlw-help.el9
-rw-r--r--lisp/progmodes/idlw-shell.el57
-rw-r--r--lisp/progmodes/idlw-toolbar.el14
-rw-r--r--lisp/progmodes/idlwave.el42
-rw-r--r--lisp/progmodes/inf-lisp.el13
-rw-r--r--lisp/progmodes/js.el22
-rw-r--r--lisp/progmodes/m4-mode.el27
-rw-r--r--lisp/progmodes/meta-mode.el123
-rw-r--r--lisp/progmodes/mixal-mode.el9
-rw-r--r--lisp/progmodes/modula2.el2
-rw-r--r--lisp/progmodes/octave-inf.el28
-rw-r--r--lisp/progmodes/octave-mod.el3
-rw-r--r--lisp/progmodes/perl-mode.el42
-rw-r--r--lisp/progmodes/prolog.el21
-rw-r--r--lisp/progmodes/ps-mode.el6
-rw-r--r--lisp/progmodes/python.el3
-rw-r--r--lisp/progmodes/scheme.el55
-rw-r--r--lisp/progmodes/sh-script.el19
-rw-r--r--lisp/progmodes/simula.el41
-rw-r--r--lisp/progmodes/sql.el64
-rw-r--r--lisp/progmodes/tcl.el15
-rw-r--r--lisp/progmodes/vera-mode.el13
-rw-r--r--lisp/progmodes/verilog-mode.el66
-rw-r--r--lisp/progmodes/vhdl-mode.el55
-rw-r--r--lisp/progmodes/which-func.el3
-rw-r--r--lisp/progmodes/xscheme.el43
47 files changed, 720 insertions, 1026 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 11511851447..9587fabcb5b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,120 @@
12010-12-10 Stefan Monnier <monnier@iro.umontreal.ca> 12010-12-10 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 Derive from prog-mode, use derived-mode-p, and fix up various
4 minor style issues in lisp/progmodes.
5
6 * progmodes/vhdl-mode.el (vhdl-mode):
7 * progmodes/verilog-mode.el (verilog-mode):
8 * progmodes/vera-mode.el (vera-mode):
9 * progmodes/sql.el (sql-mode):
10 * progmodes/scheme.el (scheme-mode):
11 * progmodes/perl-mode.el (perl-mode):
12 * progmodes/octave-inf.el (inferior-octave-mode):
13 * progmodes/autoconf.el (autoconf-mode):
14 * progmodes/m4-mode.el (m4-mode):
15 * progmodes/inf-lisp.el (inferior-lisp-mode):
16 * progmodes/idlwave.el (idlwave-mode):
17 * progmodes/icon.el (icon-mode):
18 * progmodes/idlw-help.el (idlwave-help-mode):
19 * progmodes/dcl-mode.el (dcl-mode):
20 * progmodes/idlw-shell.el (idlwave-shell-mode):
21 * progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode)
22 (ebrowse-member-mode, ebrowse-electric-position-mode):
23 Use define-derived-mode.
24
25 * progmodes/xscheme.el (exit-scheme-interaction-mode)
26 (xscheme-enter-interaction-mode, xscheme-enter-debugger-mode)
27 (xscheme-debugger-mode-p, xscheme-send-string-1):
28 * progmodes/tcl.el (inferior-tcl-proc, tcl-current-word)
29 (tcl-load-file, tcl-restart-with-file):
30 * progmodes/ps-mode.el (ps-run-running):
31 * progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint):
32 * progmodes/js.el (js--get-all-known-symbols):
33 * progmodes/inf-lisp.el (inferior-lisp-proc):
34 * progmodes/idlwave.el (idlwave-beginning-of-statement)
35 (idlwave-template, idlwave-update-buffer-routine-info)
36 (idlwave-update-current-buffer-info)
37 (idlwave-get-routine-info-from-buffers, idlwave-choose)
38 (idlwave-scan-class-info, idlwave-fix-keywords)
39 (idlwave-list-buffer-load-path-shadows):
40 * progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add)
41 (idlwave-toolbar-remove):
42 * progmodes/idlw-shell.el (idlwave-shell-save-and-action)
43 (idlwave-shell-file-name, idlwave-shell-electric-debug-all-off)
44 (idlwave-shell-menu-def):
45 * progmodes/idlw-complete-structtag.el
46 (idlwave-prepare-structure-tag-completion):
47 * progmodes/gud.el (gud-set-buffer):
48 * progmodes/f90.el (f90-backslash-not-special):
49 * progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
50
51 * progmodes/xscheme.el (xscheme-start)
52 (local-set-scheme-interaction-buffer, scheme-interaction-mode):
53 * progmodes/which-func.el (which-function):
54 * progmodes/vhdl-mode.el (vhdl-set-style):
55 * progmodes/verilog-mode.el (verilog-set-compile-command)
56 (verilog-modify-compile-command, verilog-error-regexp-add-xemacs)
57 (verilog-set-define, verilog-auto-reeval-locals):
58 * progmodes/sql.el (sql-product-font-lock, sql-interactive-mode):
59 * progmodes/simula.el (simula-mode):
60 * progmodes/scheme.el (scheme-mode-variables, dsssl-mode):
61 * progmodes/python.el (python-check, python-mode):
62 * progmodes/prolog.el (prolog-mode-variables):
63 * progmodes/gud.el (gud-tooltip-activate-mouse-motions):
64 * progmodes/ebrowse.el (ebrowse-view-file-other-frame):
65 * progmodes/delphi.el (delphi-mode):
66 * progmodes/cc-styles.el (c-setup-paragraph-variables):
67 * progmodes/cc-mode.el (c-basic-common-init, c-common-init)
68 (c-font-lock-init): Move make-local-variable to their setq.
69
70 * progmodes/vhdl-mode.el (vhdl-write-file-hooks-init)
71 (vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable ->
72 make-local-hook.
73 * progmodes/sh-script.el (sh-require-final-newline): Remove.
74 (sh-set-shell): Don't set require-final-newline since it's already done
75 by prog-mode.
76 * progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column
77 since we never set it.
78 * progmodes/ebrowse.el (ebrowse-set-tree-indentation):
79 Use read-string and standard prompt.
80 * progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration.
81 * progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl.
82 (meta-common-mode-syntax-table): Rename from meta-mode-syntax-table.
83 (meta-common-mode-map): Rename from meta-mode-map.
84 Remove C-m binding, which is a user preference, not mode specific.
85 (meta-common-mode): New major mode; replace meta-common-initialization.
86 * progmodes/js.el (js-mode): Call syntax-propertize rather than messing
87 around with font-lock.
88 * progmodes/etags.el (select-tags-table-mode):
89 Derive from special-mode.
90 * progmodes/octave-mod.el (octave-mode):
91 * progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode)
92 (gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode)
93 (gdb-frames-mode, gdb-locals-mode, gdb-registers-mode):
94 Let define-derived-mode do its job.
95 * progmodes/cpp.el (cpp-edit-mode-map):
96 Move initialization into declaration.
97 (cpp-edit-mode): Use define-derived-mode.
98 (cpp-edit-load): Use derived-mode-p.
99 * progmodes/mixal-mode.el (mixal-mode):
100 * progmodes/f90.el (f90-mode):
101 * progmodes/cfengine.el (cfengine-mode): Don't bother setting
102 require-final-newline since prog-mode does it already.
103 * progmodes/cc-cmds.el (c-update-modeline): Use match-string.
104 * progmodes/asm-mode.el (asm-mode-map): Fix menu setup.
105 * progmodes/antlr-mode.el: Require cc-mode upfront.
106 (antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in
107 the declaration.
108 (antlr-directory-dependencies, antlr-show-makefile-rules):
109 Use derived-mode-p.
110 (antlr-language-option): Don't assume point-min==1.
111 (antlr-mode): Use define-derived-mode.
112 * progmodes/ada-mode.el: Use derived-mode-p.
113 (ada-mode): Use define-derived-mode.
114 Use hack-local-variables-hook.
115
1162010-12-10 Stefan Monnier <monnier@iro.umontreal.ca>
117
3 * textmodes/texinfo.el (texinfo-mode-map): Bind texinfo-insert-@end. 118 * textmodes/texinfo.el (texinfo-mode-map): Bind texinfo-insert-@end.
4 (texinfo-mode): Don't disable adaptive-fill-mode. 119 (texinfo-mode): Don't disable adaptive-fill-mode.
5 (texinfo-insert-block): Adjust cursor placement for blocks with arg. 120 (texinfo-insert-block): Adjust cursor placement for blocks with arg.
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el
index fe97b1e8a57..b45c4b1eb7e 100644
--- a/lisp/progmodes/ada-mode.el
+++ b/lisp/progmodes/ada-mode.el
@@ -461,6 +461,7 @@ The extensions should include a `.' if needed.")
461 461
462(defvar ada-mode-abbrev-table nil 462(defvar ada-mode-abbrev-table nil
463 "Local abbrev table for Ada mode.") 463 "Local abbrev table for Ada mode.")
464(define-abbrev-table 'ada-mode-abbrev-table ())
464 465
465(defvar ada-mode-syntax-table nil 466(defvar ada-mode-syntax-table nil
466 "Syntax table to be used for editing Ada source code.") 467 "Syntax table to be used for editing Ada source code.")
@@ -1123,16 +1124,8 @@ the file name."
1123(defvar ada-font-lock-syntactic-keywords) ; defined below 1124(defvar ada-font-lock-syntactic-keywords) ; defined below
1124 1125
1125;;;###autoload 1126;;;###autoload
1126(defun ada-mode () 1127(define-derived-mode ada-mode prog-mode "Ada"
1127 "Ada mode is the major mode for editing Ada code. 1128 "Ada mode is the major mode for editing Ada code."
1128\\{ada-mode-map}"
1129
1130 (interactive)
1131 (kill-all-local-variables)
1132
1133 (set-syntax-table ada-mode-syntax-table)
1134
1135 (set (make-local-variable 'require-final-newline) mode-require-final-newline)
1136 1129
1137 ;; Set the paragraph delimiters so that one can select a whole block 1130 ;; Set the paragraph delimiters so that one can select a whole block
1138 ;; simply with M-h 1131 ;; simply with M-h
@@ -1303,64 +1296,54 @@ the file name."
1303 (define-key ada-mode-map ada-popup-key 'ada-popup-menu)) 1296 (define-key ada-mode-map ada-popup-key 'ada-popup-menu))
1304 1297
1305 ;; Support for Abbreviations (the user still need to "M-x abbrev-mode" 1298 ;; Support for Abbreviations (the user still need to "M-x abbrev-mode"
1306 (define-abbrev-table 'ada-mode-abbrev-table ())
1307 (setq local-abbrev-table ada-mode-abbrev-table) 1299 (setq local-abbrev-table ada-mode-abbrev-table)
1308 1300
1309 ;; Support for which-function mode 1301 ;; Support for which-function mode
1310 (make-local-variable 'which-func-functions) 1302 (set (make-local-variable 'which-func-functions) '(ada-which-function))
1311 (setq which-func-functions '(ada-which-function))
1312 1303
1313 ;; Support for indent-new-comment-line (Especially for XEmacs) 1304 ;; Support for indent-new-comment-line (Especially for XEmacs)
1314 (set (make-local-variable 'comment-multi-line) nil) 1305 (set (make-local-variable 'comment-multi-line) nil)
1315 1306
1316 ;; Support for add-log 1307 ;; Support for add-log
1317 (set (make-local-variable 'add-log-current-defun-function) 'ada-which-function) 1308 (set (make-local-variable 'add-log-current-defun-function)
1318 1309 'ada-which-function)
1319 (setq major-mode 'ada-mode
1320 mode-name "Ada")
1321
1322 (use-local-map ada-mode-map)
1323 1310
1324 (easy-menu-add ada-mode-menu ada-mode-map) 1311 (easy-menu-add ada-mode-menu ada-mode-map)
1325 1312
1326 (set-syntax-table ada-mode-syntax-table)
1327
1328 (set (make-local-variable 'skeleton-further-elements) 1313 (set (make-local-variable 'skeleton-further-elements)
1329 '((< '(backward-delete-char-untabify 1314 '((< '(backward-delete-char-untabify
1330 (min ada-indent (current-column)))))) 1315 (min ada-indent (current-column))))))
1331 (add-hook 'skeleton-end-hook 'ada-adjust-case-skeleton nil t) 1316 (add-hook 'skeleton-end-hook 'ada-adjust-case-skeleton nil t)
1332 1317
1333 (run-mode-hooks 'ada-mode-hook)
1334
1335 ;; To be run after the hook, in case the user modified 1318 ;; To be run after the hook, in case the user modified
1336 ;; ada-fill-comment-prefix 1319 ;; ada-fill-comment-prefix
1337 ;; FIXME: if the user modified ada-fill-comment-prefix in his .emacs 1320 (add-hook 'hack-local-variables-hook
1338 ;; then it was already available before running the hook, and if he 1321 (lambda ()
1339 ;; modifies it in the hook, he might as well modify comment-start instead. 1322 (set (make-local-variable 'comment-start)
1340 (set (make-local-variable 'comment-start) (or ada-fill-comment-prefix "-- ")) 1323 (or ada-fill-comment-prefix "-- "))
1341 1324
1342 ;; Run this after the hook to give the users a chance to activate 1325 ;; Run this after the hook to give the users a chance
1343 ;; font-lock-mode 1326 ;; to activate font-lock-mode.
1344 1327
1345 (unless (or (eval-when-compile (fboundp 'syntax-propertize-via-font-lock)) 1328 (unless (or (eval-when-compile (fboundp 'syntax-propertize-via-font-lock))
1346 (featurep 'xemacs)) 1329 (featurep 'xemacs))
1347 (ada-initialize-syntax-table-properties) 1330 (ada-initialize-syntax-table-properties)
1348 (add-hook 'font-lock-mode-hook 'ada-handle-syntax-table-properties nil t)) 1331 (add-hook 'font-lock-mode-hook
1349 1332 'ada-handle-syntax-table-properties nil t))
1350 ;; the following has to be done after running the ada-mode-hook 1333
1351 ;; because users might want to set the values of these variable 1334 ;; FIXME: ada-language-version might be set in the mode
1352 ;; inside the hook 1335 ;; hook or it might even be set later on via file-local
1353 ;; FIXME: it might even be set later on via file-local vars, no? 1336 ;; vars, so ada-keywords should be set lazily.
1354 ;; so maybe ada-keywords should be set lazily. 1337 (cond ((eq ada-language-version 'ada83)
1355 (cond ((eq ada-language-version 'ada83) 1338 (setq ada-keywords ada-83-keywords))
1356 (setq ada-keywords ada-83-keywords)) 1339 ((eq ada-language-version 'ada95)
1357 ((eq ada-language-version 'ada95) 1340 (setq ada-keywords ada-95-keywords))
1358 (setq ada-keywords ada-95-keywords)) 1341 ((eq ada-language-version 'ada2005)
1359 ((eq ada-language-version 'ada2005) 1342 (setq ada-keywords ada-2005-keywords)))
1360 (setq ada-keywords ada-2005-keywords))) 1343
1361 1344 (if ada-auto-case
1362 (if ada-auto-case 1345 (ada-activate-keys-for-case)))
1363 (ada-activate-keys-for-case))) 1346 nil 'local))
1364 1347
1365(defun ada-adjust-case-skeleton () 1348(defun ada-adjust-case-skeleton ()
1366 "Adjust the case of the text inserted by a skeleton." 1349 "Adjust the case of the text inserted by a skeleton."
@@ -4632,7 +4615,7 @@ Moves to 'begin' if in a declarative part."
4632 ["Gdb Documentation" (info "gdb") 4615 ["Gdb Documentation" (info "gdb")
4633 (eq ada-which-compiler 'gnat)] 4616 (eq ada-which-compiler 'gnat)]
4634 ["Ada95 Reference Manual" (info "arm95") t]) 4617 ["Ada95 Reference Manual" (info "arm95") t])
4635 ("Options" :included (eq major-mode 'ada-mode) 4618 ("Options" :included (derived-mode-p 'ada-mode)
4636 ["Auto Casing" (setq ada-auto-case (not ada-auto-case)) 4619 ["Auto Casing" (setq ada-auto-case (not ada-auto-case))
4637 :style toggle :selected ada-auto-case] 4620 :style toggle :selected ada-auto-case]
4638 ["Auto Indent After Return" 4621 ["Auto Indent After Return"
@@ -4669,7 +4652,7 @@ Moves to 'begin' if in a declarative part."
4669 ["Load..." ada-set-default-project-file t] 4652 ["Load..." ada-set-default-project-file t]
4670 ["New..." ada-prj-new t] 4653 ["New..." ada-prj-new t]
4671 ["Edit..." ada-prj-edit t]) 4654 ["Edit..." ada-prj-edit t])
4672 ("Goto" :included (eq major-mode 'ada-mode) 4655 ("Goto" :included (derived-mode-p 'ada-mode)
4673 ["Goto Declaration/Body" ada-goto-declaration 4656 ["Goto Declaration/Body" ada-goto-declaration
4674 (eq ada-which-compiler 'gnat)] 4657 (eq ada-which-compiler 'gnat)]
4675 ["Goto Body" ada-goto-body 4658 ["Goto Body" ada-goto-body
@@ -4698,7 +4681,7 @@ Moves to 'begin' if in a declarative part."
4698 ["-" nil nil] 4681 ["-" nil nil]
4699 ["Other File" ff-find-other-file t] 4682 ["Other File" ff-find-other-file t]
4700 ["Other File Other Window" ada-ff-other-window t]) 4683 ["Other File Other Window" ada-ff-other-window t])
4701 ("Edit" :included (eq major-mode 'ada-mode) 4684 ("Edit" :included (derived-mode-p 'ada-mode)
4702 ["Search File On Source Path" ada-find-file t] 4685 ["Search File On Source Path" ada-find-file t]
4703 ["------" nil nil] 4686 ["------" nil nil]
4704 ["Complete Identifier" ada-complete-identifier t] 4687 ["Complete Identifier" ada-complete-identifier t]
@@ -4730,7 +4713,7 @@ Moves to 'begin' if in a declarative part."
4730 ["-----" nil nil] 4713 ["-----" nil nil]
4731 ["Narrow to subprogram" ada-narrow-to-defun t]) 4714 ["Narrow to subprogram" ada-narrow-to-defun t])
4732 ("Templates" 4715 ("Templates"
4733 :included (eq major-mode 'ada-mode) 4716 :included (derived-mode-p 'ada-mode)
4734 ["Header" ada-header t] 4717 ["Header" ada-header t]
4735 ["-" nil nil] 4718 ["-" nil nil]
4736 ["Package Body" ada-package-body t] 4719 ["Package Body" ada-package-body t]
diff --git a/lisp/progmodes/ada-prj.el b/lisp/progmodes/ada-prj.el
index c726c06d1d3..3d10e482be1 100644
--- a/lisp/progmodes/ada-prj.el
+++ b/lisp/progmodes/ada-prj.el
@@ -514,11 +514,18 @@ If FILENAME is given, edit that file."
514 514
515 (set (make-local-variable 'ada-prj-ada-buffer) ada-buffer) 515 (set (make-local-variable 'ada-prj-ada-buffer) ada-buffer)
516 516
517 (use-local-map (copy-keymap custom-mode-map)) 517 (use-local-map
518 (local-set-key "\C-x\C-s" 'ada-prj-save) 518 (let ((map (make-sparse-keymap)))
519 519 (set-keymap-parent map custom-mode-map)
520 (make-local-variable 'widget-keymap) 520 (define-key map "\C-x\C-s" 'ada-prj-save)
521 (define-key widget-keymap "\C-x\C-s" 'ada-prj-save) 521 map))
522
523 ;; FIXME: Not sure if this works!!
524 (set (make-local-variable 'widget-keymap)
525 (let ((map (make-sparse-keymap)))
526 (set-keymap-parent map widget-keymap)
527 (define-key map "\C-x\C-s" 'ada-prj-save)
528 map))
522 529
523 (set (make-local-variable 'ada-old-cross-prefix) 530 (set (make-local-variable 'ada-old-cross-prefix)
524 (ada-xref-get-project-field 'cross-prefix)) 531 (ada-xref-get-project-field 'cross-prefix))
diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el
index 742bcf726eb..3e3e315c500 100644
--- a/lisp/progmodes/antlr-mode.el
+++ b/lisp/progmodes/antlr-mode.el
@@ -87,6 +87,7 @@
87 (require 'cl)) 87 (require 'cl))
88 88
89(require 'easymenu) 89(require 'easymenu)
90(require 'cc-mode)
90 91
91;; Just to get the rid of the byte compiler warning. The code for 92;; Just to get the rid of the byte compiler warning. The code for
92;; this function and its friends are too complex for their own good. 93;; this function and its friends are too complex for their own good.
@@ -1004,12 +1005,21 @@ The SYNTAX-ALIST element is also used to initialize
1004(defvar antlr-mode-hook nil 1005(defvar antlr-mode-hook nil
1005 "Hook called by `antlr-mode'.") 1006 "Hook called by `antlr-mode'.")
1006 1007
1007(defvar antlr-mode-syntax-table nil 1008(defvar antlr-mode-syntax-table
1009 (let ((st (make-syntax-table)))
1010 (c-populate-syntax-table st)
1011 st)
1008 "Syntax table used in `antlr-mode' buffers. 1012 "Syntax table used in `antlr-mode' buffers.
1009If non-nil, it will be initialized in `antlr-mode'.") 1013If non-nil, it will be initialized in `antlr-mode'.")
1010 1014
1011;; used for "in Java/C++ code" = syntactic-depth>0 1015;; used for "in Java/C++ code" = syntactic-depth>0
1012(defvar antlr-action-syntax-table nil 1016(defvar antlr-action-syntax-table
1017 (let ((st (copy-syntax-table antlr-mode-syntax-table))
1018 (slist (nth 3 antlr-font-lock-defaults)))
1019 (while slist
1020 (modify-syntax-entry (caar slist) (cdar slist) st)
1021 (setq slist (cdr slist)))
1022 st)
1013 "Syntax table used for ANTLR action parsing. 1023 "Syntax table used for ANTLR action parsing.
1014Initialized by `antlr-mode-syntax-table', changed by SYNTAX-ALIST in 1024Initialized by `antlr-mode-syntax-table', changed by SYNTAX-ALIST in
1015`antlr-font-lock-defaults'. This table should be selected if you use 1025`antlr-font-lock-defaults'. This table should be selected if you use
@@ -2189,7 +2199,7 @@ export vocabulary specified in that file."
2189 (insert-file-contents file t nil nil t) 2199 (insert-file-contents file t nil nil t)
2190 (normal-mode t) ; necessary for major-mode, syntax 2200 (normal-mode t) ; necessary for major-mode, syntax
2191 ; table and `antlr-language' 2201 ; table and `antlr-language'
2192 (when (eq major-mode 'antlr-mode) 2202 (when (derived-mode-p 'antlr-mode)
2193 (let* ((file-deps (antlr-file-dependencies)) 2203 (let* ((file-deps (antlr-file-dependencies))
2194 (file (car file-deps))) 2204 (file (car file-deps)))
2195 (when file-deps 2205 (when file-deps
@@ -2373,7 +2383,7 @@ are used according to variable `antlr-unknown-file-formats' and a
2373commentary with value `antlr-help-unknown-file-text' is added. The 2383commentary with value `antlr-help-unknown-file-text' is added. The
2374*Help* buffer always starts with the text in `antlr-help-rules-intro'." 2384*Help* buffer always starts with the text in `antlr-help-rules-intro'."
2375 (interactive) 2385 (interactive)
2376 (if (null (eq major-mode 'makefile-mode)) 2386 (if (null (derived-mode-p 'makefile-mode))
2377 (antlr-with-displaying-help-buffer 'antlr-insert-makefile-rules) 2387 (antlr-with-displaying-help-buffer 'antlr-insert-makefile-rules)
2378 (push-mark) 2388 (push-mark)
2379 (antlr-insert-makefile-rules t))) 2389 (antlr-insert-makefile-rules t)))
@@ -2563,13 +2573,15 @@ ANTLR's syntax and influences the auto indentation, see
2563 "Find language in `antlr-language-alist' for language option. 2573 "Find language in `antlr-language-alist' for language option.
2564If SEARCH is non-nil, find element for language option. Otherwise, find 2574If SEARCH is non-nil, find element for language option. Otherwise, find
2565the default language." 2575the default language."
2566 (let ((value (and search 2576 (let ((value
2567 (save-excursion 2577 (and search
2568 (goto-char (point-min)) 2578 (save-excursion
2569 (re-search-forward (cdr antlr-language-limit-n-regexp) 2579 (goto-char (point-min))
2570 (car antlr-language-limit-n-regexp) 2580 (re-search-forward (cdr antlr-language-limit-n-regexp)
2571 t)) 2581 (+ (point)
2572 (match-string 1))) 2582 (car antlr-language-limit-n-regexp))
2583 t))
2584 (match-string 1)))
2573 (seq antlr-language-alist) 2585 (seq antlr-language-alist)
2574 r) 2586 r)
2575 ;; Like (find VALUE antlr-language-alist :key 'cddr :test 'member) 2587 ;; Like (find VALUE antlr-language-alist :key 'cddr :test 'member)
@@ -2581,35 +2593,20 @@ the default language."
2581 (car r))) 2593 (car r)))
2582 2594
2583;;;###autoload 2595;;;###autoload
2584(defun antlr-mode () 2596(define-derived-mode antlr-mode prog-mode
2585 "Major mode for editing ANTLR grammar files. 2597 ;; FIXME: Since it uses cc-mode, it bumps into c-update-modeline's
2586\\{antlr-mode-map}" 2598 ;; limitation to mode-name being a string.
2587 (interactive) 2599 ;; '("Antlr." (:eval (cadr (assq antlr-language antlr-language-alist))))
2588 (kill-all-local-variables) 2600 "Antlr"
2601 "Major mode for editing ANTLR grammar files."
2602 :abbrev-table antlr-mode-abbrev-table
2589 (c-initialize-cc-mode) ; cc-mode is required 2603 (c-initialize-cc-mode) ; cc-mode is required
2590 (unless (fboundp 'c-forward-sws) ; see above 2604 (unless (fboundp 'c-forward-sws) ; see above
2591 (fset 'antlr-c-forward-sws 'c-forward-syntactic-ws)) 2605 (fset 'antlr-c-forward-sws 'c-forward-syntactic-ws))
2592 ;; ANTLR specific ---------------------------------------------------------- 2606 ;; ANTLR specific ----------------------------------------------------------
2593 (setq major-mode 'antlr-mode
2594 mode-name "Antlr")
2595 (setq local-abbrev-table antlr-mode-abbrev-table)
2596 (unless antlr-mode-syntax-table
2597 (setq antlr-mode-syntax-table (make-syntax-table))
2598 (c-populate-syntax-table antlr-mode-syntax-table))
2599 (set-syntax-table antlr-mode-syntax-table)
2600 (unless antlr-action-syntax-table
2601 (let ((slist (nth 3 antlr-font-lock-defaults)))
2602 (setq antlr-action-syntax-table
2603 (copy-syntax-table antlr-mode-syntax-table))
2604 (while slist
2605 (modify-syntax-entry (caar slist) (cdar slist)
2606 antlr-action-syntax-table)
2607 (setq slist (cdr slist)))))
2608 (use-local-map antlr-mode-map)
2609 (make-local-variable 'antlr-language)
2610 (unless antlr-language 2607 (unless antlr-language
2611 (setq antlr-language 2608 (set (make-local-variable 'antlr-language)
2612 (or (antlr-language-option t) (antlr-language-option nil)))) 2609 (or (antlr-language-option t) (antlr-language-option nil))))
2613 (if (stringp (cadr (assq antlr-language antlr-language-alist))) 2610 (if (stringp (cadr (assq antlr-language antlr-language-alist)))
2614 (setq mode-name 2611 (setq mode-name
2615 (concat "Antlr." 2612 (concat "Antlr."
@@ -2627,33 +2624,24 @@ the default language."
2627 (t ; cc-mode upto 5.28 2624 (t ; cc-mode upto 5.28
2628 (antlr-c-init-language-vars))) ; do it myself 2625 (antlr-c-init-language-vars))) ; do it myself
2629 (c-basic-common-init antlr-language (or antlr-indent-style "gnu")) 2626 (c-basic-common-init antlr-language (or antlr-indent-style "gnu"))
2630 (make-local-variable 'outline-regexp) 2627 (set (make-local-variable 'outline-regexp) "[^#\n\^M]")
2631 (make-local-variable 'outline-level) 2628 (set (make-local-variable 'outline-level) 'c-outline-level) ;TODO: define own
2632 (make-local-variable 'require-final-newline) 2629 (set (make-local-variable 'indent-line-function) 'antlr-indent-line)
2633 (make-local-variable 'indent-line-function) 2630 (set (make-local-variable 'indent-region-function) nil) ; too lazy
2634 (make-local-variable 'indent-region-function)
2635 (setq outline-regexp "[^#\n\^M]"
2636 outline-level 'c-outline-level) ; TODO: define own
2637 (setq require-final-newline mode-require-final-newline)
2638 (setq indent-line-function 'antlr-indent-line
2639 indent-region-function nil) ; too lazy
2640 (setq comment-start "// " 2631 (setq comment-start "// "
2641 comment-end "" 2632 comment-end ""
2642 comment-start-skip "/\\*+ *\\|// *") 2633 comment-start-skip "/\\*+ *\\|// *")
2643 ;; various ----------------------------------------------------------------- 2634 ;; various -----------------------------------------------------------------
2644 (make-local-variable 'font-lock-defaults) 2635 (set (make-local-variable 'font-lock-defaults) antlr-font-lock-defaults)
2645 (setq font-lock-defaults antlr-font-lock-defaults)
2646 (easy-menu-add antlr-mode-menu) 2636 (easy-menu-add antlr-mode-menu)
2647 (make-local-variable 'imenu-create-index-function) 2637 (set (make-local-variable 'imenu-create-index-function)
2648 (setq imenu-create-index-function 'antlr-imenu-create-index-function) 2638 'antlr-imenu-create-index-function)
2649 (make-local-variable 'imenu-generic-expression) 2639 (set (make-local-variable 'imenu-generic-expression) t) ; fool stupid test
2650 (setq imenu-generic-expression t) ; fool stupid test
2651 (and antlr-imenu-name ; there should be a global variable... 2640 (and antlr-imenu-name ; there should be a global variable...
2652 (fboundp 'imenu-add-to-menubar) 2641 (fboundp 'imenu-add-to-menubar)
2653 (imenu-add-to-menubar 2642 (imenu-add-to-menubar
2654 (if (stringp antlr-imenu-name) antlr-imenu-name "Index"))) 2643 (if (stringp antlr-imenu-name) antlr-imenu-name "Index")))
2655 (antlr-set-tabs) 2644 (antlr-set-tabs))
2656 (run-mode-hooks 'antlr-mode-hook))
2657 2645
2658;; A smarter version of `group-buffers-menu-by-mode-then-alphabetically' (in 2646;; A smarter version of `group-buffers-menu-by-mode-then-alphabetically' (in
2659;; XEmacs) could use the following property. The header of the submenu would 2647;; XEmacs) could use the following property. The header of the submenu would
diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el
index f5fef76a009..12179e8f9b8 100644
--- a/lisp/progmodes/asm-mode.el
+++ b/lisp/progmodes/asm-mode.el
@@ -77,15 +77,14 @@
77 (define-key map "\C-c;" 'comment-region) 77 (define-key map "\C-c;" 'comment-region)
78 (define-key map "\C-j" 'newline-and-indent) 78 (define-key map "\C-j" 'newline-and-indent)
79 (define-key map "\C-m" 'newline-and-indent) 79 (define-key map "\C-m" 'newline-and-indent)
80 (define-key map [menu-bar] (make-sparse-keymap)) 80 (define-key map [menu-bar asm-mode] (cons "Asm" (make-sparse-keymap)))
81 (define-key map [menu-bar asm-mode] (cons "Asm" map)) 81 (define-key map [menu-bar asm-mode comment-region]
82 (define-key map [comment-region]
83 '(menu-item "Comment Region" comment-region 82 '(menu-item "Comment Region" comment-region
84 :help "Comment or uncomment each line in the region")) 83 :help "Comment or uncomment each line in the region"))
85 (define-key map [newline-and-indent] 84 (define-key map [menu-bar asm-mode newline-and-indent]
86 '(menu-item "Insert Newline and Indent" newline-and-indent 85 '(menu-item "Insert Newline and Indent" newline-and-indent
87 :help "Insert a newline, then indent according to major mode")) 86 :help "Insert a newline, then indent according to major mode"))
88 (define-key map [asm-colon] 87 (define-key map [menu-bar asm-mode asm-colon]
89 '(menu-item "Insert Colon" asm-colon 88 '(menu-item "Insert Colon" asm-colon
90 :help "Insert a colon; if it follows a label, delete the label's indentation")) 89 :help "Insert a colon; if it follows a label, delete the label's indentation"))
91 map) 90 map)
@@ -142,16 +141,12 @@ Special commands:
142 (set-syntax-table (make-syntax-table asm-mode-syntax-table)) 141 (set-syntax-table (make-syntax-table asm-mode-syntax-table))
143 (modify-syntax-entry asm-comment-char "< b") 142 (modify-syntax-entry asm-comment-char "< b")
144 143
145 (make-local-variable 'comment-start) 144 (set (make-local-variable 'comment-start) (string asm-comment-char))
146 (setq comment-start (string asm-comment-char)) 145 (set (make-local-variable 'comment-add) 1)
147 (make-local-variable 'comment-add) 146 (set (make-local-variable 'comment-start-skip)
148 (setq comment-add 1) 147 "\\(?:\\s<+\\|/[/*]+\\)[ \t]*")
149 (make-local-variable 'comment-start-skip) 148 (set (make-local-variable 'comment-end-skip) "[ \t]*\\(\\s>\\|\\*+/\\)")
150 (setq comment-start-skip "\\(?:\\s<+\\|/[/*]+\\)[ \t]*") 149 (set (make-local-variable 'comment-end) "")
151 (make-local-variable 'comment-end-skip)
152 (setq comment-end-skip "[ \t]*\\(\\s>\\|\\*+/\\)")
153 (make-local-variable 'comment-end)
154 (setq comment-end "")
155 (setq fill-prefix "\t")) 150 (setq fill-prefix "\t"))
156 151
157(defun asm-indent-line () 152(defun asm-indent-line ()
diff --git a/lisp/progmodes/autoconf.el b/lisp/progmodes/autoconf.el
index 004bb3de78d..827949cc70e 100644
--- a/lisp/progmodes/autoconf.el
+++ b/lisp/progmodes/autoconf.el
@@ -78,14 +78,8 @@ searching backwards at another AC_... command."
78 (match-string-no-properties 3))))) 78 (match-string-no-properties 3)))))
79 79
80;;;###autoload 80;;;###autoload
81(defun autoconf-mode () 81(define-derived-mode autoconf-mode prog-mode "Autoconf"
82 "Major mode for editing Autoconf configure.in files." 82 "Major mode for editing Autoconf configure.in files."
83 (interactive)
84 (kill-all-local-variables)
85 (use-local-map autoconf-mode-map)
86 (setq major-mode 'autoconf-mode)
87 (setq mode-name "Autoconf")
88 (set-syntax-table autoconf-mode-syntax-table)
89 (set (make-local-variable 'parens-require-spaces) nil) ; for M4 arg lists 83 (set (make-local-variable 'parens-require-spaces) nil) ; for M4 arg lists
90 (set (make-local-variable 'defun-prompt-regexp) 84 (set (make-local-variable 'defun-prompt-regexp)
91 "^[ \t]*A[CM]_\\(\\sw\\|\\s_\\)+") 85 "^[ \t]*A[CM]_\\(\\sw\\|\\s_\\)+")
@@ -100,8 +94,7 @@ searching backwards at another AC_... command."
100 (set (make-local-variable 'imenu-syntax-alist) '(("_" . "w"))) 94 (set (make-local-variable 'imenu-syntax-alist) '(("_" . "w")))
101 (set (make-local-variable 'indent-line-function) #'indent-relative) 95 (set (make-local-variable 'indent-line-function) #'indent-relative)
102 (set (make-local-variable 'add-log-current-defun-function) 96 (set (make-local-variable 'add-log-current-defun-function)
103 #'autoconf-current-defun-function) 97 #'autoconf-current-defun-function))
104 (run-mode-hooks 'autoconf-mode-hook))
105 98
106(provide 'autoconf-mode) 99(provide 'autoconf-mode)
107(provide 'autoconf) 100(provide 'autoconf)
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 112fa50ce8f..8639ebba3bc 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -266,8 +266,10 @@ With universal argument, inserts the analysis as a comment on that line."
266 (symbol-value 'subword-mode)) 266 (symbol-value 'subword-mode))
267 "w" 267 "w"
268 ""))) 268 "")))
269 ;; FIXME: Derived modes might want to use something else
270 ;; than a string for `mode-name'.
269 (bare-mode-name (if (string-match "\\(^[^/]*\\)/" mode-name) 271 (bare-mode-name (if (string-match "\\(^[^/]*\\)/" mode-name)
270 (substring mode-name (match-beginning 1) (match-end 1)) 272 (match-string 1 mode-name)
271 mode-name))) 273 mode-name)))
272;; (setq c-submode-indicators 274;; (setq c-submode-indicators
273;; (if (> (length fmt) 1) 275;; (if (> (length fmt) 1)
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."
487 487
488 ;; these variables should always be buffer local; they do not affect 488 ;; these variables should always be buffer local; they do not affect
489 ;; indentation style. 489 ;; indentation style.
490 (make-local-variable 'parse-sexp-ignore-comments)
491 (make-local-variable 'indent-line-function)
492 (make-local-variable 'indent-region-function)
493 (make-local-variable 'normal-auto-fill-function)
494 (make-local-variable 'comment-start) 490 (make-local-variable 'comment-start)
495 (make-local-variable 'comment-end) 491 (make-local-variable 'comment-end)
496 (make-local-variable 'comment-start-skip) 492 (make-local-variable 'comment-start-skip)
497 (make-local-variable 'comment-multi-line) 493
498 (make-local-variable 'comment-line-break-function)
499 (make-local-variable 'paragraph-start) 494 (make-local-variable 'paragraph-start)
500 (make-local-variable 'paragraph-separate) 495 (make-local-variable 'paragraph-separate)
501 (make-local-variable 'paragraph-ignore-fill-prefix) 496 (make-local-variable 'paragraph-ignore-fill-prefix)
@@ -503,18 +498,18 @@ that requires a literal mode spec at compile time."
503 (make-local-variable 'adaptive-fill-regexp) 498 (make-local-variable 'adaptive-fill-regexp)
504 499
505 ;; now set their values 500 ;; now set their values
506 (setq parse-sexp-ignore-comments t 501 (set (make-local-variable 'parse-sexp-ignore-comments) t)
507 indent-line-function 'c-indent-line 502 (set (make-local-variable 'indent-line-function) 'c-indent-line)
508 indent-region-function 'c-indent-region 503 (set (make-local-variable 'indent-region-function) 'c-indent-region)
509 normal-auto-fill-function 'c-do-auto-fill 504 (set (make-local-variable 'normal-auto-fill-function) 'c-do-auto-fill)
510 comment-multi-line t 505 (set (make-local-variable 'comment-multi-line) t)
511 comment-line-break-function 'c-indent-new-comment-line) 506 (set (make-local-variable 'comment-line-break-function)
507 'c-indent-new-comment-line)
512 508
513 ;; Install `c-fill-paragraph' on `fill-paragraph-function' so that a 509 ;; Install `c-fill-paragraph' on `fill-paragraph-function' so that a
514 ;; direct call to `fill-paragraph' behaves better. This still 510 ;; direct call to `fill-paragraph' behaves better. This still
515 ;; doesn't work with filladapt but it's better than nothing. 511 ;; doesn't work with filladapt but it's better than nothing.
516 (make-local-variable 'fill-paragraph-function) 512 (set (make-local-variable 'fill-paragraph-function) 'c-fill-paragraph)
517 (setq fill-paragraph-function 'c-fill-paragraph)
518 513
519 ;; Initialise the cache of brace pairs, and opening braces/brackets/parens. 514 ;; Initialise the cache of brace pairs, and opening braces/brackets/parens.
520 (c-state-cache-init) 515 (c-state-cache-init)
@@ -532,22 +527,19 @@ that requires a literal mode spec at compile time."
532 527
533 ;; Emacs. 528 ;; Emacs.
534 (when (boundp 'parse-sexp-lookup-properties) 529 (when (boundp 'parse-sexp-lookup-properties)
535 (make-local-variable 'parse-sexp-lookup-properties) 530 (set (make-local-variable 'parse-sexp-lookup-properties) t))
536 (setq parse-sexp-lookup-properties t))
537 531
538 ;; Same as above for XEmacs. 532 ;; Same as above for XEmacs.
539 (when (boundp 'lookup-syntax-properties) 533 (when (boundp 'lookup-syntax-properties)
540 (make-local-variable 'lookup-syntax-properties) 534 (set (make-local-variable 'lookup-syntax-properties) t)))
541 (setq lookup-syntax-properties t)))
542 535
543 ;; Use this in Emacs 21+ to avoid meddling with the rear-nonsticky 536 ;; Use this in Emacs 21+ to avoid meddling with the rear-nonsticky
544 ;; property on each character. 537 ;; property on each character.
545 (when (boundp 'text-property-default-nonsticky) 538 (when (boundp 'text-property-default-nonsticky)
546 (make-local-variable 'text-property-default-nonsticky)
547 (mapc (lambda (tprop) 539 (mapc (lambda (tprop)
548 (unless (assq tprop text-property-default-nonsticky) 540 (unless (assq tprop text-property-default-nonsticky)
549 (setq text-property-default-nonsticky 541 (set (make-local-variable 'text-property-default-nonsticky)
550 (cons `(,tprop . t) text-property-default-nonsticky)))) 542 (cons `(,tprop . t) text-property-default-nonsticky))))
551 '(syntax-table category c-type))) 543 '(syntax-table category c-type)))
552 544
553 ;; In Emacs 21 and later it's possible to turn off the ad-hoc 545 ;; 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."
587 (setq c-offsets-alist (copy-alist c-offsets-alist)) 579 (setq c-offsets-alist (copy-alist c-offsets-alist))
588 580
589 ;; setup the comment indent variable in a Emacs version portable way 581 ;; setup the comment indent variable in a Emacs version portable way
590 (make-local-variable 'comment-indent-function) 582 (set (make-local-variable 'comment-indent-function) 'c-comment-indent)
591 (setq comment-indent-function 'c-comment-indent)
592 583
593;; ;; Put submode indicators onto minor-mode-alist, but only once. 584;; ;; Put submode indicators onto minor-mode-alist, but only once.
594;; (or (assq 'c-submode-indicators minor-mode-alist) 585;; (or (assq 'c-submode-indicators minor-mode-alist)
@@ -660,16 +651,14 @@ compatible with old code; callers should always specify it."
660 (funcall c-before-font-lock-function (point-min) (point-max) 651 (funcall c-before-font-lock-function (point-min) (point-max)
661 (- (point-max) (point-min)))))) 652 (- (point-max) (point-min))))))
662 653
663 (make-local-variable 'outline-regexp) 654 (set (make-local-variable 'outline-regexp) "[^#\n\^M]")
664 (make-local-variable 'outline-level) 655 (set (make-local-variable 'outline-level) 'c-outline-level)
665 (setq outline-regexp "[^#\n\^M]"
666 outline-level 'c-outline-level)
667 656
668 (let ((rfn (assq mode c-require-final-newline))) 657 (let ((rfn (assq mode c-require-final-newline)))
669 (when rfn 658 (when rfn
670 (make-local-variable 'require-final-newline)
671 (and (cdr rfn) 659 (and (cdr rfn)
672 (setq require-final-newline mode-require-final-newline))))) 660 (set (make-local-variable 'require-final-newline)
661 mode-require-final-newline)))))
673 662
674(defun c-count-cfss (lv-alist) 663(defun c-count-cfss (lv-alist)
675 ;; LV-ALIST is an alist like `file-local-variables-alist'. Count how many 664 ;; 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."
1100This does not load the font-lock package. Use after 1089This does not load the font-lock package. Use after
1101`c-basic-common-init' and after cc-fonts has been loaded." 1090`c-basic-common-init' and after cc-fonts has been loaded."
1102 1091
1103 (make-local-variable 'font-lock-defaults) 1092 (set (make-local-variable 'font-lock-defaults)
1104 (setq font-lock-defaults
1105 `(,(if (c-major-mode-is 'awk-mode) 1093 `(,(if (c-major-mode-is 'awk-mode)
1106 ;; awk-mode currently has only one font lock level. 1094 ;; awk-mode currently has only one font lock level.
1107 'awk-font-lock-keywords 1095 'awk-font-lock-keywords
@@ -1206,7 +1194,7 @@ Key bindings:
1206 (kill-all-local-variables) 1194 (kill-all-local-variables)
1207 (c-initialize-cc-mode t) 1195 (c-initialize-cc-mode t)
1208 (set-syntax-table c-mode-syntax-table) 1196 (set-syntax-table c-mode-syntax-table)
1209 (setq major-mode 'c-mode 1197 (setq major-mode 'c-mode ; FIXME: Use define-derived-mode.
1210 mode-name "C" 1198 mode-name "C"
1211 local-abbrev-table c-mode-abbrev-table 1199 local-abbrev-table c-mode-abbrev-table
1212 abbrev-mode t) 1200 abbrev-mode t)
@@ -1269,7 +1257,7 @@ Key bindings:
1269 (kill-all-local-variables) 1257 (kill-all-local-variables)
1270 (c-initialize-cc-mode t) 1258 (c-initialize-cc-mode t)
1271 (set-syntax-table c++-mode-syntax-table) 1259 (set-syntax-table c++-mode-syntax-table)
1272 (setq major-mode 'c++-mode 1260 (setq major-mode 'c++-mode ; FIXME: Use define-derived-mode.
1273 mode-name "C++" 1261 mode-name "C++"
1274 local-abbrev-table c++-mode-abbrev-table 1262 local-abbrev-table c++-mode-abbrev-table
1275 abbrev-mode t) 1263 abbrev-mode t)
@@ -1330,7 +1318,7 @@ Key bindings:
1330 (kill-all-local-variables) 1318 (kill-all-local-variables)
1331 (c-initialize-cc-mode t) 1319 (c-initialize-cc-mode t)
1332 (set-syntax-table objc-mode-syntax-table) 1320 (set-syntax-table objc-mode-syntax-table)
1333 (setq major-mode 'objc-mode 1321 (setq major-mode 'objc-mode ; FIXME: Use define-derived-mode.
1334 mode-name "ObjC" 1322 mode-name "ObjC"
1335 local-abbrev-table objc-mode-abbrev-table 1323 local-abbrev-table objc-mode-abbrev-table
1336 abbrev-mode t) 1324 abbrev-mode t)
@@ -1400,7 +1388,7 @@ Key bindings:
1400 (kill-all-local-variables) 1388 (kill-all-local-variables)
1401 (c-initialize-cc-mode t) 1389 (c-initialize-cc-mode t)
1402 (set-syntax-table java-mode-syntax-table) 1390 (set-syntax-table java-mode-syntax-table)
1403 (setq major-mode 'java-mode 1391 (setq major-mode 'java-mode ; FIXME: Use define-derived-mode.
1404 mode-name "Java" 1392 mode-name "Java"
1405 local-abbrev-table java-mode-abbrev-table 1393 local-abbrev-table java-mode-abbrev-table
1406 abbrev-mode t) 1394 abbrev-mode t)
@@ -1459,7 +1447,7 @@ Key bindings:
1459 (kill-all-local-variables) 1447 (kill-all-local-variables)
1460 (c-initialize-cc-mode t) 1448 (c-initialize-cc-mode t)
1461 (set-syntax-table idl-mode-syntax-table) 1449 (set-syntax-table idl-mode-syntax-table)
1462 (setq major-mode 'idl-mode 1450 (setq major-mode 'idl-mode ; FIXME: Use define-derived-mode.
1463 mode-name "IDL" 1451 mode-name "IDL"
1464 local-abbrev-table idl-mode-abbrev-table) 1452 local-abbrev-table idl-mode-abbrev-table)
1465 (use-local-map idl-mode-map) 1453 (use-local-map idl-mode-map)
@@ -1520,7 +1508,7 @@ Key bindings:
1520 (kill-all-local-variables) 1508 (kill-all-local-variables)
1521 (c-initialize-cc-mode t) 1509 (c-initialize-cc-mode t)
1522 (set-syntax-table pike-mode-syntax-table) 1510 (set-syntax-table pike-mode-syntax-table)
1523 (setq major-mode 'pike-mode 1511 (setq major-mode 'pike-mode ; FIXME: Use define-derived-mode.
1524 mode-name "Pike" 1512 mode-name "Pike"
1525 local-abbrev-table pike-mode-abbrev-table 1513 local-abbrev-table pike-mode-abbrev-table
1526 abbrev-mode t) 1514 abbrev-mode t)
@@ -1594,7 +1582,7 @@ Key bindings:
1594 (kill-all-local-variables) 1582 (kill-all-local-variables)
1595 (c-initialize-cc-mode t) 1583 (c-initialize-cc-mode t)
1596 (set-syntax-table awk-mode-syntax-table) 1584 (set-syntax-table awk-mode-syntax-table)
1597 (setq major-mode 'awk-mode 1585 (setq major-mode 'awk-mode ; FIXME: Use define-derived-mode.
1598 mode-name "AWK" 1586 mode-name "AWK"
1599 local-abbrev-table awk-mode-abbrev-table 1587 local-abbrev-table awk-mode-abbrev-table
1600 abbrev-mode t) 1588 abbrev-mode t)
@@ -1680,7 +1668,7 @@ Key bindings:
1680 adaptive-fill-regexp) 1668 adaptive-fill-regexp)
1681 nil))) 1669 nil)))
1682 (mapc (lambda (var) (unless (boundp var) 1670 (mapc (lambda (var) (unless (boundp var)
1683 (setq vars (delq var vars)))) 1671 (setq vars (delq var vars))))
1684 '(signal-error-on-buffer-boundary 1672 '(signal-error-on-buffer-boundary
1685 filladapt-mode 1673 filladapt-mode
1686 defun-prompt-regexp 1674 defun-prompt-regexp
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el
index 15d44f6538a..26529411c43 100644
--- a/lisp/progmodes/cc-styles.el
+++ b/lisp/progmodes/cc-styles.el
@@ -540,13 +540,12 @@ variables."
540 540
541 (when (boundp 'adaptive-fill-first-line-regexp) 541 (when (boundp 'adaptive-fill-first-line-regexp)
542 ;; XEmacs adaptive fill mode doesn't have this. 542 ;; XEmacs adaptive fill mode doesn't have this.
543 (make-local-variable 'adaptive-fill-first-line-regexp) 543 (set (make-local-variable 'adaptive-fill-first-line-regexp)
544 (setq adaptive-fill-first-line-regexp 544 (concat "\\`" comment-line-prefix
545 (concat "\\`" comment-line-prefix 545 ;; Maybe we should incorporate the old value here,
546 ;; Maybe we should incorporate the old value here, 546 ;; but then we have to do all sorts of kludges to
547 ;; but then we have to do all sorts of kludges to 547 ;; deal with the \` and \' it probably contains.
548 ;; deal with the \` and \' it probably contains. 548 "\\'"))))
549 "\\'"))))
550 549
551 ;; Set up the values for use in strings. These are the default 550 ;; Set up the values for use in strings. These are the default
552 ;; paragraph-start/separate values, enhanced to accept escaped EOLs as 551 ;; paragraph-start/separate values, enhanced to accept escaped EOLs as
diff --git a/lisp/progmodes/cfengine.el b/lisp/progmodes/cfengine.el
index e074e92fbe5..07fdbed12d6 100644
--- a/lisp/progmodes/cfengine.el
+++ b/lisp/progmodes/cfengine.el
@@ -221,7 +221,6 @@ to the action header."
221 ;; movement. 221 ;; movement.
222 222
223 (set (make-local-variable 'parens-require-spaces) nil) 223 (set (make-local-variable 'parens-require-spaces) nil)
224 (set (make-local-variable 'require-final-newline) mode-require-final-newline)
225 (set (make-local-variable 'comment-start) "# ") 224 (set (make-local-variable 'comment-start) "# ")
226 (set (make-local-variable 'comment-start-skip) 225 (set (make-local-variable 'comment-start-skip)
227 "\\(\\(?:^\\|[^\\\\\n]\\)\\(?:\\\\\\\\\\)*\\)#+[ \t]*") 226 "\\(\\(?:^\\|[^\\\\\n]\\)\\(?:\\\\\\\\\\)*\\)#+[ \t]*")
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index dd30212085e..da9b213ad8f 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1606,7 +1606,7 @@ Runs `compilation-mode-hook' with `run-mode-hooks' (which see).
1606 ;; Let windows scroll along with the output. 1606 ;; Let windows scroll along with the output.
1607 (set (make-local-variable 'window-point-insertion-type) t) 1607 (set (make-local-variable 'window-point-insertion-type) t)
1608 (set (make-local-variable 'tool-bar-map) compilation-mode-tool-bar-map) 1608 (set (make-local-variable 'tool-bar-map) compilation-mode-tool-bar-map)
1609 (setq major-mode 'compilation-mode 1609 (setq major-mode 'compilation-mode ; FIXME: Use define-derived-mode.
1610 mode-name (or name-of-mode "Compilation")) 1610 mode-name (or name-of-mode "Compilation"))
1611 (set (make-local-variable 'page-delimiter) 1611 (set (make-local-variable 'page-delimiter)
1612 compilation-page-delimiter) 1612 compilation-page-delimiter)
diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el
index 220ecf107ed..77a30521e9b 100644
--- a/lisp/progmodes/cpp.el
+++ b/lisp/progmodes/cpp.el
@@ -416,63 +416,59 @@ A prefix arg suppresses display of that buffer."
416 416
417;;; Edit Buffer: 417;;; Edit Buffer:
418 418
419(defvar cpp-edit-map nil) 419(defvar cpp-edit-mode-map
420;; Keymap for `cpp-edit-mode'. 420 (let ((map (make-keymap)))
421 421 (suppress-keymap map)
422(if cpp-edit-map 422 (define-key map [ down-mouse-2 ] 'cpp-push-button)
423 () 423 (define-key map [ mouse-2 ] 'ignore)
424 (setq cpp-edit-map (make-keymap)) 424 (define-key map " " 'scroll-up)
425 (suppress-keymap cpp-edit-map) 425 (define-key map "\C-?" 'scroll-down)
426 (define-key cpp-edit-map [ down-mouse-2 ] 'cpp-push-button) 426 (define-key map [ delete ] 'scroll-down)
427 (define-key cpp-edit-map [ mouse-2 ] 'ignore) 427 (define-key map "\C-c\C-c" 'cpp-edit-apply)
428 (define-key cpp-edit-map " " 'scroll-up) 428 (define-key map "a" 'cpp-edit-apply)
429 (define-key cpp-edit-map "\C-?" 'scroll-down) 429 (define-key map "A" 'cpp-edit-apply)
430 (define-key cpp-edit-map [ delete ] 'scroll-down) 430 (define-key map "r" 'cpp-edit-reset)
431 (define-key cpp-edit-map "\C-c\C-c" 'cpp-edit-apply) 431 (define-key map "R" 'cpp-edit-reset)
432 (define-key cpp-edit-map "a" 'cpp-edit-apply) 432 (define-key map "s" 'cpp-edit-save)
433 (define-key cpp-edit-map "A" 'cpp-edit-apply) 433 (define-key map "S" 'cpp-edit-save)
434 (define-key cpp-edit-map "r" 'cpp-edit-reset) 434 (define-key map "l" 'cpp-edit-load)
435 (define-key cpp-edit-map "R" 'cpp-edit-reset) 435 (define-key map "L" 'cpp-edit-load)
436 (define-key cpp-edit-map "s" 'cpp-edit-save) 436 (define-key map "h" 'cpp-edit-home)
437 (define-key cpp-edit-map "S" 'cpp-edit-save) 437 (define-key map "H" 'cpp-edit-home)
438 (define-key cpp-edit-map "l" 'cpp-edit-load) 438 (define-key map "b" 'cpp-edit-background)
439 (define-key cpp-edit-map "L" 'cpp-edit-load) 439 (define-key map "B" 'cpp-edit-background)
440 (define-key cpp-edit-map "h" 'cpp-edit-home) 440 (define-key map "k" 'cpp-edit-known)
441 (define-key cpp-edit-map "H" 'cpp-edit-home) 441 (define-key map "K" 'cpp-edit-known)
442 (define-key cpp-edit-map "b" 'cpp-edit-background) 442 (define-key map "u" 'cpp-edit-unknown)
443 (define-key cpp-edit-map "B" 'cpp-edit-background) 443 (define-key map "u" 'cpp-edit-unknown)
444 (define-key cpp-edit-map "k" 'cpp-edit-known) 444 (define-key map "t" 'cpp-edit-true)
445 (define-key cpp-edit-map "K" 'cpp-edit-known) 445 (define-key map "T" 'cpp-edit-true)
446 (define-key cpp-edit-map "u" 'cpp-edit-unknown) 446 (define-key map "f" 'cpp-edit-false)
447 (define-key cpp-edit-map "u" 'cpp-edit-unknown) 447 (define-key map "F" 'cpp-edit-false)
448 (define-key cpp-edit-map "t" 'cpp-edit-true) 448 (define-key map "w" 'cpp-edit-write)
449 (define-key cpp-edit-map "T" 'cpp-edit-true) 449 (define-key map "W" 'cpp-edit-write)
450 (define-key cpp-edit-map "f" 'cpp-edit-false) 450 (define-key map "X" 'cpp-edit-toggle-known)
451 (define-key cpp-edit-map "F" 'cpp-edit-false) 451 (define-key map "x" 'cpp-edit-toggle-known)
452 (define-key cpp-edit-map "w" 'cpp-edit-write) 452 (define-key map "Y" 'cpp-edit-toggle-unknown)
453 (define-key cpp-edit-map "W" 'cpp-edit-write) 453 (define-key map "y" 'cpp-edit-toggle-unknown)
454 (define-key cpp-edit-map "X" 'cpp-edit-toggle-known) 454 (define-key map "q" 'bury-buffer)
455 (define-key cpp-edit-map "x" 'cpp-edit-toggle-known) 455 (define-key map "Q" 'bury-buffer)
456 (define-key cpp-edit-map "Y" 'cpp-edit-toggle-unknown) 456 map)
457 (define-key cpp-edit-map "y" 'cpp-edit-toggle-unknown) 457 "Keymap for `cpp-edit-mode'.")
458 (define-key cpp-edit-map "q" 'bury-buffer) 458
459 (define-key cpp-edit-map "Q" 'bury-buffer)) 459
460 460
461(defvar cpp-edit-symbols nil) 461(defvar cpp-edit-symbols nil)
462;; Symbols defined in the edit buffer. 462;; Symbols defined in the edit buffer.
463(make-variable-buffer-local 'cpp-edit-symbols) 463(make-variable-buffer-local 'cpp-edit-symbols)
464 464
465(defun cpp-edit-mode () 465(define-derived-mode cpp-edit-mode fundamental-mode "CPP Edit"
466 "Major mode for editing the criteria for highlighting cpp conditionals. 466 "Major mode for editing the criteria for highlighting cpp conditionals.
467Click on objects to change them. 467Click on objects to change them.
468You can also use the keyboard accelerators indicated like this: [K]ey." 468You can also use the keyboard accelerators indicated like this: [K]ey."
469 (kill-all-local-variables)
470 (buffer-disable-undo) 469 (buffer-disable-undo)
471 (auto-save-mode -1) 470 (auto-save-mode -1)
472 (setq buffer-read-only t) 471 (setq buffer-read-only t))
473 (setq major-mode 'cpp-edit-mode)
474 (setq mode-name "CPP Edit")
475 (use-local-map cpp-edit-map))
476 472
477(defun cpp-edit-apply () 473(defun cpp-edit-apply ()
478 "Apply edited display information to original buffer." 474 "Apply edited display information to original buffer."
@@ -568,7 +564,7 @@ You can also use the keyboard accelerators indicated like this: [K]ey."
568 (load-file cpp-config-file)) 564 (load-file cpp-config-file))
569 ((file-readable-p (concat "~/" cpp-config-file)) 565 ((file-readable-p (concat "~/" cpp-config-file))
570 (load-file cpp-config-file))) 566 (load-file cpp-config-file)))
571 (if (eq major-mode 'cpp-edit-mode) 567 (if (derived-mode-p 'cpp-edit-mode)
572 (cpp-edit-reset))) 568 (cpp-edit-reset)))
573 569
574(defun cpp-edit-save () 570(defun cpp-edit-save ()
diff --git a/lisp/progmodes/dcl-mode.el b/lisp/progmodes/dcl-mode.el
index dd7aa0eddfb..9aea53705cd 100644
--- a/lisp/progmodes/dcl-mode.el
+++ b/lisp/progmodes/dcl-mode.el
@@ -296,72 +296,69 @@ See `imenu-generic-expression' for details."
296) 296)
297 297
298 298
299(defvar dcl-mode-map () 299(defvar dcl-mode-map
300 (let ((map (make-sparse-keymap)))
301 (define-key map "\e\n" 'dcl-split-line)
302 (define-key map "\e\t" 'tempo-complete-tag)
303 (define-key map "\e^" 'dcl-delete-indentation)
304 (define-key map "\em" 'dcl-back-to-indentation)
305 (define-key map "\ee" 'dcl-forward-command)
306 (define-key map "\ea" 'dcl-backward-command)
307 (define-key map "\e\C-q" 'dcl-indent-command)
308 (define-key map "\t" 'dcl-tab)
309 (define-key map ":" 'dcl-electric-character)
310 (define-key map "F" 'dcl-electric-character)
311 (define-key map "f" 'dcl-electric-character)
312 (define-key map "E" 'dcl-electric-character)
313 (define-key map "e" 'dcl-electric-character)
314 (define-key map "\C-c\C-o" 'dcl-set-option)
315 (define-key map "\C-c\C-f" 'tempo-forward-mark)
316 (define-key map "\C-c\C-b" 'tempo-backward-mark)
317
318 (define-key map [menu-bar] (make-sparse-keymap))
319 (define-key map [menu-bar dcl]
320 (cons "DCL" (make-sparse-keymap "DCL")))
321
322 ;; Define these in bottom-up order
323 (define-key map [menu-bar dcl tempo-backward-mark]
324 '("Previous template mark" . tempo-backward-mark))
325 (define-key map [menu-bar dcl tempo-forward-mark]
326 '("Next template mark" . tempo-forward-mark))
327 (define-key map [menu-bar dcl tempo-complete-tag]
328 '("Complete template tag" . tempo-complete-tag))
329 (define-key map [menu-bar dcl dcl-separator-tempo]
330 '("--"))
331 (define-key map [menu-bar dcl dcl-save-all-options]
332 '("Save all options" . dcl-save-all-options))
333 (define-key map [menu-bar dcl dcl-save-nondefault-options]
334 '("Save changed options" . dcl-save-nondefault-options))
335 (define-key map [menu-bar dcl dcl-set-option]
336 '("Set option" . dcl-set-option))
337 (define-key map [menu-bar dcl dcl-separator-option]
338 '("--"))
339 (define-key map [menu-bar dcl dcl-delete-indentation]
340 '("Delete indentation" . dcl-delete-indentation))
341 (define-key map [menu-bar dcl dcl-split-line]
342 '("Split line" . dcl-split-line))
343 (define-key map [menu-bar dcl dcl-indent-command]
344 '("Indent command" . dcl-indent-command))
345 (define-key map [menu-bar dcl dcl-tab]
346 '("Indent line/insert tab" . dcl-tab))
347 (define-key map [menu-bar dcl dcl-back-to-indentation]
348 '("Back to indentation" . dcl-back-to-indentation))
349 (define-key map [menu-bar dcl dcl-forward-command]
350 '("End of statement" . dcl-forward-command))
351 (define-key map [menu-bar dcl dcl-backward-command]
352 '("Beginning of statement" . dcl-backward-command))
353 ;; imenu is only supported for versions with imenu-generic-expression
354 (if (boundp 'imenu-generic-expression)
355 (progn
356 (define-key map [menu-bar dcl dcl-separator-movement]
357 '("--"))
358 (define-key map [menu-bar dcl imenu]
359 '("Buffer index menu" . imenu))))
360 map)
300 "Keymap used in DCL-mode buffers.") 361 "Keymap used in DCL-mode buffers.")
301(if dcl-mode-map
302 ()
303 (setq dcl-mode-map (make-sparse-keymap))
304 (define-key dcl-mode-map "\e\n" 'dcl-split-line)
305 (define-key dcl-mode-map "\e\t" 'tempo-complete-tag)
306 (define-key dcl-mode-map "\e^" 'dcl-delete-indentation)
307 (define-key dcl-mode-map "\em" 'dcl-back-to-indentation)
308 (define-key dcl-mode-map "\ee" 'dcl-forward-command)
309 (define-key dcl-mode-map "\ea" 'dcl-backward-command)
310 (define-key dcl-mode-map "\e\C-q" 'dcl-indent-command)
311 (define-key dcl-mode-map "\t" 'dcl-tab)
312 (define-key dcl-mode-map ":" 'dcl-electric-character)
313 (define-key dcl-mode-map "F" 'dcl-electric-character)
314 (define-key dcl-mode-map "f" 'dcl-electric-character)
315 (define-key dcl-mode-map "E" 'dcl-electric-character)
316 (define-key dcl-mode-map "e" 'dcl-electric-character)
317 (define-key dcl-mode-map "\C-c\C-o" 'dcl-set-option)
318 (define-key dcl-mode-map "\C-c\C-f" 'tempo-forward-mark)
319 (define-key dcl-mode-map "\C-c\C-b" 'tempo-backward-mark)
320
321 (define-key dcl-mode-map [menu-bar] (make-sparse-keymap))
322 (define-key dcl-mode-map [menu-bar dcl]
323 (cons "DCL" (make-sparse-keymap "DCL")))
324
325 ;; Define these in bottom-up order
326 (define-key dcl-mode-map [menu-bar dcl tempo-backward-mark]
327 '("Previous template mark" . tempo-backward-mark))
328 (define-key dcl-mode-map [menu-bar dcl tempo-forward-mark]
329 '("Next template mark" . tempo-forward-mark))
330 (define-key dcl-mode-map [menu-bar dcl tempo-complete-tag]
331 '("Complete template tag" . tempo-complete-tag))
332 (define-key dcl-mode-map [menu-bar dcl dcl-separator-tempo]
333 '("--"))
334 (define-key dcl-mode-map [menu-bar dcl dcl-save-all-options]
335 '("Save all options" . dcl-save-all-options))
336 (define-key dcl-mode-map [menu-bar dcl dcl-save-nondefault-options]
337 '("Save changed options" . dcl-save-nondefault-options))
338 (define-key dcl-mode-map [menu-bar dcl dcl-set-option]
339 '("Set option" . dcl-set-option))
340 (define-key dcl-mode-map [menu-bar dcl dcl-separator-option]
341 '("--"))
342 (define-key dcl-mode-map [menu-bar dcl dcl-delete-indentation]
343 '("Delete indentation" . dcl-delete-indentation))
344 (define-key dcl-mode-map [menu-bar dcl dcl-split-line]
345 '("Split line" . dcl-split-line))
346 (define-key dcl-mode-map [menu-bar dcl dcl-indent-command]
347 '("Indent command" . dcl-indent-command))
348 (define-key dcl-mode-map [menu-bar dcl dcl-tab]
349 '("Indent line/insert tab" . dcl-tab))
350 (define-key dcl-mode-map [menu-bar dcl dcl-back-to-indentation]
351 '("Back to indentation" . dcl-back-to-indentation))
352 (define-key dcl-mode-map [menu-bar dcl dcl-forward-command]
353 '("End of statement" . dcl-forward-command))
354 (define-key dcl-mode-map [menu-bar dcl dcl-backward-command]
355 '("Beginning of statement" . dcl-backward-command))
356 ;; imenu is only supported for versions with imenu-generic-expression
357 (if (boundp 'imenu-generic-expression)
358 (progn
359 (define-key dcl-mode-map [menu-bar dcl dcl-separator-movement]
360 '("--"))
361 (define-key dcl-mode-map [menu-bar dcl imenu]
362 '("Buffer index menu" . imenu))))
363 )
364
365 362
366(defcustom dcl-ws-r 363(defcustom dcl-ws-r
367 "\\([ \t]*-[ \t]*\\(!.*\\)*\n\\)*[ \t]*" 364 "\\([ \t]*-[ \t]*\\(!.*\\)*\n\\)*[ \t]*"
@@ -475,7 +472,7 @@ Preloaded with all known option names from dcl-option-alist")
475 472
476 473
477;;;###autoload 474;;;###autoload
478(defun dcl-mode () 475(define-derived-mode dcl-mode prog-mode "DCL"
479 "Major mode for editing DCL-files. 476 "Major mode for editing DCL-files.
480 477
481This mode indents command lines in blocks. (A block is commands between 478This mode indents command lines in blocks. (A block is commands between
@@ -593,29 +590,17 @@ $
593 590
594There is some minimal font-lock support (see vars 591There is some minimal font-lock support (see vars
595`dcl-font-lock-defaults' and `dcl-font-lock-keywords')." 592`dcl-font-lock-defaults' and `dcl-font-lock-keywords')."
596 (interactive) 593 (set (make-local-variable 'indent-line-function) 'dcl-indent-line)
597 (kill-all-local-variables) 594 (set (make-local-variable 'comment-start) "!")
598 (set-syntax-table dcl-mode-syntax-table) 595 (set (make-local-variable 'comment-end) "")
599 596 (set (make-local-variable 'comment-multi-line) nil)
600 (make-local-variable 'indent-line-function)
601 (setq indent-line-function 'dcl-indent-line)
602
603 (make-local-variable 'comment-start)
604 (setq comment-start "!")
605
606 (make-local-variable 'comment-end)
607 (setq comment-end "")
608
609 (make-local-variable 'comment-multi-line)
610 (setq comment-multi-line nil)
611 597
612 ;; This used to be "^\\$[ \t]*![ \t]*" which looks more correct. 598 ;; This used to be "^\\$[ \t]*![ \t]*" which looks more correct.
613 ;; The drawback was that you couldn't make empty comment lines by pressing 599 ;; The drawback was that you couldn't make empty comment lines by pressing
614 ;; C-M-j repeatedly - only the first line became a comment line. 600 ;; C-M-j repeatedly - only the first line became a comment line.
615 ;; This version has the drawback that the "$" can be anywhere in the line, 601 ;; This version has the drawback that the "$" can be anywhere in the line,
616 ;; and something inappropriate might be interpreted as a comment. 602 ;; and something inappropriate might be interpreted as a comment.
617 (make-local-variable 'comment-start-skip) 603 (set (make-local-variable 'comment-start-skip) "\\$[ \t]*![ \t]*")
618 (setq comment-start-skip "\\$[ \t]*![ \t]*")
619 604
620 (if (boundp 'imenu-generic-expression) 605 (if (boundp 'imenu-generic-expression)
621 (progn (setq imenu-generic-expression dcl-imenu-generic-expression) 606 (progn (setq imenu-generic-expression dcl-imenu-generic-expression)
@@ -636,14 +621,9 @@ There is some minimal font-lock support (see vars
636 (make-local-variable 'dcl-electric-reindent-regexps) 621 (make-local-variable 'dcl-electric-reindent-regexps)
637 622
638 ;; font lock 623 ;; font lock
639 (make-local-variable 'font-lock-defaults) 624 (set (make-local-variable 'font-lock-defaults) dcl-font-lock-defaults)
640 (setq font-lock-defaults dcl-font-lock-defaults) 625
641 626 (tempo-use-tag-list 'dcl-tempo-tags))
642 (setq major-mode 'dcl-mode)
643 (setq mode-name "DCL")
644 (use-local-map dcl-mode-map)
645 (tempo-use-tag-list 'dcl-tempo-tags)
646 (run-mode-hooks 'dcl-mode-hook))
647 627
648 628
649;;; *** Movement commands *************************************************** 629;;; *** Movement commands ***************************************************
diff --git a/lisp/progmodes/delphi.el b/lisp/progmodes/delphi.el
index 2558456bc07..77d88e5a812 100644
--- a/lisp/progmodes/delphi.el
+++ b/lisp/progmodes/delphi.el
@@ -1779,7 +1779,7 @@ If no extension is specified, .pas is assumed. Creates a buffer for the unit."
1779 (if (null file) 1779 (if (null file)
1780 (error "unit not found: %s" unit-file) 1780 (error "unit not found: %s" unit-file)
1781 (find-file file) 1781 (find-file file)
1782 (if (not (eq major-mode 'delphi-mode)) 1782 (if (not (derived-mode-p 'delphi-mode))
1783 (delphi-mode))) 1783 (delphi-mode)))
1784 file)) 1784 file))
1785 1785
@@ -2015,7 +2015,7 @@ no args, if that value is non-nil."
2015 (interactive) 2015 (interactive)
2016 (kill-all-local-variables) 2016 (kill-all-local-variables)
2017 (use-local-map delphi-mode-map) 2017 (use-local-map delphi-mode-map)
2018 (setq major-mode 'delphi-mode) 2018 (setq major-mode 'delphi-mode) ;FIXME: Use define-derived-mode.
2019 (setq mode-name "Delphi") 2019 (setq mode-name "Delphi")
2020 2020
2021 (setq local-abbrev-table delphi-mode-abbrev-table) 2021 (setq local-abbrev-table delphi-mode-abbrev-table)
@@ -2025,8 +2025,7 @@ no args, if that value is non-nil."
2025 (mapc #'(lambda (var) 2025 (mapc #'(lambda (var)
2026 (let ((var-symb (car var)) 2026 (let ((var-symb (car var))
2027 (var-val (cadr var))) 2027 (var-val (cadr var)))
2028 (make-local-variable var-symb) 2028 (set (make-local-variable var-symb) var-val)))
2029 (set var-symb var-val)))
2030 (list '(indent-line-function delphi-indent-line) 2029 (list '(indent-line-function delphi-indent-line)
2031 '(comment-indent-function delphi-indent-line) 2030 '(comment-indent-function delphi-indent-line)
2032 '(case-fold-search t) 2031 '(case-fold-search t)
diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el
index 7101bf21ade..6b7c70208ea 100644
--- a/lisp/progmodes/ebrowse.el
+++ b/lisp/progmodes/ebrowse.el
@@ -1116,7 +1116,7 @@ if for some reason a circle is in the inheritance graph."
1116;;; Tree-mode - mode for tree buffers 1116;;; Tree-mode - mode for tree buffers
1117 1117
1118;;;###autoload 1118;;;###autoload
1119(defun ebrowse-tree-mode () 1119(define-derived-mode ebrowse-tree-mode special-mode "Ebrowse-Tree"
1120 "Major mode for Ebrowse class tree buffers. 1120 "Major mode for Ebrowse class tree buffers.
1121Each line corresponds to a class in a class tree. 1121Each line corresponds to a class in a class tree.
1122Letters do not insert themselves, they are commands. 1122Letters do not insert themselves, they are commands.
@@ -1125,12 +1125,10 @@ E.g.\\[save-buffer] writes the tree to the file it was loaded from.
1125 1125
1126Tree mode key bindings: 1126Tree mode key bindings:
1127\\{ebrowse-tree-mode-map}" 1127\\{ebrowse-tree-mode-map}"
1128 (interactive)
1129 (let* ((ident (propertized-buffer-identification "C++ Tree")) 1128 (let* ((ident (propertized-buffer-identification "C++ Tree"))
1130 header tree buffer-read-only) 1129 (inhibit-read-only t)
1130 header tree)
1131 1131
1132 (kill-all-local-variables)
1133 (use-local-map ebrowse-tree-mode-map)
1134 (buffer-disable-undo) 1132 (buffer-disable-undo)
1135 1133
1136 (unless (zerop (buffer-size)) 1134 (unless (zerop (buffer-size))
@@ -1141,38 +1139,27 @@ Tree mode key bindings:
1141 (erase-buffer) 1139 (erase-buffer)
1142 (message nil)) 1140 (message nil))
1143 1141
1144 (mapc 'make-local-variable 1142 (set (make-local-variable 'ebrowse--show-file-names-flag) nil)
1145 '(ebrowse--tags-file-name 1143 (set (make-local-variable 'ebrowse--tree-obarray) (make-vector 127 0))
1146 ebrowse--indentation 1144 (set (make-local-variable 'ebrowse--frozen-flag) nil)
1147 ebrowse--tree 1145 (setq mode-line-buffer-identification ident)
1148 ebrowse--header 1146 (setq buffer-read-only t)
1149 ebrowse--show-file-names-flag 1147 (setq selective-display t)
1150 ebrowse--frozen-flag 1148 (setq selective-display-ellipses t)
1151 ebrowse--tree-obarray 1149 (set (make-local-variable 'revert-buffer-function)
1152 revert-buffer-function)) 1150 #'ebrowse-revert-tree-buffer-from-file)
1153 1151 (set (make-local-variable 'ebrowse--header) header)
1154 (setf ebrowse--show-file-names-flag nil 1152 (set (make-local-variable 'ebrowse--tree) tree)
1155 ebrowse--tree-obarray (make-vector 127 0) 1153 (set (make-local-variable 'ebrowse--tags-file-name) buffer-file-name)
1156 ebrowse--frozen-flag nil 1154 (set (make-local-variable 'ebrowse--tree-obarray)
1157 major-mode 'ebrowse-tree-mode 1155 (and tree (ebrowse-build-tree-obarray tree)))
1158 mode-name "Ebrowse-Tree" 1156 (set (make-local-variable 'ebrowse--frozen-flag) nil)
1159 mode-line-buffer-identification ident 1157
1160 buffer-read-only t 1158 (add-hook 'local-write-file-hooks 'ebrowse-write-file-hook-fn nil t)
1161 selective-display t
1162 selective-display-ellipses t
1163 revert-buffer-function 'ebrowse-revert-tree-buffer-from-file
1164 ebrowse--header header
1165 ebrowse--tree tree
1166 ebrowse--tags-file-name (buffer-file-name)
1167 ebrowse--tree-obarray (and tree (ebrowse-build-tree-obarray tree))
1168 ebrowse--frozen-flag nil)
1169
1170 (add-hook 'local-write-file-hooks 'ebrowse-write-file-hook-fn)
1171 (modify-syntax-entry ?_ (char-to-string (char-syntax ?a))) 1159 (modify-syntax-entry ?_ (char-to-string (char-syntax ?a)))
1172 (when tree 1160 (when tree
1173 (ebrowse-redraw-tree) 1161 (ebrowse-redraw-tree)
1174 (set-buffer-modified-p nil)) 1162 (set-buffer-modified-p nil))))
1175 (run-mode-hooks 'ebrowse-tree-mode-hook)))
1176 1163
1177 1164
1178 1165
@@ -1340,6 +1327,7 @@ With PREFIX, insert that many filenames."
1340 1327
1341(defun ebrowse-member-buffer-p (buffer) 1328(defun ebrowse-member-buffer-p (buffer)
1342 "Value is non-nil if BUFFER is a member buffer." 1329 "Value is non-nil if BUFFER is a member buffer."
1330 ;; FIXME: Why not (buffer-local-value 'major-mode buffer)?
1343 (eq (cdr (assoc 'major-mode (buffer-local-variables buffer))) 1331 (eq (cdr (assoc 'major-mode (buffer-local-variables buffer)))
1344 'ebrowse-member-mode)) 1332 'ebrowse-member-mode))
1345 1333
@@ -1459,12 +1447,13 @@ Pop to member buffer if no prefix ARG, to tree buffer otherwise."
1459(defun ebrowse-set-tree-indentation () 1447(defun ebrowse-set-tree-indentation ()
1460 "Set the indentation width of the tree display." 1448 "Set the indentation width of the tree display."
1461 (interactive) 1449 (interactive)
1462 (let ((width (string-to-number (read-from-minibuffer 1450 (let ((width (string-to-number (read-string
1463 (concat "Indentation (" 1451 (concat "Indentation (default "
1464 (int-to-string ebrowse--indentation) 1452 (int-to-string ebrowse--indentation)
1465 "): "))))) 1453 "): ")
1454 nil nil ebrowse--indentation))))
1466 (when (plusp width) 1455 (when (plusp width)
1467 (setf ebrowse--indentation width) 1456 (set (make-local-variable 'ebrowse--indentation) width)
1468 (ebrowse-redraw-tree)))) 1457 (ebrowse-redraw-tree))))
1469 1458
1470 1459
@@ -1632,13 +1621,12 @@ The new frame is deleted when you quit viewing the file in that frame."
1632 (had-a-buf (get-file-buffer file)) 1621 (had-a-buf (get-file-buffer file))
1633 (buf-to-view (find-file-noselect file))) 1622 (buf-to-view (find-file-noselect file)))
1634 (switch-to-buffer-other-frame buf-to-view) 1623 (switch-to-buffer-other-frame buf-to-view)
1635 (make-local-variable 'ebrowse--frame-configuration) 1624 (set (make-local-variable 'ebrowse--frame-configuration)
1636 (setq ebrowse--frame-configuration old-frame-configuration) 1625 old-frame-configuration)
1637 (make-local-variable 'ebrowse--view-exit-action) 1626 (set (make-local-variable 'ebrowse--view-exit-action)
1638 (setq ebrowse--view-exit-action 1627 (and (not had-a-buf)
1639 (and (not had-a-buf) 1628 (not (buffer-modified-p buf-to-view))
1640 (not (buffer-modified-p buf-to-view)) 1629 'kill-buffer))
1641 'kill-buffer))
1642 (view-mode-enter (cons (selected-window) (cons (selected-window) t)) 1630 (view-mode-enter (cons (selected-window) (cons (selected-window) t))
1643 'ebrowse-view-exit-fn))) 1631 'ebrowse-view-exit-fn)))
1644 1632
@@ -2006,21 +1994,16 @@ COLLAPSE non-nil means collapse the branch."
2006(put 'ebrowse-electric-list-undefined 'suppress-keymap t) 1994(put 'ebrowse-electric-list-undefined 'suppress-keymap t)
2007 1995
2008 1996
2009(defun ebrowse-electric-list-mode () 1997(define-derived-mode ebrowse-electric-list-mode
1998 fundamental-mode "Electric Position Menu"
2010 "Mode for electric tree list mode." 1999 "Mode for electric tree list mode."
2011 (kill-all-local-variables) 2000 (setq mode-line-buffer-identification "Electric Tree Menu")
2012 (use-local-map ebrowse-electric-list-mode-map)
2013 (setq mode-name "Electric Position Menu"
2014 mode-line-buffer-identification "Electric Tree Menu")
2015 (when (memq 'mode-name mode-line-format) 2001 (when (memq 'mode-name mode-line-format)
2016 (setq mode-line-format (copy-sequence mode-line-format)) 2002 (setq mode-line-format (copy-sequence mode-line-format))
2017 (setcar (memq 'mode-name mode-line-format) "Tree Buffers")) 2003 (setcar (memq 'mode-name mode-line-format) "Tree Buffers"))
2018 (make-local-variable 'Helper-return-blurb) 2004 (set (make-local-variable 'Helper-return-blurb) "return to buffer editing")
2019 (setq Helper-return-blurb "return to buffer editing" 2005 (setq truncate-lines t
2020 truncate-lines t 2006 buffer-read-only t))
2021 buffer-read-only t
2022 major-mode 'ebrowse-electric-list-mode)
2023 (run-mode-hooks 'ebrowse-electric-list-mode-hook))
2024 2007
2025 2008
2026(defun ebrowse-list-tree-buffers () 2009(defun ebrowse-list-tree-buffers ()
@@ -2226,13 +2209,8 @@ See 'Electric-command-loop' for a description of STATE and CONDITION."
2226;;; Member mode 2209;;; Member mode
2227 2210
2228;;;###autoload 2211;;;###autoload
2229(defun ebrowse-member-mode () 2212(define-derived-mode ebrowse-member-mode special-mode "Ebrowse-Members"
2230 "Major mode for Ebrowse member buffers. 2213 "Major mode for Ebrowse member buffers."
2231
2232\\{ebrowse-member-mode-map}"
2233 (kill-all-local-variables)
2234 (use-local-map ebrowse-member-mode-map)
2235 (setq major-mode 'ebrowse-member-mode)
2236 (mapc 'make-local-variable 2214 (mapc 'make-local-variable
2237 '(ebrowse--decl-column ;display column 2215 '(ebrowse--decl-column ;display column
2238 ebrowse--n-columns ;number of short columns 2216 ebrowse--n-columns ;number of short columns
@@ -2255,8 +2233,7 @@ See 'Electric-command-loop' for a description of STATE and CONDITION."
2255 ebrowse--const-display-flag 2233 ebrowse--const-display-flag
2256 ebrowse--pure-display-flag 2234 ebrowse--pure-display-flag
2257 ebrowse--frozen-flag)) ;buffer not automagically reused 2235 ebrowse--frozen-flag)) ;buffer not automagically reused
2258 (setq mode-name "Ebrowse-Members" 2236 (setq mode-line-buffer-identification
2259 mode-line-buffer-identification
2260 (propertized-buffer-identification "C++ Members") 2237 (propertized-buffer-identification "C++ Members")
2261 buffer-read-only t 2238 buffer-read-only t
2262 ebrowse--long-display-flag nil 2239 ebrowse--long-display-flag nil
@@ -2270,8 +2247,7 @@ See 'Electric-command-loop' for a description of STATE and CONDITION."
2270 ebrowse--inline-display-flag nil 2247 ebrowse--inline-display-flag nil
2271 ebrowse--const-display-flag nil 2248 ebrowse--const-display-flag nil
2272 ebrowse--pure-display-flag nil) 2249 ebrowse--pure-display-flag nil)
2273 (modify-syntax-entry ?_ (char-to-string (char-syntax ?a))) 2250 (modify-syntax-entry ?_ (char-to-string (char-syntax ?a))))
2274 (run-mode-hooks 'ebrowse-member-mode-hook))
2275 2251
2276 2252
2277 2253
@@ -3967,22 +3943,17 @@ Prefix arg ARG says how much."
3967(put 'ebrowse-electric-position-undefined 'suppress-keymap t) 3943(put 'ebrowse-electric-position-undefined 'suppress-keymap t)
3968 3944
3969 3945
3970(defun ebrowse-electric-position-mode () 3946(define-derived-mode ebrowse-electric-position-mode
3947 fundamental-mode "Electric Position Menu"
3971 "Mode for electric position buffers. 3948 "Mode for electric position buffers.
3972Runs the hook `ebrowse-electric-position-mode-hook'." 3949Runs the hook `ebrowse-electric-position-mode-hook'."
3973 (kill-all-local-variables) 3950 (setq mode-line-buffer-identification "Electric Position Menu")
3974 (use-local-map ebrowse-electric-position-mode-map)
3975 (setq mode-name "Electric Position Menu"
3976 mode-line-buffer-identification "Electric Position Menu")
3977 (when (memq 'mode-name mode-line-format) 3951 (when (memq 'mode-name mode-line-format)
3978 (setq mode-line-format (copy-sequence mode-line-format)) 3952 (setq mode-line-format (copy-sequence mode-line-format))
3979 (setcar (memq 'mode-name mode-line-format) "Positions")) 3953 (setcar (memq 'mode-name mode-line-format) "Positions"))
3980 (make-local-variable 'Helper-return-blurb) 3954 (set (make-local-variable 'Helper-return-blurb) "return to buffer editing")
3981 (setq Helper-return-blurb "return to buffer editing" 3955 (setq truncate-lines t
3982 truncate-lines t 3956 buffer-read-only t))
3983 buffer-read-only t
3984 major-mode 'ebrowse-electric-position-mode)
3985 (run-mode-hooks 'ebrowse-electric-position-mode-hook))
3986 3957
3987 3958
3988(defun ebrowse-draw-position-buffer () 3959(defun ebrowse-draw-position-buffer ()
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 0d11fd6423d..885ad0796ba 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -280,7 +280,7 @@ buffer-local and set them to nil."
280(defun tags-table-mode () 280(defun tags-table-mode ()
281 "Major mode for tags table file buffers." 281 "Major mode for tags table file buffers."
282 (interactive) 282 (interactive)
283 (setq major-mode 'tags-table-mode 283 (setq major-mode 'tags-table-mode ;FIXME: Use define-derived-mode.
284 mode-name "Tags Table" 284 mode-name "Tags Table"
285 buffer-undo-list t) 285 buffer-undo-list t)
286 (initialize-new-tags-table)) 286 (initialize-new-tags-table))
@@ -2030,10 +2030,8 @@ see the doc of that variable if you want to add names to the list."
2030 (define-key map "q" 'select-tags-table-quit) 2030 (define-key map "q" 'select-tags-table-quit)
2031 map)) 2031 map))
2032 2032
2033(define-derived-mode select-tags-table-mode fundamental-mode "Select Tags Table" 2033(define-derived-mode select-tags-table-mode special-mode "Select Tags Table"
2034 "Major mode for choosing a current tags table among those already loaded. 2034 "Major mode for choosing a current tags table among those already loaded."
2035
2036\\{select-tags-table-mode-map}"
2037 (setq buffer-read-only t)) 2035 (setq buffer-read-only t))
2038 2036
2039(defun select-tags-table-select (button) 2037(defun select-tags-table-select (button)
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index b6c42d2c550..906ed4588c2 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -1067,11 +1067,9 @@ Variables controlling indentation style and extra features:
1067Turning on F90 mode calls the value of the variable `f90-mode-hook' 1067Turning on F90 mode calls the value of the variable `f90-mode-hook'
1068with no args, if that value is non-nil." 1068with no args, if that value is non-nil."
1069 :group 'f90 1069 :group 'f90
1070 :syntax-table f90-mode-syntax-table
1071 :abbrev-table f90-mode-abbrev-table 1070 :abbrev-table f90-mode-abbrev-table
1072 (set (make-local-variable 'indent-line-function) 'f90-indent-line) 1071 (set (make-local-variable 'indent-line-function) 'f90-indent-line)
1073 (set (make-local-variable 'indent-region-function) 'f90-indent-region) 1072 (set (make-local-variable 'indent-region-function) 'f90-indent-region)
1074 (set (make-local-variable 'require-final-newline) mode-require-final-newline)
1075 (set (make-local-variable 'comment-start) "!") 1073 (set (make-local-variable 'comment-start) "!")
1076 (set (make-local-variable 'comment-start-skip) "!+ *") 1074 (set (make-local-variable 'comment-start-skip) "!+ *")
1077 (set (make-local-variable 'comment-indent-function) 'f90-comment-indent) 1075 (set (make-local-variable 'comment-indent-function) 'f90-comment-indent)
@@ -2207,7 +2205,7 @@ CHANGE-WORD should be one of 'upcase-word, 'downcase-word, 'capitalize-word."
2207With optional argument ALL, change the default for all present 2205With optional argument ALL, change the default for all present
2208and future F90 buffers. F90 mode normally treats backslash as an 2206and future F90 buffers. F90 mode normally treats backslash as an
2209escape character." 2207escape character."
2210 (or (eq major-mode 'f90-mode) 2208 (or (derived-mode-p 'f90-mode)
2211 (error "This function should only be used in F90 buffers")) 2209 (error "This function should only be used in F90 buffers"))
2212 (when (equal (char-syntax ?\\ ) ?\\ ) 2210 (when (equal (char-syntax ?\\ ) ?\\ )
2213 (or all (set-syntax-table (copy-syntax-table (syntax-table)))) 2211 (or all (set-syntax-table (copy-syntax-table (syntax-table))))
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 3e80269d09c..f3f7e617376 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1016,7 +1016,7 @@ With arg, enter name of variable to be watched in the minibuffer."
1016 'gud-gdb-complete-command) 1016 'gud-gdb-complete-command)
1017 (if (and transient-mark-mode mark-active) 1017 (if (and transient-mark-mode mark-active)
1018 (buffer-substring (region-beginning) (region-end)) 1018 (buffer-substring (region-beginning) (region-end))
1019 (concat (if (eq major-mode 'gdb-registers-mode) "$") 1019 (concat (if (derived-mode-p 'gdb-registers-mode) "$")
1020 (tooltip-identifier-from-point (point))))))) 1020 (tooltip-identifier-from-point (point)))))))
1021 (set-text-properties 0 (length expr) nil expr) 1021 (set-text-properties 0 (length expr) nil expr)
1022 (gdb-input 1022 (gdb-input
@@ -1483,14 +1483,9 @@ DOC is an optional documentation string."
1483 1483
1484;; We want to use comint because it has various nifty and familiar features. 1484;; We want to use comint because it has various nifty and familiar features.
1485(define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O" 1485(define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O"
1486 "Major mode for gdb inferior-io. 1486 "Major mode for gdb inferior-io."
1487
1488The following commands are available:
1489\\{gdb-inferior-io-mode-map}"
1490
1491 :syntax-table nil :abbrev-table nil 1487 :syntax-table nil :abbrev-table nil
1492 1488 (make-comint-in-buffer "gdb-inferior" (current-buffer) nil))
1493(make-comint-in-buffer "gdb-inferior" (current-buffer) nil))
1494 1489
1495(defun gdb-inferior-filter (proc string) 1490(defun gdb-inferior-filter (proc string)
1496 (unless (string-equal string "") 1491 (unless (string-equal string "")
@@ -2443,7 +2438,7 @@ If not in a source or disassembly buffer just set point."
2443 (mouse-minibuffer-check event) 2438 (mouse-minibuffer-check event)
2444 (let ((posn (event-end event))) 2439 (let ((posn (event-end event)))
2445 (with-selected-window (posn-window posn) 2440 (with-selected-window (posn-window posn)
2446 (if (or (buffer-file-name) (eq major-mode 'gdb-disassembly-mode)) 2441 (if (or (buffer-file-name) (derived-mode-p 'gdb-disassembly-mode))
2447 (if (numberp (posn-point posn)) 2442 (if (numberp (posn-point posn))
2448 (save-excursion 2443 (save-excursion
2449 (goto-char (posn-point posn)) 2444 (goto-char (posn-point posn))
@@ -2627,15 +2622,12 @@ corresponding to the mode line clicked."
2627 nil nil mode-line))) 2622 nil nil mode-line)))
2628 2623
2629(define-derived-mode gdb-threads-mode gdb-parent-mode "Threads" 2624(define-derived-mode gdb-threads-mode gdb-parent-mode "Threads"
2630 "Major mode for GDB threads. 2625 "Major mode for GDB threads."
2631
2632\\{gdb-threads-mode-map}"
2633 (setq gdb-thread-position (make-marker)) 2626 (setq gdb-thread-position (make-marker))
2634 (add-to-list 'overlay-arrow-variable-list 'gdb-thread-position) 2627 (add-to-list 'overlay-arrow-variable-list 'gdb-thread-position)
2635 (setq header-line-format gdb-threads-header) 2628 (setq header-line-format gdb-threads-header)
2636 (set (make-local-variable 'font-lock-defaults) 2629 (set (make-local-variable 'font-lock-defaults)
2637 '(gdb-threads-font-lock-keywords)) 2630 '(gdb-threads-font-lock-keywords))
2638 (run-mode-hooks 'gdb-threads-mode-hook)
2639 'gdb-invalidate-threads) 2631 'gdb-invalidate-threads)
2640 2632
2641(defun gdb-thread-list-handler-custom () 2633(defun gdb-thread-list-handler-custom ()
@@ -3161,13 +3153,10 @@ DOC is an optional documentation string."
3161 "Header line used in `gdb-memory-mode'.") 3153 "Header line used in `gdb-memory-mode'.")
3162 3154
3163(define-derived-mode gdb-memory-mode gdb-parent-mode "Memory" 3155(define-derived-mode gdb-memory-mode gdb-parent-mode "Memory"
3164 "Major mode for examining memory. 3156 "Major mode for examining memory."
3165
3166\\{gdb-memory-mode-map}"
3167 (setq header-line-format gdb-memory-header) 3157 (setq header-line-format gdb-memory-header)
3168 (set (make-local-variable 'font-lock-defaults) 3158 (set (make-local-variable 'font-lock-defaults)
3169 '(gdb-memory-font-lock-keywords)) 3159 '(gdb-memory-font-lock-keywords))
3170 (run-mode-hooks 'gdb-memory-mode-hook)
3171 'gdb-invalidate-memory) 3160 'gdb-invalidate-memory)
3172 3161
3173(defun gdb-memory-buffer-name () 3162(defun gdb-memory-buffer-name ()
@@ -3256,16 +3245,13 @@ DOC is an optional documentation string."
3256 map)) 3245 map))
3257 3246
3258(define-derived-mode gdb-disassembly-mode gdb-parent-mode "Disassembly" 3247(define-derived-mode gdb-disassembly-mode gdb-parent-mode "Disassembly"
3259 "Major mode for GDB disassembly information. 3248 "Major mode for GDB disassembly information."
3260
3261\\{gdb-disassembly-mode-map}"
3262 ;; TODO Rename overlay variable for disassembly mode 3249 ;; TODO Rename overlay variable for disassembly mode
3263 (add-to-list 'overlay-arrow-variable-list 'gdb-disassembly-position) 3250 (add-to-list 'overlay-arrow-variable-list 'gdb-disassembly-position)
3264 (setq fringes-outside-margins t) 3251 (setq fringes-outside-margins t)
3265 (set (make-local-variable 'gdb-disassembly-position) (make-marker)) 3252 (set (make-local-variable 'gdb-disassembly-position) (make-marker))
3266 (set (make-local-variable 'font-lock-defaults) 3253 (set (make-local-variable 'font-lock-defaults)
3267 '(gdb-disassembly-font-lock-keywords)) 3254 '(gdb-disassembly-font-lock-keywords))
3268 (run-mode-hooks 'gdb-disassembly-mode-hook)
3269 'gdb-invalidate-disassembly) 3255 'gdb-invalidate-disassembly)
3270 3256
3271(defun gdb-disassembly-handler-custom () 3257(defun gdb-disassembly-handler-custom ()
@@ -3323,11 +3309,8 @@ DOC is an optional documentation string."
3323 3309
3324;;; Breakpoints view 3310;;; Breakpoints view
3325(define-derived-mode gdb-breakpoints-mode gdb-parent-mode "Breakpoints" 3311(define-derived-mode gdb-breakpoints-mode gdb-parent-mode "Breakpoints"
3326 "Major mode for gdb breakpoints. 3312 "Major mode for gdb breakpoints."
3327
3328\\{gdb-breakpoints-mode-map}"
3329 (setq header-line-format gdb-breakpoints-header) 3313 (setq header-line-format gdb-breakpoints-header)
3330 (run-mode-hooks 'gdb-breakpoints-mode-hook)
3331 'gdb-invalidate-breakpoints) 3314 'gdb-invalidate-breakpoints)
3332 3315
3333(defun gdb-toggle-breakpoint () 3316(defun gdb-toggle-breakpoint ()
@@ -3466,15 +3449,12 @@ member."
3466 "Font lock keywords used in `gdb-frames-mode'.") 3449 "Font lock keywords used in `gdb-frames-mode'.")
3467 3450
3468(define-derived-mode gdb-frames-mode gdb-parent-mode "Frames" 3451(define-derived-mode gdb-frames-mode gdb-parent-mode "Frames"
3469 "Major mode for gdb call stack. 3452 "Major mode for gdb call stack."
3470
3471\\{gdb-frames-mode-map}"
3472 (setq gdb-stack-position (make-marker)) 3453 (setq gdb-stack-position (make-marker))
3473 (add-to-list 'overlay-arrow-variable-list 'gdb-stack-position) 3454 (add-to-list 'overlay-arrow-variable-list 'gdb-stack-position)
3474 (setq truncate-lines t) ;; Make it easier to see overlay arrow. 3455 (setq truncate-lines t) ;; Make it easier to see overlay arrow.
3475 (set (make-local-variable 'font-lock-defaults) 3456 (set (make-local-variable 'font-lock-defaults)
3476 '(gdb-frames-font-lock-keywords)) 3457 '(gdb-frames-font-lock-keywords))
3477 (run-mode-hooks 'gdb-frames-mode-hook)
3478 'gdb-invalidate-frames) 3458 'gdb-invalidate-frames)
3479 3459
3480(defun gdb-select-frame (&optional event) 3460(defun gdb-select-frame (&optional event)
@@ -3588,11 +3568,8 @@ member."
3588 map)) 3568 map))
3589 3569
3590(define-derived-mode gdb-locals-mode gdb-parent-mode "Locals" 3570(define-derived-mode gdb-locals-mode gdb-parent-mode "Locals"
3591 "Major mode for gdb locals. 3571 "Major mode for gdb locals."
3592
3593\\{gdb-locals-mode-map}"
3594 (setq header-line-format gdb-locals-header) 3572 (setq header-line-format gdb-locals-header)
3595 (run-mode-hooks 'gdb-locals-mode-hook)
3596 'gdb-invalidate-locals) 3573 'gdb-invalidate-locals)
3597 3574
3598(defun gdb-locals-buffer-name () 3575(defun gdb-locals-buffer-name ()
@@ -3687,11 +3664,8 @@ member."
3687 nil nil mode-line))) 3664 nil nil mode-line)))
3688 3665
3689(define-derived-mode gdb-registers-mode gdb-parent-mode "Registers" 3666(define-derived-mode gdb-registers-mode gdb-parent-mode "Registers"
3690 "Major mode for gdb registers. 3667 "Major mode for gdb registers."
3691
3692\\{gdb-registers-mode-map}"
3693 (setq header-line-format gdb-registers-header) 3668 (setq header-line-format gdb-registers-header)
3694 (run-mode-hooks 'gdb-registers-mode-hook)
3695 'gdb-invalidate-registers) 3669 'gdb-invalidate-registers)
3696 3670
3697(defun gdb-registers-buffer-name () 3671(defun gdb-registers-buffer-name ()
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 8c35a13ac53..ef35b118be8 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -2533,7 +2533,7 @@ comint mode, which see."
2533 (gud-set-buffer)) 2533 (gud-set-buffer))
2534 2534
2535(defun gud-set-buffer () 2535(defun gud-set-buffer ()
2536 (when (eq major-mode 'gud-mode) 2536 (when (derived-mode-p 'gud-mode)
2537 (setq gud-comint-buffer (current-buffer)))) 2537 (setq gud-comint-buffer (current-buffer))))
2538 2538
2539(defvar gud-filter-defer-flag nil 2539(defvar gud-filter-defer-flag nil
@@ -3344,10 +3344,8 @@ only tooltips in the buffer containing the overlay arrow."
3344ACTIVATEP non-nil means activate mouse motion events." 3344ACTIVATEP non-nil means activate mouse motion events."
3345 (if activatep 3345 (if activatep
3346 (progn 3346 (progn
3347 (make-local-variable 'gud-tooltip-mouse-motions-active) 3347 (set (make-local-variable 'gud-tooltip-mouse-motions-active) t)
3348 (setq gud-tooltip-mouse-motions-active t) 3348 (set (make-local-variable 'track-mouse) t))
3349 (make-local-variable 'track-mouse)
3350 (setq track-mouse t))
3351 (when gud-tooltip-mouse-motions-active 3349 (when gud-tooltip-mouse-motions-active
3352 (kill-local-variable 'gud-tooltip-mouse-motions-active) 3350 (kill-local-variable 'gud-tooltip-mouse-motions-active)
3353 (kill-local-variable 'track-mouse)))) 3351 (kill-local-variable 'track-mouse))))
diff --git a/lisp/progmodes/icon.el b/lisp/progmodes/icon.el
index f0287c90188..b1c8dc2b336 100644
--- a/lisp/progmodes/icon.el
+++ b/lisp/progmodes/icon.el
@@ -131,7 +131,7 @@ when the TAB command is used."
131 131
132 132
133;;;###autoload 133;;;###autoload
134(defun icon-mode () 134(define-derived-mode icon-mode prog-mode "Icon"
135 "Major mode for editing Icon code. 135 "Major mode for editing Icon code.
136Expression and list commands understand all Icon brackets. 136Expression and list commands understand all Icon brackets.
137Tab indents for Icon code. 137Tab indents for Icon code.
@@ -163,49 +163,33 @@ Variables controlling indentation style:
163 163
164Turning on Icon mode calls the value of the variable `icon-mode-hook' 164Turning on Icon mode calls the value of the variable `icon-mode-hook'
165with no args, if that value is non-nil." 165with no args, if that value is non-nil."
166 (interactive) 166 :abbrev-table icon-mode-abbrev-table
167 (kill-all-local-variables) 167 (set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter))
168 (use-local-map icon-mode-map) 168 (set (make-local-variable 'paragraph-separate) paragraph-start)
169 (setq major-mode 'icon-mode) 169 (set (make-local-variable 'indent-line-function) #'icon-indent-line)
170 (setq mode-name "Icon") 170 (set (make-local-variable 'comment-start) "# ")
171 (setq local-abbrev-table icon-mode-abbrev-table) 171 (set (make-local-variable 'comment-end) "")
172 (set-syntax-table icon-mode-syntax-table) 172 (set (make-local-variable 'comment-start-skip) "# *")
173 (make-local-variable 'paragraph-start) 173 (set (make-local-variable 'comment-indent-function) 'icon-comment-indent)
174 (setq paragraph-start (concat "$\\|" page-delimiter))
175 (make-local-variable 'paragraph-separate)
176 (setq paragraph-separate paragraph-start)
177 (make-local-variable 'indent-line-function)
178 (setq indent-line-function 'icon-indent-line)
179 (make-local-variable 'require-final-newline)
180 (setq require-final-newline mode-require-final-newline)
181 (make-local-variable 'comment-start)
182 (setq comment-start "# ")
183 (make-local-variable 'comment-end)
184 (setq comment-end "")
185 (make-local-variable 'comment-start-skip)
186 (setq comment-start-skip "# *")
187 (make-local-variable 'comment-indent-function)
188 (setq comment-indent-function 'icon-comment-indent)
189 (set (make-local-variable 'indent-line-function) 'icon-indent-line) 174 (set (make-local-variable 'indent-line-function) 'icon-indent-line)
190 ;; font-lock support 175 ;; font-lock support
191 (setq font-lock-defaults 176 (set (make-local-variable 'font-lock-defaults)
192 '((icon-font-lock-keywords 177 '((icon-font-lock-keywords
193 icon-font-lock-keywords-1 icon-font-lock-keywords-2) 178 icon-font-lock-keywords-1 icon-font-lock-keywords-2)
194 nil nil ((?_ . "w")) beginning-of-defun 179 nil nil ((?_ . "w")) beginning-of-defun
195 ;; Obsoleted by Emacs 19.35 parse-partial-sexp's COMMENTSTOP. 180 ;; Obsoleted by Emacs 19.35 parse-partial-sexp's COMMENTSTOP.
196 ;(font-lock-comment-start-regexp . "#") 181 ;;(font-lock-comment-start-regexp . "#")
197 (font-lock-mark-block-function . mark-defun))) 182 (font-lock-mark-block-function . mark-defun)))
198 ;; imenu support 183 ;; imenu support
199 (make-local-variable 'imenu-generic-expression) 184 (set (make-local-variable 'imenu-generic-expression)
200 (setq imenu-generic-expression icon-imenu-generic-expression) 185 icon-imenu-generic-expression)
201 ;; hideshow support 186 ;; hideshow support
202 ;; we start from the assertion that `hs-special-modes-alist' is autoloaded. 187 ;; we start from the assertion that `hs-special-modes-alist' is autoloaded.
203 (unless (assq 'icon-mode hs-special-modes-alist) 188 (unless (assq 'icon-mode hs-special-modes-alist)
204 (setq hs-special-modes-alist 189 (setq hs-special-modes-alist
205 (cons '(icon-mode "\\<procedure\\>" "\\<end\\>" nil 190 (cons '(icon-mode "\\<procedure\\>" "\\<end\\>" nil
206 icon-forward-sexp-function) 191 icon-forward-sexp-function)
207 hs-special-modes-alist))) 192 hs-special-modes-alist))))
208 (run-mode-hooks 'icon-mode-hook))
209 193
210;; This is used by indent-for-comment to decide how much to 194;; This is used by indent-for-comment to decide how much to
211;; indent a comment in Icon code based on its context. 195;; indent a comment in Icon code based on its context.
diff --git a/lisp/progmodes/idlw-complete-structtag.el b/lisp/progmodes/idlw-complete-structtag.el
index 56b41541ee3..a2457eead0f 100644
--- a/lisp/progmodes/idlw-complete-structtag.el
+++ b/lisp/progmodes/idlw-complete-structtag.el
@@ -167,7 +167,7 @@ an up-to-date completion list."
167(defun idlwave-prepare-structure-tag-completion (var) 167(defun idlwave-prepare-structure-tag-completion (var)
168 "Find and parse the tag list for structure tag completion." 168 "Find and parse the tag list for structure tag completion."
169 ;; This works differently in source buffers and in the shell 169 ;; This works differently in source buffers and in the shell
170 (if (eq major-mode 'idlwave-shell-mode) 170 (if (derived-mode-p 'idlwave-shell-mode)
171 ;; OK, we are in the shell, do it dynamically 171 ;; OK, we are in the shell, do it dynamically
172 (progn 172 (progn
173 (message "preparing shell tags") 173 (message "preparing shell tags")
diff --git a/lisp/progmodes/idlw-help.el b/lisp/progmodes/idlw-help.el
index d7c14ccd4a8..0674ccf730a 100644
--- a/lisp/progmodes/idlw-help.el
+++ b/lisp/progmodes/idlw-help.el
@@ -288,7 +288,7 @@ support."
288(declare-function idlwave-what-module-find-class "idlwave") 288(declare-function idlwave-what-module-find-class "idlwave")
289(declare-function idlwave-where "idlwave") 289(declare-function idlwave-where "idlwave")
290 290
291(defun idlwave-help-mode () 291(define-derived-mode idlwave-help-mode special-mode "IDLWAVE Help"
292 "Major mode for displaying IDL Help. 292 "Major mode for displaying IDL Help.
293 293
294This is a VIEW mode for the ASCII version of IDL Help files, 294This is a VIEW mode for the ASCII version of IDL Help files,
@@ -308,11 +308,7 @@ Jump: [h] to function doclib header
308 308
309Here are all keybindings. 309Here are all keybindings.
310\\{idlwave-help-mode-map}" 310\\{idlwave-help-mode-map}"
311 (kill-all-local-variables)
312 (buffer-disable-undo) 311 (buffer-disable-undo)
313 (setq major-mode 'idlwave-help-mode
314 mode-name "IDLWAVE Help")
315 (use-local-map idlwave-help-mode-map)
316 (easy-menu-add idlwave-help-menu idlwave-help-mode-map) 312 (easy-menu-add idlwave-help-menu idlwave-help-mode-map)
317 (setq truncate-lines t) 313 (setq truncate-lines t)
318 (setq case-fold-search t) 314 (setq case-fold-search t)
@@ -325,8 +321,7 @@ Here are all keybindings.
325 (setq buffer-read-only t) 321 (setq buffer-read-only t)
326 (set (make-local-variable 'idlwave-help-def-pos) nil) 322 (set (make-local-variable 'idlwave-help-def-pos) nil)
327 (set (make-local-variable 'idlwave-help-args) nil) 323 (set (make-local-variable 'idlwave-help-args) nil)
328 (set (make-local-variable 'idlwave-help-in-header) nil) 324 (set (make-local-variable 'idlwave-help-in-header) nil))
329 (run-hooks 'idlwave-help-mode-hook))
330 325
331(defun idlwave-html-help-location () 326(defun idlwave-html-help-location ()
332 "Return the help directory where HTML files are, or nil if that is unknown." 327 "Return the help directory where HTML files are, or nil if that is unknown."
diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el
index 02eb0324cd8..0cad8cce517 100644
--- a/lisp/progmodes/idlw-shell.el
+++ b/lisp/progmodes/idlw-shell.el
@@ -866,7 +866,7 @@ IDL has currently stepped.")
866(defvar idlwave-shell-only-prompt-pattern nil) 866(defvar idlwave-shell-only-prompt-pattern nil)
867(defvar tool-bar-map) 867(defvar tool-bar-map)
868 868
869(defun idlwave-shell-mode () 869(define-derived-mode idlwave-shell-mode comint-mode "IDL-Shell"
870 "Major mode for interacting with an inferior IDL process. 870 "Major mode for interacting with an inferior IDL process.
871 871
8721. Shell Interaction 8721. Shell Interaction
@@ -947,28 +947,23 @@ IDL has currently stepped.")
9478. Keybindings 9478. Keybindings
948 ----------- 948 -----------
949\\{idlwave-shell-mode-map}" 949\\{idlwave-shell-mode-map}"
950 950 :abbrev-table idlwave-mode-abbrev-table
951 (interactive)
952 (idlwave-setup) ; Make sure config files and paths, etc. are available. 951 (idlwave-setup) ; Make sure config files and paths, etc. are available.
953 (unless (file-name-absolute-p idlwave-shell-command-history-file) 952 (unless (file-name-absolute-p idlwave-shell-command-history-file)
954 (setq idlwave-shell-command-history-file 953 (setq idlwave-shell-command-history-file
955 (expand-file-name idlwave-shell-command-history-file 954 (expand-file-name idlwave-shell-command-history-file
956 idlwave-config-directory))) 955 idlwave-config-directory)))
957 956
958 ;; We don't do `kill-all-local-variables' here, because this is done by
959 ;; comint
960 (setq comint-prompt-regexp idlwave-shell-prompt-pattern) 957 (setq comint-prompt-regexp idlwave-shell-prompt-pattern)
961 (setq comint-process-echoes t) 958 (setq comint-process-echoes t)
962 959
963 ;; Can not use history expansion because "!" is used for system variables. 960 ;; Can not use history expansion because "!" is used for system variables.
964 (setq comint-input-autoexpand nil) 961 (setq comint-input-autoexpand nil)
965; (setq comint-input-ring-size 64) 962 ;; (setq comint-input-ring-size 64)
966 (make-local-variable 'comint-completion-addsuffix) 963
967 (set (make-local-variable 'completion-ignore-case) t) 964 (set (make-local-variable 'completion-ignore-case) t)
968 (setq comint-completion-addsuffix '("/" . "")) 965 (set (make-local-variable 'comint-completion-addsuffix) '("/" . ""))
969 (setq comint-input-ignoredups t) 966 (setq comint-input-ignoredups t)
970 (setq major-mode 'idlwave-shell-mode)
971 (setq mode-name "IDL-Shell")
972 (setq idlwave-shell-mode-line-info nil) 967 (setq idlwave-shell-mode-line-info nil)
973 (setq mode-line-format 968 (setq mode-line-format
974 '("" 969 '(""
@@ -1023,7 +1018,6 @@ IDL has currently stepped.")
1023 nil 'local) 1018 nil 'local)
1024 (add-hook 'kill-buffer-hook 'idlwave-shell-delete-temp-files nil 'local) 1019 (add-hook 'kill-buffer-hook 'idlwave-shell-delete-temp-files nil 'local)
1025 (add-hook 'kill-emacs-hook 'idlwave-shell-delete-temp-files) 1020 (add-hook 'kill-emacs-hook 'idlwave-shell-delete-temp-files)
1026 (use-local-map idlwave-shell-mode-map)
1027 (easy-menu-add idlwave-shell-mode-menu idlwave-shell-mode-map) 1021 (easy-menu-add idlwave-shell-mode-menu idlwave-shell-mode-map)
1028 1022
1029 ;; Set the optional comint variables 1023 ;; Set the optional comint variables
@@ -1054,10 +1048,7 @@ IDL has currently stepped.")
1054 ;; with overlay-arrows. 1048 ;; with overlay-arrows.
1055 (remove-hook 'comint-output-filter-functions 'py-pdbtrack-track-stack-file) 1049 (remove-hook 'comint-output-filter-functions 'py-pdbtrack-track-stack-file)
1056 1050
1057
1058 ;; IDLWAVE syntax, and turn on abbreviations 1051 ;; IDLWAVE syntax, and turn on abbreviations
1059 (setq local-abbrev-table idlwave-mode-abbrev-table)
1060 (set-syntax-table idlwave-mode-syntax-table)
1061 (set (make-local-variable 'comment-start) ";") 1052 (set (make-local-variable 'comment-start) ";")
1062 (setq abbrev-mode t) 1053 (setq abbrev-mode t)
1063 1054
@@ -1076,8 +1067,6 @@ IDL has currently stepped.")
1076 ;; Turn off the non-debug toolbar buttons (open,save,etc.) 1067 ;; Turn off the non-debug toolbar buttons (open,save,etc.)
1077 (set (make-local-variable 'tool-bar-map) nil) 1068 (set (make-local-variable 'tool-bar-map) nil)
1078 1069
1079 ;; Run the hooks.
1080 (run-mode-hooks 'idlwave-shell-mode-hook)
1081 (idlwave-shell-send-command idlwave-shell-initial-commands nil 'hide) 1070 (idlwave-shell-send-command idlwave-shell-initial-commands nil 'hide)
1082 ;; Turn off IDL's ^d interpreting, and define a system 1071 ;; Turn off IDL's ^d interpreting, and define a system
1083 ;; variable which knows the version of IDLWAVE 1072 ;; variable which knows the version of IDLWAVE
@@ -3895,7 +3884,7 @@ handled by this command."
3895 (setq overlay-arrow-string nil) 3884 (setq overlay-arrow-string nil)
3896 (let (buf) 3885 (let (buf)
3897 (cond 3886 (cond
3898 ((eq major-mode 'idlwave-mode) 3887 ((derived-mode-p 'idlwave-mode)
3899 (save-buffer) 3888 (save-buffer)
3900 (setq idlwave-shell-last-save-and-action-file (buffer-file-name))) 3889 (setq idlwave-shell-last-save-and-action-file (buffer-file-name)))
3901 (idlwave-shell-last-save-and-action-file 3890 (idlwave-shell-last-save-and-action-file
@@ -4083,7 +4072,7 @@ of the form:
4083(defun idlwave-shell-file-name (name) 4072(defun idlwave-shell-file-name (name)
4084 "If `idlwave-shell-use-truename' is non-nil, convert file name to true name. 4073 "If `idlwave-shell-use-truename' is non-nil, convert file name to true name.
4085Otherwise, just expand the file name." 4074Otherwise, just expand the file name."
4086 (let ((def-dir (if (eq major-mode 'idlwave-shell-mode) 4075 (let ((def-dir (if (derived-mode-p 'idlwave-shell-mode)
4087 default-directory 4076 default-directory
4088 idlwave-shell-default-directory))) 4077 idlwave-shell-default-directory)))
4089 (if idlwave-shell-use-truename 4078 (if idlwave-shell-use-truename
@@ -4346,7 +4335,7 @@ idlwave-shell-electric-debug-mode-map)
4346 (while (setq buf (pop buffers)) 4335 (while (setq buf (pop buffers))
4347 (when (buffer-live-p buf) 4336 (when (buffer-live-p buf)
4348 (set-buffer buf) 4337 (set-buffer buf)
4349 (when (and (eq major-mode 'idlwave-mode) 4338 (when (and (derived-mode-p 'idlwave-mode)
4350 buffer-file-name 4339 buffer-file-name
4351 idlwave-shell-electric-debug-mode) 4340 idlwave-shell-electric-debug-mode)
4352 (idlwave-shell-electric-debug-mode 0)))))) 4341 (idlwave-shell-electric-debug-mode 0))))))
@@ -4371,51 +4360,51 @@ idlwave-shell-electric-debug-mode-map)
4371 ["Electric Debug Mode" 4360 ["Electric Debug Mode"
4372 idlwave-shell-electric-debug-mode 4361 idlwave-shell-electric-debug-mode
4373 :style toggle :selected idlwave-shell-electric-debug-mode 4362 :style toggle :selected idlwave-shell-electric-debug-mode
4374 :included (eq major-mode 'idlwave-mode) :keys "C-c C-d C-v"] 4363 :included (derived-mode-p 'idlwave-mode) :keys "C-c C-d C-v"]
4375 "--" 4364 "--"
4376 ("Compile & Run" 4365 ("Compile & Run"
4377 ["Save and .RUN" idlwave-shell-save-and-run 4366 ["Save and .RUN" idlwave-shell-save-and-run
4378 (or (eq major-mode 'idlwave-mode) 4367 (or (derived-mode-p 'idlwave-mode)
4379 idlwave-shell-last-save-and-action-file)] 4368 idlwave-shell-last-save-and-action-file)]
4380 ["Save and .COMPILE" idlwave-shell-save-and-compile 4369 ["Save and .COMPILE" idlwave-shell-save-and-compile
4381 (or (eq major-mode 'idlwave-mode) 4370 (or (derived-mode-p 'idlwave-mode)
4382 idlwave-shell-last-save-and-action-file)] 4371 idlwave-shell-last-save-and-action-file)]
4383 ["Save and @Batch" idlwave-shell-save-and-batch 4372 ["Save and @Batch" idlwave-shell-save-and-batch
4384 (or (eq major-mode 'idlwave-mode) 4373 (or (derived-mode-p 'idlwave-mode)
4385 idlwave-shell-last-save-and-action-file)] 4374 idlwave-shell-last-save-and-action-file)]
4386 "--" 4375 "--"
4387 ["Goto Next Error" idlwave-shell-goto-next-error t] 4376 ["Goto Next Error" idlwave-shell-goto-next-error t]
4388 "--" 4377 "--"
4389 ["Compile and Run Region" idlwave-shell-run-region 4378 ["Compile and Run Region" idlwave-shell-run-region
4390 (eq major-mode 'idlwave-mode)] 4379 (derived-mode-p 'idlwave-mode)]
4391 ["Evaluate Region" idlwave-shell-evaluate-region 4380 ["Evaluate Region" idlwave-shell-evaluate-region
4392 (eq major-mode 'idlwave-mode)] 4381 (derived-mode-p 'idlwave-mode)]
4393 "--" 4382 "--"
4394 ["Execute Default Cmd" idlwave-shell-execute-default-command-line t] 4383 ["Execute Default Cmd" idlwave-shell-execute-default-command-line t]
4395 ["Edit Default Cmd" idlwave-shell-edit-default-command-line t]) 4384 ["Edit Default Cmd" idlwave-shell-edit-default-command-line t])
4396 ("Breakpoints" 4385 ("Breakpoints"
4397 ["Set Breakpoint" idlwave-shell-break-here 4386 ["Set Breakpoint" idlwave-shell-break-here
4398 :keys "C-c C-d C-b" :active (eq major-mode 'idlwave-mode)] 4387 :keys "C-c C-d C-b" :active (derived-mode-p 'idlwave-mode)]
4399 ("Set Special Breakpoint" 4388 ("Set Special Breakpoint"
4400 ["Set After Count Breakpoint" 4389 ["Set After Count Breakpoint"
4401 (progn 4390 (progn
4402 (let ((count (string-to-number (read-string "Break after count: ")))) 4391 (let ((count (string-to-number (read-string "Break after count: "))))
4403 (if (integerp count) (idlwave-shell-break-here count)))) 4392 (if (integerp count) (idlwave-shell-break-here count))))
4404 :active (eq major-mode 'idlwave-mode)] 4393 :active (derived-mode-p 'idlwave-mode)]
4405 ["Set Condition Breakpoint" 4394 ["Set Condition Breakpoint"
4406 (idlwave-shell-break-here '(4)) 4395 (idlwave-shell-break-here '(4))
4407 :active (eq major-mode 'idlwave-mode)]) 4396 :active (derived-mode-p 'idlwave-mode)])
4408 ["Break in Module" idlwave-shell-break-in 4397 ["Break in Module" idlwave-shell-break-in
4409 :keys "C-c C-d C-i" :active (eq major-mode 'idlwave-mode)] 4398 :keys "C-c C-d C-i" :active (derived-mode-p 'idlwave-mode)]
4410 ["Break in this Module" idlwave-shell-break-this-module 4399 ["Break in this Module" idlwave-shell-break-this-module
4411 :keys "C-c C-d C-j" :active (eq major-mode 'idlwave-mode)] 4400 :keys "C-c C-d C-j" :active (derived-mode-p 'idlwave-mode)]
4412 ["Clear Breakpoint" idlwave-shell-clear-current-bp t] 4401 ["Clear Breakpoint" idlwave-shell-clear-current-bp t]
4413 ["Clear All Breakpoints" idlwave-shell-clear-all-bp t] 4402 ["Clear All Breakpoints" idlwave-shell-clear-all-bp t]
4414 ["Disable/Enable Breakpoint" idlwave-shell-toggle-enable-current-bp t] 4403 ["Disable/Enable Breakpoint" idlwave-shell-toggle-enable-current-bp t]
4415 ["Goto Previous Breakpoint" idlwave-shell-goto-previous-bp 4404 ["Goto Previous Breakpoint" idlwave-shell-goto-previous-bp
4416 :keys "C-c C-d [" :active (eq major-mode 'idlwave-mode)] 4405 :keys "C-c C-d [" :active (derived-mode-p 'idlwave-mode)]
4417 ["Goto Next Breakpoint" idlwave-shell-goto-next-bp 4406 ["Goto Next Breakpoint" idlwave-shell-goto-next-bp
4418 :keys "C-c C-d ]" :active (eq major-mode 'idlwave-mode)] 4407 :keys "C-c C-d ]" :active (derived-mode-p 'idlwave-mode)]
4419 ["List All Breakpoints" idlwave-shell-list-all-bp t] 4408 ["List All Breakpoints" idlwave-shell-list-all-bp t]
4420 ["Resync Breakpoints" idlwave-shell-bp-query t]) 4409 ["Resync Breakpoints" idlwave-shell-bp-query t])
4421 ("Continue/Step" 4410 ("Continue/Step"
@@ -4427,7 +4416,7 @@ idlwave-shell-electric-debug-mode-map)
4427 ["... to End of Subprog" idlwave-shell-return t] 4416 ["... to End of Subprog" idlwave-shell-return t]
4428 ["... to End of Subprog+1" idlwave-shell-out t] 4417 ["... to End of Subprog+1" idlwave-shell-out t]
4429 ["... to Here (Cursor Line)" idlwave-shell-to-here 4418 ["... to Here (Cursor Line)" idlwave-shell-to-here
4430 :keys "C-c C-d C-h" :active (eq major-mode 'idlwave-mode)]) 4419 :keys "C-c C-d C-h" :active (derived-mode-p 'idlwave-mode)])
4431 ("Examine Expressions" 4420 ("Examine Expressions"
4432 ["Print expression" idlwave-shell-print t] 4421 ["Print expression" idlwave-shell-print t]
4433 ["Help on expression" idlwave-shell-help-expression t] 4422 ["Help on expression" idlwave-shell-help-expression t]
@@ -4512,7 +4501,7 @@ idlwave-shell-electric-debug-mode-map)
4512 (save-current-buffer 4501 (save-current-buffer
4513 (dolist (buf (buffer-list)) 4502 (dolist (buf (buffer-list))
4514 (set-buffer buf) 4503 (set-buffer buf)
4515 (if (eq major-mode 'idlwave-mode) 4504 (if (derived-mode-p 'idlwave-mode)
4516 (progn 4505 (progn
4517 (easy-menu-remove idlwave-mode-debug-menu) 4506 (easy-menu-remove idlwave-mode-debug-menu)
4518 (easy-menu-add idlwave-mode-debug-menu))))))) 4507 (easy-menu-add idlwave-mode-debug-menu)))))))
diff --git a/lisp/progmodes/idlw-toolbar.el b/lisp/progmodes/idlw-toolbar.el
index 474065451d7..e6137e46860 100644
--- a/lisp/progmodes/idlw-toolbar.el
+++ b/lisp/progmodes/idlw-toolbar.el
@@ -807,7 +807,7 @@ static char * file[] = {
807 "Goto Next Error"] 807 "Goto Next Error"]
808 [idlwave-toolbar-stop-at-icon 808 [idlwave-toolbar-stop-at-icon
809 idlwave-shell-break-here 809 idlwave-shell-break-here
810 (eq major-mode 'idlwave-mode) 810 (derived-mode-p 'idlwave-mode)
811 "Set Breakpoint at selected position"] 811 "Set Breakpoint at selected position"]
812 [idlwave-toolbar-clear-at-icon 812 [idlwave-toolbar-clear-at-icon
813 idlwave-shell-clear-current-bp 813 idlwave-shell-clear-current-bp
@@ -819,7 +819,7 @@ static char * file[] = {
819 "Clear all Breakpoints"] 819 "Clear all Breakpoints"]
820 [idlwave-toolbar-stop-beginning-icon 820 [idlwave-toolbar-stop-beginning-icon
821 idlwave-shell-break-this-module 821 idlwave-shell-break-this-module
822 (eq major-mode 'idlwave-mode) 822 (derived-mode-p 'idlwave-mode)
823 "Stop at beginning of enclosing Routine"] 823 "Stop at beginning of enclosing Routine"]
824 [idlwave-toolbar-stop-in-icon 824 [idlwave-toolbar-stop-in-icon
825 idlwave-shell-break-in 825 idlwave-shell-break-in
@@ -839,7 +839,7 @@ static char * file[] = {
839 "Continue Current Program"] 839 "Continue Current Program"]
840 [idlwave-toolbar-to-here-icon 840 [idlwave-toolbar-to-here-icon
841 idlwave-shell-to-here 841 idlwave-shell-to-here
842 (eq major-mode 'idlwave-mode) 842 (derived-mode-p 'idlwave-mode)
843 "Continue to Here (cursor position)"] 843 "Continue to Here (cursor position)"]
844 [idlwave-toolbar-step-over-icon 844 [idlwave-toolbar-step-over-icon
845 idlwave-shell-stepover 845 idlwave-shell-stepover
@@ -871,7 +871,7 @@ static char * file[] = {
871 "Reset IDL (RETALL & CLOSE,/ALL and more)"] 871 "Reset IDL (RETALL & CLOSE,/ALL and more)"]
872 [idlwave-toolbar-electric-debug-icon 872 [idlwave-toolbar-electric-debug-icon
873 idlwave-shell-electric-debug-mode 873 idlwave-shell-electric-debug-mode
874 (eq major-mode 'idlwave-mode) 874 (derived-mode-p 'idlwave-mode)
875 "Toggle Electric Debug Mode"] 875 "Toggle Electric Debug Mode"]
876 )) 876 ))
877 877
@@ -884,8 +884,7 @@ static char * file[] = {
884 "Add the IDLWAVE toolbar if appropriate." 884 "Add the IDLWAVE toolbar if appropriate."
885 (if (and (featurep 'xemacs) ; This is a noop on Emacs 885 (if (and (featurep 'xemacs) ; This is a noop on Emacs
886 (boundp 'idlwave-toolbar-is-possible) 886 (boundp 'idlwave-toolbar-is-possible)
887 (or (eq major-mode 'idlwave-mode) 887 (derived-mode-p 'idlwave-mode 'idlwave-shell-mode))
888 (eq major-mode 'idlwave-shell-mode)))
889 (set-specifier default-toolbar (cons (current-buffer) 888 (set-specifier default-toolbar (cons (current-buffer)
890 idlwave-toolbar)))) 889 idlwave-toolbar))))
891 890
@@ -893,8 +892,7 @@ static char * file[] = {
893 "Add the IDLWAVE toolbar if appropriate." 892 "Add the IDLWAVE toolbar if appropriate."
894 (if (and (featurep 'xemacs) ; This is a noop on Emacs 893 (if (and (featurep 'xemacs) ; This is a noop on Emacs
895 (boundp 'idlwave-toolbar-is-possible) 894 (boundp 'idlwave-toolbar-is-possible)
896 (or (eq major-mode 'idlwave-mode) 895 (derived-mode-p 'idlwave-mode 'idlwave-shell-mode))
897 (eq major-mode 'idlwave-shell-mode)))
898 (remove-specifier default-toolbar (current-buffer)))) 896 (remove-specifier default-toolbar (current-buffer))))
899 897
900(defvar idlwave-shell-mode-map) 898(defvar idlwave-shell-mode-map)
diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el
index e05ea855636..4788cb30783 100644
--- a/lisp/progmodes/idlwave.el
+++ b/lisp/progmodes/idlwave.el
@@ -1776,7 +1776,7 @@ If NOPREFIX is non-nil, don't prepend prefix character. Installs into
1776(defvar idlwave-mode-debug-menu) 1776(defvar idlwave-mode-debug-menu)
1777 1777
1778;;;###autoload 1778;;;###autoload
1779(defun idlwave-mode () 1779(define-derived-mode idlwave-mode prog-mode "IDLWAVE"
1780 "Major mode for editing IDL source files (version 6.1_em22). 1780 "Major mode for editing IDL source files (version 6.1_em22).
1781 1781
1782The main features of this mode are 1782The main features of this mode are
@@ -1895,21 +1895,15 @@ The main features of this mode are
1895 followed by the key sequence to see what the key sequence does. 1895 followed by the key sequence to see what the key sequence does.
1896 1896
1897\\{idlwave-mode-map}" 1897\\{idlwave-mode-map}"
1898 1898 :abbrev-table idlwave-mode-abbrev-table
1899 (interactive)
1900 (kill-all-local-variables)
1901
1902 (if idlwave-startup-message 1899 (if idlwave-startup-message
1903 (message "Emacs IDLWAVE mode version %s." idlwave-mode-version)) 1900 (message "Emacs IDLWAVE mode version %s." idlwave-mode-version))
1904 (setq idlwave-startup-message nil) 1901 (setq idlwave-startup-message nil)
1905 1902
1906 (setq local-abbrev-table idlwave-mode-abbrev-table)
1907 (set-syntax-table idlwave-mode-syntax-table)
1908
1909 (set (make-local-variable 'indent-line-function) 'idlwave-indent-and-action) 1903 (set (make-local-variable 'indent-line-function) 'idlwave-indent-and-action)
1910 1904
1911 (make-local-variable idlwave-comment-indent-function) 1905 (set (make-local-variable idlwave-comment-indent-function)
1912 (set idlwave-comment-indent-function 'idlwave-comment-hook) 1906 #'idlwave-comment-hook)
1913 1907
1914 (set (make-local-variable 'comment-start-skip) ";+[ \t]*") 1908 (set (make-local-variable 'comment-start-skip) ";+[ \t]*")
1915 (set (make-local-variable 'comment-start) ";") 1909 (set (make-local-variable 'comment-start) ";")
@@ -1919,14 +1913,10 @@ The main features of this mode are
1919 (set (make-local-variable 'indent-tabs-mode) nil) 1913 (set (make-local-variable 'indent-tabs-mode) nil)
1920 (set (make-local-variable 'completion-ignore-case) t) 1914 (set (make-local-variable 'completion-ignore-case) t)
1921 1915
1922 (use-local-map idlwave-mode-map)
1923
1924 (when (featurep 'easymenu) 1916 (when (featurep 'easymenu)
1925 (easy-menu-add idlwave-mode-menu idlwave-mode-map) 1917 (easy-menu-add idlwave-mode-menu idlwave-mode-map)
1926 (easy-menu-add idlwave-mode-debug-menu idlwave-mode-map)) 1918 (easy-menu-add idlwave-mode-debug-menu idlwave-mode-map))
1927 1919
1928 (setq mode-name "IDLWAVE")
1929 (setq major-mode 'idlwave-mode)
1930 (setq abbrev-mode t) 1920 (setq abbrev-mode t)
1931 1921
1932 (set (make-local-variable idlwave-fill-function) 'idlwave-auto-fill) 1922 (set (make-local-variable idlwave-fill-function) 'idlwave-auto-fill)
@@ -1991,10 +1981,7 @@ The main features of this mode are
1991 (idlwave-new-buffer-update) 1981 (idlwave-new-buffer-update)
1992 1982
1993 ;; Check help location 1983 ;; Check help location
1994 (idlwave-help-check-locations) 1984 (idlwave-help-check-locations))
1995
1996 ;; Run the mode hook
1997 (run-mode-hooks 'idlwave-mode-hook))
1998 1985
1999(defvar idlwave-setup-done nil) 1986(defvar idlwave-setup-done nil)
2000(defun idlwave-setup () 1987(defun idlwave-setup ()
@@ -2543,7 +2530,7 @@ Point is placed at the beginning of the line whether or not this is an
2543actual statement." 2530actual statement."
2544 (interactive) 2531 (interactive)
2545 (cond 2532 (cond
2546 ((eq major-mode 'idlwave-shell-mode) 2533 ((derived-mode-p 'idlwave-shell-mode)
2547 (if (re-search-backward idlwave-shell-prompt-pattern nil t) 2534 (if (re-search-backward idlwave-shell-prompt-pattern nil t)
2548 (goto-char (match-end 0)))) 2535 (goto-char (match-end 0))))
2549 (t 2536 (t
@@ -3732,7 +3719,7 @@ expression to enter.
3732 3719
3733The lines containing S1 and S2 are reindented using `indent-region' 3720The lines containing S1 and S2 are reindented using `indent-region'
3734unless the optional second argument NOINDENT is non-nil." 3721unless the optional second argument NOINDENT is non-nil."
3735 (if (eq major-mode 'idlwave-shell-mode) 3722 (if (derived-mode-p 'idlwave-shell-mode)
3736 ;; This is a gross hack to avoit template abbrev expansion 3723 ;; This is a gross hack to avoit template abbrev expansion
3737 ;; in the shell. FIXME: This is a dirty hack. 3724 ;; in the shell. FIXME: This is a dirty hack.
3738 (if (and (eq this-command 'self-insert-command) 3725 (if (and (eq this-command 'self-insert-command)
@@ -5088,7 +5075,7 @@ Cache to disk for quick recovery."
5088 (setq res nil)) 5075 (setq res nil))
5089 (t 5076 (t
5090 ;; Just scan this buffer 5077 ;; Just scan this buffer
5091 (if (eq major-mode 'idlwave-mode) 5078 (if (derived-mode-p 'idlwave-mode)
5092 (progn 5079 (progn
5093 (message "Scanning current buffer...") 5080 (message "Scanning current buffer...")
5094 (setq res (idlwave-get-routine-info-from-buffers 5081 (setq res (idlwave-get-routine-info-from-buffers
@@ -5142,7 +5129,7 @@ Cache to disk for quick recovery."
5142(defun idlwave-update-current-buffer-info (why) 5129(defun idlwave-update-current-buffer-info (why)
5143 "Update `idlwave-routines' for current buffer. 5130 "Update `idlwave-routines' for current buffer.
5144Can run from `after-save-hook'." 5131Can run from `after-save-hook'."
5145 (when (and (eq major-mode 'idlwave-mode) 5132 (when (and (derived-mode-p 'idlwave-mode)
5146 (or (eq t idlwave-auto-routine-info-updates) 5133 (or (eq t idlwave-auto-routine-info-updates)
5147 (memq why idlwave-auto-routine-info-updates)) 5134 (memq why idlwave-auto-routine-info-updates))
5148 idlwave-scan-all-buffers-for-routine-info 5135 idlwave-scan-all-buffers-for-routine-info
@@ -5188,7 +5175,7 @@ Can run from `after-save-hook'."
5188 (save-excursion 5175 (save-excursion
5189 (while (setq buf (pop buffers)) 5176 (while (setq buf (pop buffers))
5190 (set-buffer buf) 5177 (set-buffer buf)
5191 (if (and (eq major-mode 'idlwave-mode) 5178 (if (and (derived-mode-p 'idlwave-mode)
5192 buffer-file-name) 5179 buffer-file-name)
5193 ;; yes, this buffer has the right mode. 5180 ;; yes, this buffer has the right mode.
5194 (progn (setq res (condition-case nil 5181 (progn (setq res (condition-case nil
@@ -7030,7 +7017,7 @@ sort the list before displaying."
7030 "Call FUNCTION as a completion chooser and pass ARGS to it." 7017 "Call FUNCTION as a completion chooser and pass ARGS to it."
7031 (let ((completion-ignore-case t)) ; install correct value 7018 (let ((completion-ignore-case t)) ; install correct value
7032 (apply function args)) 7019 (apply function args))
7033 (if (and (eq major-mode 'idlwave-shell-mode) 7020 (if (and (derived-mode-p 'idlwave-shell-mode)
7034 (boundp 'font-lock-mode) 7021 (boundp 'font-lock-mode)
7035 (not font-lock-mode)) 7022 (not font-lock-mode))
7036 ;; For the shell, remove the fontification of the word before point 7023 ;; For the shell, remove the fontification of the word before point
@@ -7431,7 +7418,7 @@ class/struct definition."
7431 ;; Read the file in temporarily 7418 ;; Read the file in temporarily
7432 (set-buffer (get-buffer-create " *IDLWAVE-tmp*")) 7419 (set-buffer (get-buffer-create " *IDLWAVE-tmp*"))
7433 (erase-buffer) 7420 (erase-buffer)
7434 (unless (eq major-mode 'idlwave-mode) 7421 (unless (derived-mode-p 'idlwave-mode)
7435 (idlwave-mode)) 7422 (idlwave-mode))
7436 (insert-file-contents file)) 7423 (insert-file-contents file))
7437 (save-excursion 7424 (save-excursion
@@ -8183,8 +8170,7 @@ demand _EXTRA in the keyword list."
8183 ;; If this is the OBJ_NEW function, try to figure out the class and use 8170 ;; If this is the OBJ_NEW function, try to figure out the class and use
8184 ;; the keywords from the corresponding INIT method. 8171 ;; the keywords from the corresponding INIT method.
8185 (if (and (equal (upcase name) "OBJ_NEW") 8172 (if (and (equal (upcase name) "OBJ_NEW")
8186 (or (eq major-mode 'idlwave-mode) 8173 (derived-mode-p 'idlwave-mode 'idlwave-shell-mode))
8187 (eq major-mode 'idlwave-shell-mode)))
8188 (let* ((bos (save-excursion (idlwave-beginning-of-statement) (point))) 8174 (let* ((bos (save-excursion (idlwave-beginning-of-statement) (point)))
8189 (string (buffer-substring bos (point))) 8175 (string (buffer-substring bos (point)))
8190 (case-fold-search t) 8176 (case-fold-search t)
@@ -8634,7 +8620,7 @@ was pressed."
8634 "List the load path shadows of all routines defined in current buffer." 8620 "List the load path shadows of all routines defined in current buffer."
8635 (interactive "P") 8621 (interactive "P")
8636 (idlwave-routines) 8622 (idlwave-routines)
8637 (if (eq major-mode 'idlwave-mode) 8623 (if (derived-mode-p 'idlwave-mode)
8638 (idlwave-list-load-path-shadows 8624 (idlwave-list-load-path-shadows
8639 nil (idlwave-update-current-buffer-info 'save-buffer) 8625 nil (idlwave-update-current-buffer-info 'save-buffer)
8640 "in current buffer") 8626 "in current buffer")
diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el
index 41ce378e966..109bda80170 100644
--- a/lisp/progmodes/inf-lisp.el
+++ b/lisp/progmodes/inf-lisp.el
@@ -216,7 +216,7 @@ buffer with \\[set-variable].")
216 216
217(put 'inferior-lisp-mode 'mode-class 'special) 217(put 'inferior-lisp-mode 'mode-class 'special)
218 218
219(defun inferior-lisp-mode () 219(define-derived-mode inferior-lisp-mode comint-mode "Inferior Lisp"
220 "Major mode for interacting with an inferior Lisp process. 220 "Major mode for interacting with an inferior Lisp process.
221Runs a Lisp interpreter as a subprocess of Emacs, with Lisp I/O through an 221Runs a Lisp interpreter as a subprocess of Emacs, with Lisp I/O through an
222Emacs buffer. Variable `inferior-lisp-program' controls which Lisp interpreter 222Emacs buffer. Variable `inferior-lisp-program' controls which Lisp interpreter
@@ -263,18 +263,11 @@ If `comint-use-prompt-regexp' is nil (the default), \\[comint-insert-input] on o
263Paragraphs are separated only by blank lines. Semicolons start comments. 263Paragraphs are separated only by blank lines. Semicolons start comments.
264If you accidentally suspend your process, use \\[comint-continue-subjob] 264If you accidentally suspend your process, use \\[comint-continue-subjob]
265to continue it." 265to continue it."
266 (interactive)
267 (delay-mode-hooks
268 (comint-mode))
269 (setq comint-prompt-regexp inferior-lisp-prompt) 266 (setq comint-prompt-regexp inferior-lisp-prompt)
270 (setq major-mode 'inferior-lisp-mode)
271 (setq mode-name "Inferior Lisp")
272 (setq mode-line-process '(":%s")) 267 (setq mode-line-process '(":%s"))
273 (lisp-mode-variables t) 268 (lisp-mode-variables t)
274 (use-local-map inferior-lisp-mode-map) ;c-c c-k for "kompile" file
275 (setq comint-get-old-input (function lisp-get-old-input)) 269 (setq comint-get-old-input (function lisp-get-old-input))
276 (setq comint-input-filter (function lisp-input-filter)) 270 (setq comint-input-filter (function lisp-input-filter)))
277 (run-mode-hooks 'inferior-lisp-mode-hook))
278 271
279(defun lisp-get-old-input () 272(defun lisp-get-old-input ()
280 "Return a string containing the sexp ending at point." 273 "Return a string containing the sexp ending at point."
@@ -600,7 +593,7 @@ See variable `lisp-describe-sym-command'."
600;; "Returns the current inferior Lisp process. 593;; "Returns the current inferior Lisp process.
601;; See variable `inferior-lisp-buffer'." 594;; See variable `inferior-lisp-buffer'."
602(defun inferior-lisp-proc () 595(defun inferior-lisp-proc ()
603 (let ((proc (get-buffer-process (if (eq major-mode 'inferior-lisp-mode) 596 (let ((proc (get-buffer-process (if (derived-mode-p 'inferior-lisp-mode)
604 (current-buffer) 597 (current-buffer)
605 inferior-lisp-buffer)))) 598 inferior-lisp-buffer))))
606 (or proc 599 (or proc
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 6114a0e15b2..fdb11aa7d88 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -2135,7 +2135,7 @@ and each value is a marker giving the location of that symbol."
2135 with imenu-use-markers = t 2135 with imenu-use-markers = t
2136 for buffer being the buffers 2136 for buffer being the buffers
2137 for imenu-index = (with-current-buffer buffer 2137 for imenu-index = (with-current-buffer buffer
2138 (when (eq major-mode 'js-mode) 2138 (when (derived-mode-p 'js-mode)
2139 (js--imenu-create-index))) 2139 (js--imenu-create-index)))
2140 do (js--imenu-to-flat imenu-index "" symbols) 2140 do (js--imenu-to-flat imenu-index "" symbols)
2141 finally return symbols)) 2141 finally return symbols))
@@ -3286,15 +3286,9 @@ If one hasn't been set, or if it's stale, prompt for a new one."
3286;;; Main Function 3286;;; Main Function
3287 3287
3288;;;###autoload 3288;;;###autoload
3289(define-derived-mode js-mode prog-mode "js" 3289(define-derived-mode js-mode prog-mode "Javascript"
3290 "Major mode for editing JavaScript. 3290 "Major mode for editing JavaScript."
3291
3292Key bindings:
3293
3294\\{js-mode-map}"
3295
3296 :group 'js 3291 :group 'js
3297 :syntax-table js-mode-syntax-table
3298 3292
3299 (set (make-local-variable 'indent-line-function) 'js-indent-line) 3293 (set (make-local-variable 'indent-line-function) 'js-indent-line)
3300 (set (make-local-variable 'beginning-of-defun-function) 3294 (set (make-local-variable 'beginning-of-defun-function)
@@ -3330,9 +3324,6 @@ Key bindings:
3330 (set (make-local-variable 'imenu-create-index-function) 3324 (set (make-local-variable 'imenu-create-index-function)
3331 #'js--imenu-create-index) 3325 #'js--imenu-create-index)
3332 3326
3333 (setq major-mode 'js-mode)
3334 (setq mode-name "Javascript")
3335
3336 ;; for filling, pretend we're cc-mode 3327 ;; for filling, pretend we're cc-mode
3337 (setq c-comment-prefix-regexp "//+\\|\\**" 3328 (setq c-comment-prefix-regexp "//+\\|\\**"
3338 c-paragraph-start "$" 3329 c-paragraph-start "$"
@@ -3363,10 +3354,9 @@ Key bindings:
3363 ;; the buffer containing the problem, JIT-lock will apply the 3354 ;; the buffer containing the problem, JIT-lock will apply the
3364 ;; correct syntax to the regular expresion literal and the problem 3355 ;; correct syntax to the regular expresion literal and the problem
3365 ;; will mysteriously disappear. 3356 ;; will mysteriously disappear.
3366 (font-lock-set-defaults) 3357 ;; FIXME: We should actually do this fontification lazily by adding
3367 3358 ;; calls to syntax-propertize wherever it's really needed.
3368 (let (font-lock-keywords) ; leaves syntactic keywords intact 3359 (syntax-propertize (point-max)))
3369 (font-lock-fontify-buffer)))
3370 3360
3371;;;###autoload 3361;;;###autoload
3372(defalias 'javascript-mode 'js-mode) 3362(defalias 'javascript-mode 'js-mode)
diff --git a/lisp/progmodes/m4-mode.el b/lisp/progmodes/m4-mode.el
index 07b6656bde0..39c46d69aea 100644
--- a/lisp/progmodes/m4-mode.el
+++ b/lisp/progmodes/m4-mode.el
@@ -143,27 +143,12 @@
143 (switch-to-buffer-other-window "*m4-output*")) 143 (switch-to-buffer-other-window "*m4-output*"))
144 144
145;;;###autoload 145;;;###autoload
146(defun m4-mode () 146(define-derived-mode m4-mode prog-mode "m4"
147 "A major mode to edit m4 macro files. 147 "A major mode to edit m4 macro files."
148\\{m4-mode-map} 148 :abbrev-table m4-mode-abbrev-table
149" 149 (set (make-local-variable 'comment-start) "#")
150 (interactive) 150 (set (make-local-variable 'parse-sexp-ignore-comments) t)
151 (kill-all-local-variables) 151 (set (make-local-variable 'font-lock-defaults) '(m4-font-lock-keywords nil)))
152 (use-local-map m4-mode-map)
153
154 (make-local-variable 'comment-start)
155 (setq comment-start "#")
156 (make-local-variable 'parse-sexp-ignore-comments)
157 (setq parse-sexp-ignore-comments t)
158 (setq local-abbrev-table m4-mode-abbrev-table)
159
160 (make-local-variable 'font-lock-defaults)
161 (setq major-mode 'm4-mode
162 mode-name "m4"
163 font-lock-defaults '(m4-font-lock-keywords nil)
164 )
165 (set-syntax-table m4-mode-syntax-table)
166 (run-mode-hooks 'm4-mode-hook))
167 152
168(provide 'm4-mode) 153(provide 'm4-mode)
169;;stuff to play with for debugging 154;;stuff to play with for debugging
diff --git a/lisp/progmodes/meta-mode.el b/lisp/progmodes/meta-mode.el
index 294c75c9ccf..7e679f7fe31 100644
--- a/lisp/progmodes/meta-mode.el
+++ b/lisp/progmodes/meta-mode.el
@@ -474,6 +474,7 @@ If the list was changed, sort the list and remove duplicates first."
474 474
475(defun meta-complete-symbol () 475(defun meta-complete-symbol ()
476 "Perform completion on Metafont or MetaPost symbol preceding point." 476 "Perform completion on Metafont or MetaPost symbol preceding point."
477 ;; FIXME: Use completion-at-point-functions.
477 (interactive "*") 478 (interactive "*")
478 (let ((list meta-complete-list) 479 (let ((list meta-complete-list)
479 entry) 480 entry)
@@ -844,11 +845,10 @@ The environment marked is the one that contains point or follows point."
844 845
845;;; Syntax table, keymap and menu. 846;;; Syntax table, keymap and menu.
846 847
847(defvar meta-mode-abbrev-table nil 848(define-abbrev-table 'meta-mode-abbrev-table ()
848 "Abbrev table used in Metafont or MetaPost mode.") 849 "Abbrev table used in Metafont or MetaPost mode.")
849(define-abbrev-table 'meta-mode-abbrev-table ())
850 850
851(defvar meta-mode-syntax-table 851(defvar meta-common-mode-syntax-table
852 (let ((st (make-syntax-table))) 852 (let ((st (make-syntax-table)))
853 ;; underscores are word constituents 853 ;; underscores are word constituents
854 (modify-syntax-entry ?_ "w" st) 854 (modify-syntax-entry ?_ "w" st)
@@ -885,9 +885,8 @@ The environment marked is the one that contains point or follows point."
885 st) 885 st)
886 "Syntax table used in Metafont or MetaPost mode.") 886 "Syntax table used in Metafont or MetaPost mode.")
887 887
888(defvar meta-mode-map 888(defvar meta-common-mode-map
889 (let ((map (make-sparse-keymap))) 889 (let ((map (make-sparse-keymap)))
890 (define-key map "\C-m" 'reindent-then-newline-and-indent)
891 ;; Comment Paragraphs: 890 ;; Comment Paragraphs:
892 ;; (define-key map "\M-a" 'backward-sentence) 891 ;; (define-key map "\M-a" 'backward-sentence)
893 ;; (define-key map "\M-e" 'forward-sentence) 892 ;; (define-key map "\M-e" 'forward-sentence)
@@ -915,10 +914,10 @@ The environment marked is the one that contains point or follows point."
915 ;; (define-key map "\C-c\C-l" 'meta-recenter-output) 914 ;; (define-key map "\C-c\C-l" 'meta-recenter-output)
916 map) 915 map)
917 "Keymap used in Metafont or MetaPost mode.") 916 "Keymap used in Metafont or MetaPost mode.")
918 917(define-obsolete-variable-alias 'meta-mode-map 'meta-common-mode-map "24.1")
919 918
920(easy-menu-define 919(easy-menu-define
921 meta-mode-menu meta-mode-map 920 meta-mode-menu meta-common-mode-map
922 "Menu used in Metafont or MetaPost mode." 921 "Menu used in Metafont or MetaPost mode."
923 (list "Meta" 922 (list "Meta"
924 ["Forward Environment" meta-beginning-of-defun t] 923 ["Forward Environment" meta-beginning-of-defun t]
@@ -976,106 +975,62 @@ The environment marked is the one that contains point or follows point."
976 975
977;;; Initialization. 976;;; Initialization.
978 977
979(defun meta-common-initialization () 978(define-derived-mode meta-common-mode prog-mode "-Meta-common-"
980 "Common initialization for Metafont or MetaPost mode." 979 "Common initialization for Metafont or MetaPost mode."
981 (kill-all-local-variables) 980 :abbrev-table meta-mode-abbrev-table
982 981 (set (make-local-variable 'paragraph-start)
983 (make-local-variable 'paragraph-start) 982 (concat page-delimiter "\\|$"))
984 (make-local-variable 'paragraph-separate) 983 (set (make-local-variable 'paragraph-separate)
985 (setq paragraph-start 984 (concat page-delimiter "\\|$"))
986 (concat page-delimiter "\\|$")) 985
987 (setq paragraph-separate 986 (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
988 (concat page-delimiter "\\|$")) 987
989 988 (set (make-local-variable 'comment-start-skip) "%+[ \t\f]*")
990 (make-local-variable 'paragraph-ignore-fill-prefix) 989 (set (make-local-variable 'comment-start) "%")
991 (setq paragraph-ignore-fill-prefix t) 990 (set (make-local-variable 'comment-end) "")
992 991 (set (make-local-variable 'comment-multi-line) nil)
993 (make-local-variable 'comment-start-skip)
994 (make-local-variable 'comment-start)
995 (make-local-variable 'comment-end)
996 (make-local-variable 'comment-multi-line)
997 (setq comment-start-skip "%+[ \t\f]*")
998 (setq comment-start "%")
999 (setq comment-end "")
1000 (setq comment-multi-line nil)
1001 992
1002 ;; We use `back-to-indentation' but \f is no indentation sign. 993 ;; We use `back-to-indentation' but \f is no indentation sign.
1003 (modify-syntax-entry ?\f "_ ") 994 (modify-syntax-entry ?\f "_ ")
1004 995
1005 (make-local-variable 'parse-sexp-ignore-comments) 996 (set (make-local-variable 'parse-sexp-ignore-comments) t)
1006 (setq parse-sexp-ignore-comments t)
1007 997
1008 (make-local-variable 'comment-indent-function) 998 (set (make-local-variable 'comment-indent-function) #'meta-comment-indent)
1009 (setq comment-indent-function 'meta-comment-indent) 999 (set (make-local-variable 'indent-line-function) #'meta-indent-line)
1010 (make-local-variable 'indent-line-function)
1011 (setq indent-line-function 'meta-indent-line)
1012 ;; No need to define a mode-specific 'indent-region-function. 1000 ;; No need to define a mode-specific 'indent-region-function.
1013 ;; Simply use the generic 'indent-region and 'comment-region. 1001 ;; Simply use the generic 'indent-region and 'comment-region.
1014 1002
1015 ;; Set defaults for font-lock mode. 1003 ;; Set defaults for font-lock mode.
1016 (make-local-variable 'font-lock-defaults) 1004 (set (make-local-variable 'font-lock-defaults)
1017 (setq font-lock-defaults 1005 '(meta-font-lock-keywords
1018 '(meta-font-lock-keywords 1006 nil nil ((?_ . "w")) nil
1019 nil nil ((?_ . "w")) nil 1007 (font-lock-comment-start-regexp . "%")))
1020 (font-lock-comment-start-regexp . "%")))
1021 1008
1022 ;; Activate syntax table, keymap and menu. 1009 ;; Activate syntax table, keymap and menu.
1023 (setq local-abbrev-table meta-mode-abbrev-table) 1010 (easy-menu-add meta-mode-menu))
1024 (set-syntax-table meta-mode-syntax-table)
1025 (use-local-map meta-mode-map)
1026 (easy-menu-add meta-mode-menu)
1027 )
1028 1011
1029 1012
1030;;;###autoload 1013;;;###autoload
1031(defun metafont-mode () 1014(define-derived-mode metafont-mode meta-common-mode "Metafont"
1032 "Major mode for editing Metafont sources. 1015 "Major mode for editing Metafont sources."
1033Special commands:
1034\\{meta-mode-map}
1035
1036Turning on Metafont mode calls the value of the variables
1037`meta-common-mode-hook' and `metafont-mode-hook'."
1038 (interactive)
1039 (meta-common-initialization)
1040 (setq mode-name "Metafont")
1041 (setq major-mode 'metafont-mode)
1042
1043 ;; Set defaults for completion function. 1016 ;; Set defaults for completion function.
1044 (make-local-variable 'meta-symbol-list) 1017 (set (make-local-variable 'meta-symbol-list) nil)
1045 (make-local-variable 'meta-symbol-changed) 1018 (set (make-local-variable 'meta-symbol-changed) nil)
1046 (make-local-variable 'meta-complete-list)
1047 (setq meta-symbol-list nil)
1048 (setq meta-symbol-changed nil)
1049 (apply 'meta-add-symbols metafont-symbol-list) 1019 (apply 'meta-add-symbols metafont-symbol-list)
1050 (setq meta-complete-list 1020 (set (make-local-variable 'meta-complete-list)
1051 (list (list "\\<\\(\\sw+\\)" 1 'meta-symbol-list) 1021 (list (list "\\<\\(\\sw+\\)" 1 'meta-symbol-list)
1052 (list "" 'ispell-complete-word))) 1022 (list "" 'ispell-complete-word))))
1053 (run-mode-hooks 'meta-common-mode-hook 'metafont-mode-hook))
1054 1023
1055;;;###autoload 1024;;;###autoload
1056(defun metapost-mode () 1025(define-derived-mode metapost-mode meta-common-mode "MetaPost"
1057 "Major mode for editing MetaPost sources. 1026 "Major mode for editing MetaPost sources."
1058Special commands:
1059\\{meta-mode-map}
1060
1061Turning on MetaPost mode calls the value of the variable
1062`meta-common-mode-hook' and `metafont-mode-hook'."
1063 (interactive)
1064 (meta-common-initialization)
1065 (setq mode-name "MetaPost")
1066 (setq major-mode 'metapost-mode)
1067
1068 ;; Set defaults for completion function. 1027 ;; Set defaults for completion function.
1069 (make-local-variable 'meta-symbol-list) 1028 (set (make-local-variable 'meta-symbol-list) nil)
1070 (make-local-variable 'meta-symbol-changed) 1029 (set (make-local-variable 'meta-symbol-changed) nil)
1071 (make-local-variable 'meta-complete-list)
1072 (setq meta-symbol-list nil)
1073 (setq meta-symbol-changed nil)
1074 (apply 'meta-add-symbols metapost-symbol-list) 1030 (apply 'meta-add-symbols metapost-symbol-list)
1075 (setq meta-complete-list 1031 (set (make-local-variable 'meta-complete-list)
1076 (list (list "\\<\\(\\sw+\\)" 1 'meta-symbol-list) 1032 (list (list "\\<\\(\\sw+\\)" 1 'meta-symbol-list)
1077 (list "" 'ispell-complete-word))) 1033 (list "" 'ispell-complete-word))))
1078 (run-mode-hooks 'meta-common-mode-hook 'metapost-mode-hook))
1079 1034
1080 1035
1081;;; Just in case ... 1036;;; Just in case ...
diff --git a/lisp/progmodes/mixal-mode.el b/lisp/progmodes/mixal-mode.el
index f2a7aa045e4..bdf222376ff 100644
--- a/lisp/progmodes/mixal-mode.el
+++ b/lisp/progmodes/mixal-mode.el
@@ -1106,8 +1106,7 @@ Assumes that file has been compiled with debugging support."
1106 1106
1107;;;###autoload 1107;;;###autoload
1108(define-derived-mode mixal-mode fundamental-mode "mixal" 1108(define-derived-mode mixal-mode fundamental-mode "mixal"
1109 "Major mode for the mixal asm language. 1109 "Major mode for the mixal asm language."
1110\\{mixal-mode-map}"
1111 (set (make-local-variable 'comment-start) "*") 1110 (set (make-local-variable 'comment-start) "*")
1112 (set (make-local-variable 'comment-start-skip) "^\\*[ \t]*") 1111 (set (make-local-variable 'comment-start-skip) "^\\*[ \t]*")
1113 (set (make-local-variable 'font-lock-defaults) 1112 (set (make-local-variable 'font-lock-defaults)
@@ -1117,11 +1116,7 @@ Assumes that file has been compiled with debugging support."
1117 ;; might add an indent function in the future 1116 ;; might add an indent function in the future
1118 ;; (set (make-local-variable 'indent-line-function) 'mixal-indent-line) 1117 ;; (set (make-local-variable 'indent-line-function) 'mixal-indent-line)
1119 (set (make-local-variable 'compile-command) (concat "mixasm " 1118 (set (make-local-variable 'compile-command) (concat "mixasm "
1120 buffer-file-name)) 1119 buffer-file-name)))
1121 ;; mixasm will do strange when there is no final newline,
1122 ;; so let Emacs ensure that it is always there
1123 (set (make-local-variable 'require-final-newline)
1124 mode-require-final-newline))
1125 1120
1126(provide 'mixal-mode) 1121(provide 'mixal-mode)
1127 1122
diff --git a/lisp/progmodes/modula2.el b/lisp/progmodes/modula2.el
index c6ab5347065..2fc3bc59d88 100644
--- a/lisp/progmodes/modula2.el
+++ b/lisp/progmodes/modula2.el
@@ -308,8 +308,6 @@ followed by the first character of the construct.
308 `m2-indent' controls the number of spaces for each indentation. 308 `m2-indent' controls the number of spaces for each indentation.
309 `m2-compile-command' holds the command to compile a Modula-2 program. 309 `m2-compile-command' holds the command to compile a Modula-2 program.
310 `m2-link-command' holds the command to link a Modula-2 program." 310 `m2-link-command' holds the command to link a Modula-2 program."
311 (make-local-variable 'm2-end-comment-column)
312
313 (set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter)) 311 (set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter))
314 (set (make-local-variable 'paragraph-separate) paragraph-start) 312 (set (make-local-variable 'paragraph-separate) paragraph-start)
315 (set (make-local-variable 'paragraph-ignore-fill-prefix) t) 313 (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
diff --git a/lisp/progmodes/octave-inf.el b/lisp/progmodes/octave-inf.el
index c526a634d86..1003ffd6460 100644
--- a/lisp/progmodes/octave-inf.el
+++ b/lisp/progmodes/octave-inf.el
@@ -121,34 +121,24 @@ the regular expression `comint-prompt-regexp', a buffer local variable."
121This variable is used to initialize `comint-dynamic-complete-functions' 121This variable is used to initialize `comint-dynamic-complete-functions'
122in the Inferior Octave buffer.") 122in the Inferior Octave buffer.")
123 123
124(defun inferior-octave-mode () 124(define-derived-mode inferior-octave-mode comint-mode "Inferior Octave"
125 "Major mode for interacting with an inferior Octave process. 125 "Major mode for interacting with an inferior Octave process.
126Runs Octave as a subprocess of Emacs, with Octave I/O through an Emacs 126Runs Octave as a subprocess of Emacs, with Octave I/O through an Emacs
127buffer. 127buffer.
128 128
129Entry to this mode successively runs the hooks `comint-mode-hook' and 129Entry to this mode successively runs the hooks `comint-mode-hook' and
130`inferior-octave-mode-hook'." 130`inferior-octave-mode-hook'."
131 (interactive)
132 (delay-mode-hooks (comint-mode))
133 (setq comint-prompt-regexp inferior-octave-prompt 131 (setq comint-prompt-regexp inferior-octave-prompt
134 major-mode 'inferior-octave-mode
135 mode-name "Inferior Octave"
136 mode-line-process '(":%s") 132 mode-line-process '(":%s")
137 local-abbrev-table octave-abbrev-table) 133 local-abbrev-table octave-abbrev-table)
138 (use-local-map inferior-octave-mode-map)
139 (set-syntax-table inferior-octave-mode-syntax-table)
140 134
141 (make-local-variable 'comment-start) 135 (set (make-local-variable 'comment-start) octave-comment-start)
142 (setq comment-start octave-comment-start) 136 (set (make-local-variable 'comment-end) "")
143 (make-local-variable 'comment-end) 137 (set (make-local-variable 'comment-column) 32)
144 (setq comment-end "") 138 (set (make-local-variable 'comment-start-skip) octave-comment-start-skip)
145 (make-local-variable 'comment-column)
146 (setq comment-column 32)
147 (make-local-variable 'comment-start-skip)
148 (setq comment-start-skip octave-comment-start-skip)
149 139
150 (make-local-variable 'font-lock-defaults) 140 (set (make-local-variable 'font-lock-defaults)
151 (setq font-lock-defaults '(inferior-octave-font-lock-keywords nil nil)) 141 '(inferior-octave-font-lock-keywords nil nil))
152 142
153 (setq comint-input-ring-file-name 143 (setq comint-input-ring-file-name
154 (or (getenv "OCTAVE_HISTFILE") "~/.octave_hist") 144 (or (getenv "OCTAVE_HISTFILE") "~/.octave_hist")
@@ -157,9 +147,7 @@ Entry to this mode successively runs the hooks `comint-mode-hook' and
157 inferior-octave-dynamic-complete-functions) 147 inferior-octave-dynamic-complete-functions)
158 (add-hook 'comint-input-filter-functions 148 (add-hook 'comint-input-filter-functions
159 'inferior-octave-directory-tracker nil t) 149 'inferior-octave-directory-tracker nil t)
160 (comint-read-input-ring t) 150 (comint-read-input-ring t))
161
162 (run-mode-hooks 'inferior-octave-mode-hook))
163 151
164;;;###autoload 152;;;###autoload
165(defun inferior-octave (&optional arg) 153(defun inferior-octave (&optional arg)
diff --git a/lisp/progmodes/octave-mod.el b/lisp/progmodes/octave-mod.el
index cd2957f6180..3e6c2896752 100644
--- a/lisp/progmodes/octave-mod.el
+++ b/lisp/progmodes/octave-mod.el
@@ -655,8 +655,7 @@ including a reproducible test case and send the message."
655 'octave-beginning-of-defun) 655 'octave-beginning-of-defun)
656 656
657 (easy-menu-add octave-mode-menu) 657 (easy-menu-add octave-mode-menu)
658 (octave-initialize-completions) 658 (octave-initialize-completions))
659 (run-mode-hooks 'octave-mode-hook))
660 659
661(defvar info-lookup-mode) 660(defvar info-lookup-mode)
662 661
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index 97de1b35621..63b77fca43a 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -545,7 +545,7 @@ create a new comment."
545 "Normal hook to run when entering Perl mode.") 545 "Normal hook to run when entering Perl mode.")
546 546
547;;;###autoload 547;;;###autoload
548(defun perl-mode () 548(define-derived-mode perl-mode prog-mode "Perl"
549 "Major mode for editing Perl code. 549 "Major mode for editing Perl code.
550Expression and list commands understand all Perl brackets. 550Expression and list commands understand all Perl brackets.
551Tab indents for Perl code. 551Tab indents for Perl code.
@@ -592,33 +592,16 @@ Various indentation styles: K&R BSD BLK GNU LW
592 perl-label-offset -5 -8 -2 -2 -2 592 perl-label-offset -5 -8 -2 -2 -2
593 593
594Turning on Perl mode runs the normal hook `perl-mode-hook'." 594Turning on Perl mode runs the normal hook `perl-mode-hook'."
595 (interactive) 595 :abbrev-table perl-mode-abbrev-table
596 (kill-all-local-variables) 596 (set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter))
597 (use-local-map perl-mode-map) 597 (set (make-local-variable 'paragraph-separate) paragraph-start)
598 (setq major-mode 'perl-mode) 598 (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
599 (setq mode-name "Perl") 599 (set (make-local-variable 'indent-line-function) #'perl-indent-line)
600 (setq local-abbrev-table perl-mode-abbrev-table) 600 (set (make-local-variable 'comment-start) "# ")
601 (set-syntax-table perl-mode-syntax-table) 601 (set (make-local-variable 'comment-end) "")
602 (make-local-variable 'paragraph-start) 602 (set (make-local-variable 'comment-start-skip) "\\(^\\|\\s-\\);?#+ *")
603 (setq paragraph-start (concat "$\\|" page-delimiter)) 603 (set (make-local-variable 'comment-indent-function) #'perl-comment-indent)
604 (make-local-variable 'paragraph-separate) 604 (set (make-local-variable 'parse-sexp-ignore-comments) t)
605 (setq paragraph-separate paragraph-start)
606 (make-local-variable 'paragraph-ignore-fill-prefix)
607 (setq paragraph-ignore-fill-prefix t)
608 (make-local-variable 'indent-line-function)
609 (setq indent-line-function 'perl-indent-line)
610 (make-local-variable 'require-final-newline)
611 (setq require-final-newline mode-require-final-newline)
612 (make-local-variable 'comment-start)
613 (setq comment-start "# ")
614 (make-local-variable 'comment-end)
615 (setq comment-end "")
616 (make-local-variable 'comment-start-skip)
617 (setq comment-start-skip "\\(^\\|\\s-\\);?#+ *")
618 (make-local-variable 'comment-indent-function)
619 (setq comment-indent-function 'perl-comment-indent)
620 (make-local-variable 'parse-sexp-ignore-comments)
621 (setq parse-sexp-ignore-comments t)
622 ;; Tell font-lock.el how to handle Perl. 605 ;; Tell font-lock.el how to handle Perl.
623 (setq font-lock-defaults '((perl-font-lock-keywords 606 (setq font-lock-defaults '((perl-font-lock-keywords
624 perl-font-lock-keywords-1 607 perl-font-lock-keywords-1
@@ -636,8 +619,7 @@ Turning on Perl mode runs the normal hook `perl-mode-hook'."
636 (setq imenu-case-fold-search nil) 619 (setq imenu-case-fold-search nil)
637 ;; Setup outline-minor-mode. 620 ;; Setup outline-minor-mode.
638 (set (make-local-variable 'outline-regexp) perl-outline-regexp) 621 (set (make-local-variable 'outline-regexp) perl-outline-regexp)
639 (set (make-local-variable 'outline-level) 'perl-outline-level) 622 (set (make-local-variable 'outline-level) 'perl-outline-level))
640 (run-mode-hooks 'perl-mode-hook))
641 623
642;; This is used by indent-for-comment 624;; This is used by indent-for-comment
643;; to decide how much to indent a comment in Perl code 625;; to decide how much to indent a comment in Perl code
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el
index f2f80d0d81d..822e6d9b6f8 100644
--- a/lisp/progmodes/prolog.el
+++ b/lisp/progmodes/prolog.el
@@ -180,12 +180,9 @@ When nil, send actual operating system end of file."
180 (`(:after . ,(or `":-" `"->")) prolog-indent-width))) 180 (`(:after . ,(or `":-" `"->")) prolog-indent-width)))
181 181
182(defun prolog-mode-variables () 182(defun prolog-mode-variables ()
183 (make-local-variable 'paragraph-separate) 183 (set (make-local-variable 'paragraph-separate) (concat "%%\\|$\\|" page-delimiter)) ;'%%..'
184 (setq paragraph-separate (concat "%%\\|$\\|" page-delimiter)) ;'%%..' 184 (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
185 (make-local-variable 'paragraph-ignore-fill-prefix) 185 (set (make-local-variable 'imenu-generic-expression) '((nil "^\\sw+" 0)))
186 (setq paragraph-ignore-fill-prefix t)
187 (make-local-variable 'imenu-generic-expression)
188 (setq imenu-generic-expression '((nil "^\\sw+" 0)))
189 186
190 ;; Setup SMIE. 187 ;; Setup SMIE.
191 (smie-setup prolog-smie-grammar #'prolog-smie-rules 188 (smie-setup prolog-smie-grammar #'prolog-smie-rules
@@ -197,14 +194,10 @@ When nil, send actual operating system end of file."
197 ;; There's no real closer in Prolog anyway. 194 ;; There's no real closer in Prolog anyway.
198 (set (make-local-variable 'smie-blink-matching-inners) t) 195 (set (make-local-variable 'smie-blink-matching-inners) t)
199 196
200 (make-local-variable 'comment-start) 197 (set (make-local-variable 'comment-start) "%")
201 (setq comment-start "%") 198 (set (make-local-variable 'comment-start-skip) "\\(?:%+\\|/\\*+\\)[ \t]*")
202 (make-local-variable 'comment-start-skip) 199 (set (make-local-variable 'comment-end-skip) "[ \t]*\\(\n\\|\\*+/\\)")
203 (setq comment-start-skip "\\(?:%+\\|/\\*+\\)[ \t]*") 200 (set (make-local-variable 'comment-column) 48))
204 (make-local-variable 'comment-end-skip)
205 (setq comment-end-skip "[ \t]*\\(\n\\|\\*+/\\)")
206 (make-local-variable 'comment-column)
207 (setq comment-column 48))
208 201
209(defvar prolog-mode-map 202(defvar prolog-mode-map
210 (let ((map (make-sparse-keymap))) 203 (let ((map (make-sparse-keymap)))
diff --git a/lisp/progmodes/ps-mode.el b/lisp/progmodes/ps-mode.el
index 9b83f77d3b8..6158952772a 100644
--- a/lisp/progmodes/ps-mode.el
+++ b/lisp/progmodes/ps-mode.el
@@ -979,9 +979,7 @@ plus the usually uncoded characters inserted on positions 1 through 28."
979 979
980(define-derived-mode ps-run-mode comint-mode "Interactive PS" 980(define-derived-mode ps-run-mode comint-mode "Interactive PS"
981 "Major mode in interactive PostScript window. 981 "Major mode in interactive PostScript window.
982This mode is invoked from `ps-mode' and should not be called directly. 982This mode is invoked from `ps-mode' and should not be called directly."
983
984\\{ps-run-mode-map}"
985 (set (make-local-variable 'font-lock-defaults) 983 (set (make-local-variable 'font-lock-defaults)
986 '((ps-run-font-lock-keywords 984 '((ps-run-font-lock-keywords
987 ps-run-font-lock-keywords-1 985 ps-run-font-lock-keywords-1
@@ -991,7 +989,7 @@ This mode is invoked from `ps-mode' and should not be called directly.
991 989
992(defun ps-run-running () 990(defun ps-run-running ()
993 "Error if not in `ps-mode' or not running PostScript." 991 "Error if not in `ps-mode' or not running PostScript."
994 (unless (equal major-mode 'ps-mode) 992 (unless (derived-mode-p 'ps-mode)
995 (error "This function can only be called from PostScript mode")) 993 (error "This function can only be called from PostScript mode"))
996 (unless (equal (process-status "ps-run") 'run) 994 (unless (equal (process-status "ps-run") 'run)
997 (error "No PostScript process running"))) 995 (error "No PostScript process running")))
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 0a641d0945f..2428ecb7555 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1317,7 +1317,7 @@ See `python-check-command' for the default."
1317 (let ((name (buffer-file-name))) 1317 (let ((name (buffer-file-name)))
1318 (if name 1318 (if name
1319 (file-name-nondirectory name)))))))) 1319 (file-name-nondirectory name))))))))
1320 (setq python-saved-check-command command) 1320 (set (make-local-variable 'python-saved-check-command) command)
1321 (require 'compile) ;To define compilation-* variables. 1321 (require 'compile) ;To define compilation-* variables.
1322 (save-some-buffers (not compilation-ask-about-save) nil) 1322 (save-some-buffers (not compilation-ask-about-save) nil)
1323 (let ((compilation-error-regexp-alist 1323 (let ((compilation-error-regexp-alist
@@ -2522,7 +2522,6 @@ with skeleton expansions for compound statement templates.
2522 (set (make-local-variable 'outline-heading-end-regexp) ":\\s-*\n") 2522 (set (make-local-variable 'outline-heading-end-regexp) ":\\s-*\n")
2523 (set (make-local-variable 'outline-level) #'python-outline-level) 2523 (set (make-local-variable 'outline-level) #'python-outline-level)
2524 (set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil) 2524 (set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil)
2525 (make-local-variable 'python-saved-check-command)
2526 (set (make-local-variable 'beginning-of-defun-function) 2525 (set (make-local-variable 'beginning-of-defun-function)
2527 'python-beginning-of-defun) 2526 'python-beginning-of-defun)
2528 (set (make-local-variable 'end-of-defun-function) 'python-end-of-defun) 2527 (set (make-local-variable 'end-of-defun-function) 'python-end-of-defun)
diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el
index da143db5ffb..fa4c02a7442 100644
--- a/lisp/progmodes/scheme.el
+++ b/lisp/progmodes/scheme.el
@@ -126,39 +126,27 @@
126(defun scheme-mode-variables () 126(defun scheme-mode-variables ()
127 (set-syntax-table scheme-mode-syntax-table) 127 (set-syntax-table scheme-mode-syntax-table)
128 (setq local-abbrev-table scheme-mode-abbrev-table) 128 (setq local-abbrev-table scheme-mode-abbrev-table)
129 (make-local-variable 'paragraph-start) 129 (set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter))
130 (setq paragraph-start (concat "$\\|" page-delimiter)) 130 (set (make-local-variable 'paragraph-separate) paragraph-start)
131 (make-local-variable 'paragraph-separate) 131 (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
132 (setq paragraph-separate paragraph-start) 132 (set (make-local-variable 'fill-paragraph-function) 'lisp-fill-paragraph)
133 (make-local-variable 'paragraph-ignore-fill-prefix)
134 (setq paragraph-ignore-fill-prefix t)
135 (make-local-variable 'fill-paragraph-function)
136 (setq fill-paragraph-function 'lisp-fill-paragraph)
137 ;; Adaptive fill mode gets in the way of auto-fill, 133 ;; Adaptive fill mode gets in the way of auto-fill,
138 ;; and should make no difference for explicit fill 134 ;; and should make no difference for explicit fill
139 ;; because lisp-fill-paragraph should do the job. 135 ;; because lisp-fill-paragraph should do the job.
140 (make-local-variable 'adaptive-fill-mode) 136 (set (make-local-variable 'adaptive-fill-mode) nil)
141 (setq adaptive-fill-mode nil) 137 (set (make-local-variable 'indent-line-function) 'lisp-indent-line)
142 (make-local-variable 'indent-line-function) 138 (set (make-local-variable 'parse-sexp-ignore-comments) t)
143 (setq indent-line-function 'lisp-indent-line) 139 (set (make-local-variable 'outline-regexp) ";;; \\|(....")
144 (make-local-variable 'parse-sexp-ignore-comments) 140 (set (make-local-variable 'comment-start) ";")
145 (setq parse-sexp-ignore-comments t)
146 (make-local-variable 'outline-regexp)
147 (setq outline-regexp ";;; \\|(....")
148 (make-local-variable 'comment-start)
149 (setq comment-start ";")
150 (set (make-local-variable 'comment-add) 1) 141 (set (make-local-variable 'comment-add) 1)
151 (make-local-variable 'comment-start-skip)
152 ;; Look within the line for a ; following an even number of backslashes 142 ;; Look within the line for a ; following an even number of backslashes
153 ;; after either a non-backslash or the line beginning. 143 ;; after either a non-backslash or the line beginning.
154 (setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+[ \t]*") 144 (set (make-local-variable 'comment-start-skip)
145 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+[ \t]*")
155 (set (make-local-variable 'font-lock-comment-start-skip) ";+ *") 146 (set (make-local-variable 'font-lock-comment-start-skip) ";+ *")
156 (make-local-variable 'comment-column) 147 (set (make-local-variable 'comment-column) 40)
157 (setq comment-column 40) 148 (set (make-local-variable 'parse-sexp-ignore-comments) t)
158 (make-local-variable 'parse-sexp-ignore-comments) 149 (set (make-local-variable 'lisp-indent-function) 'scheme-indent-function)
159 (setq parse-sexp-ignore-comments t)
160 (make-local-variable 'lisp-indent-function)
161 (setq lisp-indent-function 'scheme-indent-function)
162 (setq mode-line-process '("" scheme-mode-line-process)) 150 (setq mode-line-process '("" scheme-mode-line-process))
163 (set (make-local-variable 'imenu-case-fold-search) t) 151 (set (make-local-variable 'imenu-case-fold-search) t)
164 (setq imenu-generic-expression scheme-imenu-generic-expression) 152 (setq imenu-generic-expression scheme-imenu-generic-expression)
@@ -206,7 +194,7 @@ All commands in `lisp-mode-shared-map' are inherited by this map.")
206 (define-key map "\e\C-q" 'indent-sexp)) 194 (define-key map "\e\C-q" 'indent-sexp))
207 195
208;;;###autoload 196;;;###autoload
209(defun scheme-mode () 197(define-derived-mode scheme-mode prog-mode "Scheme"
210 "Major mode for editing Scheme code. 198 "Major mode for editing Scheme code.
211Editing commands are similar to those of `lisp-mode'. 199Editing commands are similar to those of `lisp-mode'.
212 200
@@ -225,13 +213,7 @@ Blank lines separate paragraphs. Semicolons start comments.
225\\{scheme-mode-map} 213\\{scheme-mode-map}
226Entry to this mode calls the value of `scheme-mode-hook' 214Entry to this mode calls the value of `scheme-mode-hook'
227if that value is non-nil." 215if that value is non-nil."
228 (interactive) 216 (scheme-mode-variables))
229 (kill-all-local-variables)
230 (use-local-map scheme-mode-map)
231 (setq major-mode 'scheme-mode)
232 (setq mode-name "Scheme")
233 (scheme-mode-variables)
234 (run-mode-hooks 'scheme-mode-hook))
235 217
236(defgroup scheme nil 218(defgroup scheme nil
237 "Editing Scheme code." 219 "Editing Scheme code."
@@ -404,10 +386,7 @@ Blank lines separate paragraphs. Semicolons start comments.
404Entering this mode runs the hooks `scheme-mode-hook' and then 386Entering this mode runs the hooks `scheme-mode-hook' and then
405`dsssl-mode-hook' and inserts the value of `dsssl-sgml-declaration' if 387`dsssl-mode-hook' and inserts the value of `dsssl-sgml-declaration' if
406that variable's value is a string." 388that variable's value is a string."
407 (make-local-variable 'page-delimiter) 389 (set (make-local-variable 'page-delimiter) "^;;;") ; ^L not valid SGML char
408 (setq page-delimiter "^;;;" ; ^L not valid SGML char
409 major-mode 'dsssl-mode
410 mode-name "DSSSL")
411 ;; Insert a suitable SGML declaration into an empty buffer. 390 ;; Insert a suitable SGML declaration into an empty buffer.
412 ;; FIXME: This should use `auto-insert-alist' instead. 391 ;; FIXME: This should use `auto-insert-alist' instead.
413 (and (zerop (buffer-size)) 392 (and (zerop (buffer-size))
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 1f085045192..ee7e4c3b1b6 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -362,8 +362,6 @@ the car and cdr are the same symbol.")
362 "The shell being programmed. This is set by \\[sh-set-shell].") 362 "The shell being programmed. This is set by \\[sh-set-shell].")
363;;;###autoload(put 'sh-shell 'safe-local-variable 'symbolp) 363;;;###autoload(put 'sh-shell 'safe-local-variable 'symbolp)
364 364
365(defvar sh-mode-abbrev-table nil)
366
367(define-abbrev-table 'sh-mode-abbrev-table ()) 365(define-abbrev-table 'sh-mode-abbrev-table ())
368 366
369 367
@@ -566,19 +564,6 @@ This is buffer-local in every such buffer.")
566 :type '(repeat function) 564 :type '(repeat function)
567 :group 'sh-script) 565 :group 'sh-script)
568 566
569
570(defcustom sh-require-final-newline
571 '((csh . t)
572 (pdksh . t))
573 "Value of `require-final-newline' in Shell-Script mode buffers.
574\(SHELL . t) means use the value of `mode-require-final-newline' for SHELL.
575See `sh-feature'."
576 :type '(repeat (cons (symbol :tag "Shell")
577 (choice (const :tag "require" t)
578 (sexp :format "Evaluate: %v"))))
579 :group 'sh-script)
580
581
582(defcustom sh-assignment-regexp 567(defcustom sh-assignment-regexp
583 '((csh . "\\<\\([[:alnum:]_]+\\)\\(\\[.+\\]\\)?[ \t]*[-+*/%^]?=") 568 '((csh . "\\<\\([[:alnum:]_]+\\)\\(\\[.+\\]\\)?[ \t]*[-+*/%^]?=")
584 ;; actually spaces are only supported in let/(( ... )) 569 ;; actually spaces are only supported in let/(( ... ))
@@ -1717,10 +1702,6 @@ Calls the value of `sh-set-shell-hook' if set."
1717 (setq sh-shell-file 1702 (setq sh-shell-file
1718 (executable-set-magic shell (sh-feature sh-shell-arg) 1703 (executable-set-magic shell (sh-feature sh-shell-arg)
1719 no-query-flag insert-flag))) 1704 no-query-flag insert-flag)))
1720 (let ((tem (sh-feature sh-require-final-newline)))
1721 (if (eq tem t)
1722 (set (make-local-variable 'require-final-newline)
1723 mode-require-final-newline)))
1724 (setq mode-line-process (format "[%s]" sh-shell)) 1705 (setq mode-line-process (format "[%s]" sh-shell))
1725 (set (make-local-variable 'sh-shell-variables) nil) 1706 (set (make-local-variable 'sh-shell-variables) nil)
1726 (set (make-local-variable 'sh-shell-variables-initialized) nil) 1707 (set (make-local-variable 'sh-shell-variables-initialized) nil)
diff --git a/lisp/progmodes/simula.el b/lisp/progmodes/simula.el
index bfa921841e2..bccbbf245df 100644
--- a/lisp/progmodes/simula.el
+++ b/lisp/progmodes/simula.el
@@ -371,33 +371,20 @@ Variables controlling indentation style:
371 371
372Turning on SIMULA mode calls the value of the variable simula-mode-hook 372Turning on SIMULA mode calls the value of the variable simula-mode-hook
373with no arguments, if that value is non-nil." 373with no arguments, if that value is non-nil."
374 (make-local-variable 'comment-column) 374 (set (make-local-variable 'comment-column) 40)
375 (setq comment-column 40) 375 ;; (set (make-local-variable 'end-comment-column) 75)
376; (make-local-variable 'end-comment-column) 376 (set (make-local-variable 'paragraph-start) "[ \t]*$\\|\\f")
377; (setq end-comment-column 75) 377 (set (make-local-variable 'paragraph-separate) paragraph-start)
378 (make-local-variable 'paragraph-start) 378 (set (make-local-variable 'indent-line-function) 'simula-indent-line)
379 (setq paragraph-start "[ \t]*$\\|\\f") 379 (set (make-local-variable 'comment-start) "! ")
380 (make-local-variable 'paragraph-separate) 380 (set (make-local-variable 'comment-end) " ;")
381 (setq paragraph-separate paragraph-start) 381 (set (make-local-variable 'comment-start-skip) "!+ *")
382 (make-local-variable 'indent-line-function) 382 (set (make-local-variable 'parse-sexp-ignore-comments) nil)
383 (setq indent-line-function 'simula-indent-line) 383 (set (make-local-variable 'comment-multi-line) t)
384 (make-local-variable 'require-final-newline) 384 (set (make-local-variable 'font-lock-defaults)
385 (setq require-final-newline mode-require-final-newline) 385 '((simula-font-lock-keywords simula-font-lock-keywords-1
386 (make-local-variable 'comment-start) 386 simula-font-lock-keywords-2 simula-font-lock-keywords-3)
387 (setq comment-start "! ") 387 nil t ((?_ . "w"))))
388 (make-local-variable 'comment-end)
389 (setq comment-end " ;")
390 (make-local-variable 'comment-start-skip)
391 (setq comment-start-skip "!+ *")
392 (make-local-variable 'parse-sexp-ignore-comments)
393 (setq parse-sexp-ignore-comments nil)
394 (make-local-variable 'comment-multi-line)
395 (setq comment-multi-line t)
396 (make-local-variable 'font-lock-defaults)
397 (setq font-lock-defaults
398 '((simula-font-lock-keywords simula-font-lock-keywords-1
399 simula-font-lock-keywords-2 simula-font-lock-keywords-3)
400 nil t ((?_ . "w"))))
401 (set (make-local-variable 'syntax-propertize-function) 388 (set (make-local-variable 'syntax-propertize-function)
402 simula-syntax-propertize-function) 389 simula-syntax-propertize-function)
403 (abbrev-mode 1)) 390 (abbrev-mode 1))
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index acb34eacc2b..053816d0287 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -2303,20 +2303,21 @@ also be configured."
2303 '((?_ . "w") (?. . "w"))))) 2303 '((?_ . "w") (?. . "w")))))
2304 2304
2305 ;; Get the product-specific keywords. 2305 ;; Get the product-specific keywords.
2306 (setq sql-mode-font-lock-keywords 2306 (set (make-local-variable 'sql-mode-font-lock-keywords)
2307 (append 2307 (append
2308 (unless (eq sql-product 'ansi) 2308 (unless (eq sql-product 'ansi)
2309 (sql-get-product-feature sql-product :font-lock)) 2309 (sql-get-product-feature sql-product :font-lock))
2310 ;; Always highlight ANSI keywords 2310 ;; Always highlight ANSI keywords
2311 (sql-get-product-feature 'ansi :font-lock) 2311 (sql-get-product-feature 'ansi :font-lock)
2312 ;; Fontify object names in CREATE, DROP and ALTER DDL 2312 ;; Fontify object names in CREATE, DROP and ALTER DDL
2313 ;; statements 2313 ;; statements
2314 (list sql-mode-font-lock-object-name))) 2314 (list sql-mode-font-lock-object-name)))
2315 2315
2316 ;; Setup font-lock. Force re-parsing of `font-lock-defaults'. 2316 ;; Setup font-lock. Force re-parsing of `font-lock-defaults'.
2317 (kill-local-variable 'font-lock-set-defaults) 2317 (kill-local-variable 'font-lock-set-defaults)
2318 (setq font-lock-defaults (list 'sql-mode-font-lock-keywords 2318 (set (make-local-variable 'font-lock-defaults)
2319 keywords-only t syntax-alist)) 2319 (list 'sql-mode-font-lock-keywords
2320 keywords-only t syntax-alist))
2320 2321
2321 ;; Force font lock to reinitialize if it is already on 2322 ;; Force font lock to reinitialize if it is already on
2322 ;; Otherwise, we can wait until it can be started. 2323 ;; Otherwise, we can wait until it can be started.
@@ -3232,7 +3233,7 @@ buffer is popped into a view window. "
3232;;; SQL mode -- uses SQL interactive mode 3233;;; SQL mode -- uses SQL interactive mode
3233 3234
3234;;;###autoload 3235;;;###autoload
3235(defun sql-mode () 3236(define-derived-mode sql-mode prog-mode "SQL"
3236 "Major mode to edit SQL. 3237 "Major mode to edit SQL.
3237 3238
3238You can send SQL statements to the SQLi buffer using 3239You can send SQL statements to the SQLi buffer using
@@ -3259,18 +3260,11 @@ you must tell Emacs. Here's how to do that in your `~/.emacs' file:
3259\(add-hook 'sql-mode-hook 3260\(add-hook 'sql-mode-hook
3260 (lambda () 3261 (lambda ()
3261 (modify-syntax-entry ?\\\\ \".\" sql-mode-syntax-table)))" 3262 (modify-syntax-entry ?\\\\ \".\" sql-mode-syntax-table)))"
3262 (interactive) 3263 :abbrev-table sql-mode-abbrev-table
3263 (kill-all-local-variables)
3264 (setq major-mode 'sql-mode)
3265 (setq mode-name "SQL")
3266 (use-local-map sql-mode-map)
3267 (if sql-mode-menu 3264 (if sql-mode-menu
3268 (easy-menu-add sql-mode-menu)); XEmacs 3265 (easy-menu-add sql-mode-menu)); XEmacs
3269 (set-syntax-table sql-mode-syntax-table) 3266
3270 (make-local-variable 'font-lock-defaults) 3267 (set (make-local-variable 'comment-start) "--")
3271 (make-local-variable 'sql-mode-font-lock-keywords)
3272 (make-local-variable 'comment-start)
3273 (setq comment-start "--")
3274 ;; Make each buffer in sql-mode remember the "current" SQLi buffer. 3268 ;; Make each buffer in sql-mode remember the "current" SQLi buffer.
3275 (make-local-variable 'sql-buffer) 3269 (make-local-variable 'sql-buffer)
3276 ;; Add imenu support for sql-mode. Note that imenu-generic-expression 3270 ;; Add imenu support for sql-mode. Note that imenu-generic-expression
@@ -3280,17 +3274,11 @@ you must tell Emacs. Here's how to do that in your `~/.emacs' file:
3280 imenu-case-fold-search t) 3274 imenu-case-fold-search t)
3281 ;; Make `sql-send-paragraph' work on paragraphs that contain indented 3275 ;; Make `sql-send-paragraph' work on paragraphs that contain indented
3282 ;; lines. 3276 ;; lines.
3283 (make-local-variable 'paragraph-separate) 3277 (set (make-local-variable 'paragraph-separate) "[\f]*$")
3284 (make-local-variable 'paragraph-start) 3278 (set (make-local-variable 'paragraph-start) "[\n\f]")
3285 (setq paragraph-separate "[\f]*$"
3286 paragraph-start "[\n\f]")
3287 ;; Abbrevs 3279 ;; Abbrevs
3288 (setq local-abbrev-table sql-mode-abbrev-table)
3289 (setq abbrev-all-caps 1) 3280 (setq abbrev-all-caps 1)
3290 ;; Run hook
3291 (run-mode-hooks 'sql-mode-hook)
3292 ;; Catch changes to sql-product and highlight accordingly 3281 ;; Catch changes to sql-product and highlight accordingly
3293 (sql-highlight-product)
3294 (add-hook 'hack-local-variables-hook 'sql-highlight-product t t)) 3282 (add-hook 'hack-local-variables-hook 'sql-highlight-product t t))
3295 3283
3296 3284
@@ -3375,15 +3363,14 @@ you entered, right above the output it created.
3375 sql-product)) 3363 sql-product))
3376 3364
3377 ;; Setup the mode. 3365 ;; Setup the mode.
3378 (setq major-mode 'sql-interactive-mode) 3366 (setq major-mode 'sql-interactive-mode) ;FIXME: Use define-derived-mode.
3379 (setq mode-name (concat "SQLi[" (or (sql-get-product-feature sql-product :name) 3367 (setq mode-name
3380 (symbol-name sql-product)) "]")) 3368 (concat "SQLi[" (or (sql-get-product-feature sql-product :name)
3369 (symbol-name sql-product)) "]"))
3381 (use-local-map sql-interactive-mode-map) 3370 (use-local-map sql-interactive-mode-map)
3382 (if sql-interactive-mode-menu 3371 (if sql-interactive-mode-menu
3383 (easy-menu-add sql-interactive-mode-menu)) ; XEmacs 3372 (easy-menu-add sql-interactive-mode-menu)) ; XEmacs
3384 (set-syntax-table sql-mode-syntax-table) 3373 (set-syntax-table sql-mode-syntax-table)
3385 (make-local-variable 'sql-mode-font-lock-keywords)
3386 (make-local-variable 'font-lock-defaults)
3387 3374
3388 ;; Note that making KEYWORDS-ONLY nil will cause havoc if you try 3375 ;; Note that making KEYWORDS-ONLY nil will cause havoc if you try
3389 ;; SELECT 'x' FROM DUAL with SQL*Plus, because the title of the column 3376 ;; SELECT 'x' FROM DUAL with SQL*Plus, because the title of the column
@@ -3392,8 +3379,7 @@ you entered, right above the output it created.
3392 (sql-product-font-lock t nil) 3379 (sql-product-font-lock t nil)
3393 3380
3394 ;; Enable commenting and uncommenting of the region. 3381 ;; Enable commenting and uncommenting of the region.
3395 (make-local-variable 'comment-start) 3382 (set (make-local-variable 'comment-start) "--")
3396 (setq comment-start "--")
3397 ;; Abbreviation table init and case-insensitive. It is not activated 3383 ;; Abbreviation table init and case-insensitive. It is not activated
3398 ;; by default. 3384 ;; by default.
3399 (setq local-abbrev-table sql-mode-abbrev-table) 3385 (setq local-abbrev-table sql-mode-abbrev-table)
@@ -3403,8 +3389,8 @@ you entered, right above the output it created.
3403 ;; Save the connection name 3389 ;; Save the connection name
3404 (make-local-variable 'sql-connection) 3390 (make-local-variable 'sql-connection)
3405 ;; Create a usefull name for renaming this buffer later. 3391 ;; Create a usefull name for renaming this buffer later.
3406 (make-local-variable 'sql-alternate-buffer-name) 3392 (set (make-local-variable 'sql-alternate-buffer-name)
3407 (setq sql-alternate-buffer-name (sql-make-alternate-buffer-name)) 3393 (sql-make-alternate-buffer-name))
3408 ;; User stuff. Initialize before the hook. 3394 ;; User stuff. Initialize before the hook.
3409 (set (make-local-variable 'sql-prompt-regexp) 3395 (set (make-local-variable 'sql-prompt-regexp)
3410 (sql-get-product-feature sql-product :prompt-regexp)) 3396 (sql-get-product-feature sql-product :prompt-regexp))
diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el
index 620d236078b..44ccd134a37 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -572,10 +572,7 @@ documentation for details):
572 572
573Turning on Tcl mode runs `tcl-mode-hook'. Read the documentation for 573Turning on Tcl mode runs `tcl-mode-hook'. Read the documentation for
574`tcl-mode-hook' to see what kinds of interesting hook functions 574`tcl-mode-hook' to see what kinds of interesting hook functions
575already exist. 575already exist."
576
577Commands:
578\\{tcl-mode-map}"
579 (unless (and (boundp 'filladapt-mode) filladapt-mode) 576 (unless (and (boundp 'filladapt-mode) filladapt-mode)
580 (set (make-local-variable 'paragraph-ignore-fill-prefix) t)) 577 (set (make-local-variable 'paragraph-ignore-fill-prefix) t))
581 578
@@ -1064,7 +1061,7 @@ With argument, positions cursor at end of buffer."
1064(defun inferior-tcl-proc () 1061(defun inferior-tcl-proc ()
1065 "Return current inferior Tcl process. 1062 "Return current inferior Tcl process.
1066See variable `inferior-tcl-buffer'." 1063See variable `inferior-tcl-buffer'."
1067 (let ((proc (get-buffer-process (if (eq major-mode 'inferior-tcl-mode) 1064 (let ((proc (get-buffer-process (if (derived-mode-p 'inferior-tcl-mode)
1068 (current-buffer) 1065 (current-buffer)
1069 inferior-tcl-buffer)))) 1066 inferior-tcl-buffer))))
1070 (or proc 1067 (or proc
@@ -1287,7 +1284,7 @@ to update the alist.")
1287If FLAG is nil, just uses `current-word'. 1284If FLAG is nil, just uses `current-word'.
1288Otherwise scans backward for most likely Tcl command word." 1285Otherwise scans backward for most likely Tcl command word."
1289 (if (and flag 1286 (if (and flag
1290 (memq major-mode '(tcl-mode inferior-tcl-mode))) 1287 (derived-mode-p 'tcl-mode 'inferior-tcl-mode))
1291 (condition-case nil 1288 (condition-case nil
1292 (save-excursion 1289 (save-excursion
1293 ;; Look backward for first word actually in alist. 1290 ;; Look backward for first word actually in alist.
@@ -1363,7 +1360,7 @@ Prefix argument means switch to the Tcl buffer afterwards."
1363 ;; filename. 1360 ;; filename.
1364 (car (comint-get-source "Load Tcl file: " 1361 (car (comint-get-source "Load Tcl file: "
1365 (or (and 1362 (or (and
1366 (eq major-mode 'tcl-mode) 1363 (derived-mode-p 'tcl-mode)
1367 (buffer-file-name)) 1364 (buffer-file-name))
1368 tcl-previous-dir/file) 1365 tcl-previous-dir/file)
1369 '(tcl-mode) t)) 1366 '(tcl-mode) t))
@@ -1383,12 +1380,12 @@ Prefix argument means switch to the Tcl buffer afterwards."
1383 (list 1380 (list
1384 (car (comint-get-source "Restart with Tcl file: " 1381 (car (comint-get-source "Restart with Tcl file: "
1385 (or (and 1382 (or (and
1386 (eq major-mode 'tcl-mode) 1383 (derived-mode-p 'tcl-mode)
1387 (buffer-file-name)) 1384 (buffer-file-name))
1388 tcl-previous-dir/file) 1385 tcl-previous-dir/file)
1389 '(tcl-mode) t)) 1386 '(tcl-mode) t))
1390 current-prefix-arg)) 1387 current-prefix-arg))
1391 (let* ((buf (if (eq major-mode 'inferior-tcl-mode) 1388 (let* ((buf (if (derived-mode-p 'inferior-tcl-mode)
1392 (current-buffer) 1389 (current-buffer)
1393 inferior-tcl-buffer)) 1390 inferior-tcl-buffer))
1394 (proc (and buf (get-process buf)))) 1391 (proc (and buf (get-process buf))))
diff --git a/lisp/progmodes/vera-mode.el b/lisp/progmodes/vera-mode.el
index 0d119503f31..7a22bec4259 100644
--- a/lisp/progmodes/vera-mode.el
+++ b/lisp/progmodes/vera-mode.el
@@ -253,7 +253,7 @@ If nil, TAB always indents current line."
253;;;###autoload (add-to-list 'auto-mode-alist (cons (purecopy "\\.vr[hi]?\\'") 'vera-mode)) 253;;;###autoload (add-to-list 'auto-mode-alist (cons (purecopy "\\.vr[hi]?\\'") 'vera-mode))
254 254
255;;;###autoload 255;;;###autoload
256(defun vera-mode () 256(define-derived-mode vera-mode prog-mode "Vera"
257 "Major mode for editing Vera code. 257 "Major mode for editing Vera code.
258 258
259Usage: 259Usage:
@@ -301,13 +301,6 @@ Key bindings:
301------------- 301-------------
302 302
303\\{vera-mode-map}" 303\\{vera-mode-map}"
304 (interactive)
305 (kill-all-local-variables)
306 (setq major-mode 'vera-mode)
307 (setq mode-name "Vera")
308 ;; set maps and tables
309 (use-local-map vera-mode-map)
310 (set-syntax-table vera-mode-syntax-table)
311 ;; set local variables 304 ;; set local variables
312 (require 'cc-cmds) 305 (require 'cc-cmds)
313 (set (make-local-variable 'comment-start) "//") 306 (set (make-local-variable 'comment-start) "//")
@@ -328,9 +321,7 @@ Key bindings:
328 ;; add menu (XEmacs) 321 ;; add menu (XEmacs)
329 (easy-menu-add vera-mode-menu) 322 (easy-menu-add vera-mode-menu)
330 ;; miscellaneous 323 ;; miscellaneous
331 (message "Vera Mode %s. Type C-c C-h for documentation." vera-version) 324 (message "Vera Mode %s. Type C-c C-h for documentation." vera-version))
332 ;; run hooks
333 (run-hooks 'vera-mode-hook))
334 325
335 326
336;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 327;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 42527ff60eb..77dcac7f675 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -1533,16 +1533,14 @@ portion, will be substituted."
1533 (cond 1533 (cond
1534 ((or (file-exists-p "makefile") ;If there is a makefile, use it 1534 ((or (file-exists-p "makefile") ;If there is a makefile, use it
1535 (file-exists-p "Makefile")) 1535 (file-exists-p "Makefile"))
1536 (make-local-variable 'compile-command) 1536 (set (make-local-variable 'compile-command) "make "))
1537 (setq compile-command "make "))
1538 (t 1537 (t
1539 (make-local-variable 'compile-command) 1538 (set (make-local-variable 'compile-command)
1540 (setq compile-command 1539 (if verilog-tool
1541 (if verilog-tool 1540 (if (string-match "%s" (eval verilog-tool))
1542 (if (string-match "%s" (eval verilog-tool)) 1541 (format (eval verilog-tool) (or buffer-file-name ""))
1543 (format (eval verilog-tool) (or buffer-file-name "")) 1542 (concat (eval verilog-tool) " " (or buffer-file-name "")))
1544 (concat (eval verilog-tool) " " (or buffer-file-name ""))) 1543 ""))))
1545 ""))))
1546 (verilog-modify-compile-command)) 1544 (verilog-modify-compile-command))
1547 1545
1548(defun verilog-expand-command (command) 1546(defun verilog-expand-command (command)
@@ -1566,8 +1564,8 @@ be substituted."
1566 (when (and 1564 (when (and
1567 (stringp compile-command) 1565 (stringp compile-command)
1568 (string-match "\\b\\(__FLAGS__\\|__FILE__\\)\\b" compile-command)) 1566 (string-match "\\b\\(__FLAGS__\\|__FILE__\\)\\b" compile-command))
1569 (make-local-variable 'compile-command) 1567 (set (make-local-variable 'compile-command)
1570 (setq compile-command (verilog-expand-command compile-command)))) 1568 (verilog-expand-command compile-command))))
1571 1569
1572(if (featurep 'xemacs) 1570(if (featurep 'xemacs)
1573 ;; Following code only gets called from compilation-mode-hook on XEmacs to add error handling. 1571 ;; Following code only gets called from compilation-mode-hook on XEmacs to add error handling.
@@ -1588,8 +1586,8 @@ find the errors."
1588 (cdr compilation-error-regexp-alist-alist))))) 1586 (cdr compilation-error-regexp-alist-alist)))))
1589 (if (boundp 'compilation-font-lock-keywords) 1587 (if (boundp 'compilation-font-lock-keywords)
1590 (progn 1588 (progn
1591 (make-local-variable 'compilation-font-lock-keywords) 1589 (set (make-local-variable 'compilation-font-lock-keywords)
1592 (setq compilation-font-lock-keywords verilog-error-font-lock-keywords) 1590 verilog-error-font-lock-keywords)
1593 (font-lock-set-defaults))) 1591 (font-lock-set-defaults)))
1594 ;; Need to re-run compilation-error-regexp builder 1592 ;; Need to re-run compilation-error-regexp builder
1595 (if (fboundp 'compilation-build-compilation-error-regexp-alist) 1593 (if (fboundp 'compilation-build-compilation-error-regexp-alist)
@@ -2975,7 +2973,7 @@ Use filename, if current buffer being edited shorten to just buffer name."
2975;; 2973;;
2976(defvar verilog-which-tool 1) 2974(defvar verilog-which-tool 1)
2977;;;###autoload 2975;;;###autoload
2978(defun verilog-mode () 2976(define-derived-mode verilog-mode prog-mode "Verilog"
2979 "Major mode for editing Verilog code. 2977 "Major mode for editing Verilog code.
2980\\<verilog-mode-map> 2978\\<verilog-mode-map>
2981See \\[describe-function] verilog-auto (\\[verilog-auto]) for details on how 2979See \\[describe-function] verilog-auto (\\[verilog-auto]) for details on how
@@ -3103,30 +3101,21 @@ All key bindings can be seen in a Verilog-buffer with \\[describe-bindings].
3103Key bindings specific to `verilog-mode-map' are: 3101Key bindings specific to `verilog-mode-map' are:
3104 3102
3105\\{verilog-mode-map}" 3103\\{verilog-mode-map}"
3106 (interactive) 3104 :abbrev-table verilog-mode-abbrev-table
3107 (kill-all-local-variables)
3108 (use-local-map verilog-mode-map)
3109 (setq major-mode 'verilog-mode)
3110 (setq mode-name "Verilog")
3111 (setq local-abbrev-table verilog-mode-abbrev-table)
3112 (set (make-local-variable 'beginning-of-defun-function) 3105 (set (make-local-variable 'beginning-of-defun-function)
3113 'verilog-beg-of-defun) 3106 'verilog-beg-of-defun)
3114 (set (make-local-variable 'end-of-defun-function) 3107 (set (make-local-variable 'end-of-defun-function)
3115 'verilog-end-of-defun) 3108 'verilog-end-of-defun)
3116 (set-syntax-table verilog-mode-syntax-table) 3109 (set-syntax-table verilog-mode-syntax-table)
3117 (make-local-variable 'indent-line-function) 3110 (set (make-local-variable 'indent-line-function)
3118 (setq indent-line-function 'verilog-indent-line-relative) 3111 #'verilog-indent-line-relative)
3119 (setq comment-indent-function 'verilog-comment-indent) 3112 (setq comment-indent-function 'verilog-comment-indent)
3120 (make-local-variable 'parse-sexp-ignore-comments) 3113 (set (make-local-variable 'parse-sexp-ignore-comments) nil)
3121 (setq parse-sexp-ignore-comments nil) 3114
3122 (make-local-variable 'comment-start) 3115 (set (make-local-variable 'comment-start) "// ")
3123 (make-local-variable 'comment-end) 3116 (set (make-local-variable 'comment-end) "")
3124 (make-local-variable 'comment-multi-line) 3117 (set (make-local-variable 'comment-start-skip) "/\\*+ *\\|// *")
3125 (make-local-variable 'comment-start-skip) 3118 (set (make-local-variable 'comment-multi-line) nil)
3126 (setq comment-start "// "
3127 comment-end ""
3128 comment-start-skip "/\\*+ *\\|// *"
3129 comment-multi-line nil)
3130 ;; Set up for compilation 3119 ;; Set up for compilation
3131 (setq verilog-which-tool 1) 3120 (setq verilog-which-tool 1)
3132 (setq verilog-tool 'verilog-linter) 3121 (setq verilog-tool 'verilog-linter)
@@ -3166,8 +3155,8 @@ Key bindings specific to `verilog-mode-map' are:
3166 (add-hook 'after-change-functions 'verilog-highlight-region t t)) 3155 (add-hook 'after-change-functions 'verilog-highlight-region t t))
3167 3156
3168 ;; Tell imenu how to handle Verilog. 3157 ;; Tell imenu how to handle Verilog.
3169 (make-local-variable 'imenu-generic-expression) 3158 (set (make-local-variable 'imenu-generic-expression)
3170 (setq imenu-generic-expression verilog-imenu-generic-expression) 3159 verilog-imenu-generic-expression)
3171 ;; Tell which-func-modes that imenu knows about verilog 3160 ;; Tell which-func-modes that imenu knows about verilog
3172 (when (boundp 'which-function-modes) 3161 (when (boundp 'which-function-modes)
3173 (add-to-list 'which-func-modes 'verilog-mode)) 3162 (add-to-list 'which-func-modes 'verilog-mode))
@@ -3180,8 +3169,7 @@ Key bindings specific to `verilog-mode-map' are:
3180 hs-special-modes-alist)))) 3169 hs-special-modes-alist))))
3181 3170
3182 ;; Stuff for autos 3171 ;; Stuff for autos
3183 (add-hook 'write-contents-hooks 'verilog-auto-save-check) ; already local 3172 (add-hook 'write-contents-hooks 'verilog-auto-save-check nil 'local))
3184 (run-hooks 'verilog-mode-hook))
3185 3173
3186 3174
3187;; 3175;;
@@ -8042,8 +8030,7 @@ Optionally associate it with the specified enumeration ENUMNAME."
8042 (let ((enumvar (intern (concat "venum-" enumname)))) 8030 (let ((enumvar (intern (concat "venum-" enumname))))
8043 ;;(message "Define %s=%s" defname defvalue) (sleep-for 1) 8031 ;;(message "Define %s=%s" defname defvalue) (sleep-for 1)
8044 (unless (boundp enumvar) (set enumvar nil)) 8032 (unless (boundp enumvar) (set enumvar nil))
8045 (make-local-variable enumvar) 8033 (add-to-list (make-local-variable enumvar) defname)))))
8046 (add-to-list enumvar defname)))))
8047 8034
8048(defun verilog-read-defines (&optional filename recurse subcall) 8035(defun verilog-read-defines (&optional filename recurse subcall)
8049 "Read `defines and parameters for the current file, or optional FILENAME. 8036 "Read `defines and parameters for the current file, or optional FILENAME.
@@ -9349,10 +9336,9 @@ Typing \\[verilog-inject-auto] will make this into:
9349(defun verilog-auto-reeval-locals (&optional force) 9336(defun verilog-auto-reeval-locals (&optional force)
9350 "Read file local variable segment at bottom of file if it has changed. 9337 "Read file local variable segment at bottom of file if it has changed.
9351If FORCE, always reread it." 9338If FORCE, always reread it."
9352 (make-local-variable 'verilog-auto-last-file-locals)
9353 (let ((curlocal (verilog-auto-read-locals))) 9339 (let ((curlocal (verilog-auto-read-locals)))
9354 (when (or force (not (equal verilog-auto-last-file-locals curlocal))) 9340 (when (or force (not (equal verilog-auto-last-file-locals curlocal)))
9355 (setq verilog-auto-last-file-locals curlocal) 9341 (set (make-local-variable 'verilog-auto-last-file-locals) curlocal)
9356 ;; Note this may cause this function to be recursively invoked, 9342 ;; Note this may cause this function to be recursively invoked,
9357 ;; because hack-local-variables may call (verilog-mode) 9343 ;; because hack-local-variables may call (verilog-mode)
9358 ;; The above when statement will prevent it from recursing forever. 9344 ;; The above when statement will prevent it from recursing forever.
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index c7814fed8a0..f9d68af9317 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -4117,7 +4117,10 @@ The directory of the current source file is scanned."
4117;; performs all buffer local initializations 4117;; performs all buffer local initializations
4118 4118
4119;;;###autoload 4119;;;###autoload
4120(defun vhdl-mode () 4120(define-derived-mode vhdl-mode prog-mode
4121 '("VHDL" (vhdl-electric-mode "/" (vhdl-stutter-mode "/"))
4122 (vhdl-electric-mode "e")
4123 (vhdl-stutter-mode "s"))
4121 "Major mode for editing VHDL code. 4124 "Major mode for editing VHDL code.
4122 4125
4123Usage: 4126Usage:
@@ -4650,26 +4653,13 @@ Key bindings:
4650------------- 4653-------------
4651 4654
4652\\{vhdl-mode-map}" 4655\\{vhdl-mode-map}"
4653 (interactive) 4656 :abbrev-table vhdl-mode-abbrev-table
4654 (kill-all-local-variables)
4655 (setq major-mode 'vhdl-mode)
4656 (setq mode-name '("VHDL"
4657 (vhdl-electric-mode "/" (vhdl-stutter-mode "/"))
4658 (vhdl-electric-mode "e")
4659 (vhdl-stutter-mode "s")))
4660
4661 ;; set maps and tables
4662 (use-local-map vhdl-mode-map)
4663 (set-syntax-table vhdl-mode-syntax-table)
4664 (setq local-abbrev-table vhdl-mode-abbrev-table)
4665 4657
4666 ;; set local variables 4658 ;; set local variables
4667 (set (make-local-variable 'paragraph-start) 4659 (set (make-local-variable 'paragraph-start)
4668 "\\s-*\\(--+\\s-*$\\|[^ -]\\|$\\)") 4660 "\\s-*\\(--+\\s-*$\\|[^ -]\\|$\\)")
4669 (set (make-local-variable 'paragraph-separate) paragraph-start) 4661 (set (make-local-variable 'paragraph-separate) paragraph-start)
4670 (set (make-local-variable 'paragraph-ignore-fill-prefix) t) 4662 (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
4671 (set (make-local-variable 'require-final-newline)
4672 (if vhdl-emacs-22 mode-require-final-newline t))
4673 (set (make-local-variable 'parse-sexp-ignore-comments) t) 4663 (set (make-local-variable 'parse-sexp-ignore-comments) t)
4674 (set (make-local-variable 'indent-line-function) 'vhdl-indent-line) 4664 (set (make-local-variable 'indent-line-function) 'vhdl-indent-line)
4675 (set (make-local-variable 'comment-start) "--") 4665 (set (make-local-variable 'comment-start) "--")
@@ -4686,8 +4676,7 @@ Key bindings:
4686 ;; setup the comment indent variable in a Emacs version portable way 4676 ;; setup the comment indent variable in a Emacs version portable way
4687 ;; ignore any byte compiler warnings you might get here 4677 ;; ignore any byte compiler warnings you might get here
4688 (when (boundp 'comment-indent-function) 4678 (when (boundp 'comment-indent-function)
4689 (make-local-variable 'comment-indent-function) 4679 (set (make-local-variable 'comment-indent-function) 'vhdl-comment-indent))
4690 (setq comment-indent-function 'vhdl-comment-indent))
4691 4680
4692 ;; initialize font locking 4681 ;; initialize font locking
4693 (set (make-local-variable 'font-lock-defaults) 4682 (set (make-local-variable 'font-lock-defaults)
@@ -4731,12 +4720,7 @@ Key bindings:
4731 (vhdl-ps-print-init) 4720 (vhdl-ps-print-init)
4732 (vhdl-write-file-hooks-init) 4721 (vhdl-write-file-hooks-init)
4733 (message "VHDL Mode %s.%s" vhdl-version 4722 (message "VHDL Mode %s.%s" vhdl-version
4734 (if noninteractive "" " See menu for documentation and release notes.")) 4723 (if noninteractive "" " See menu for documentation and release notes.")))
4735
4736 ;; run hooks
4737 (if vhdl-emacs-22
4738 (run-mode-hooks 'vhdl-mode-hook)
4739 (run-hooks 'vhdl-mode-hook)))
4740 4724
4741(defun vhdl-activate-customizations () 4725(defun vhdl-activate-customizations ()
4742 "Activate all customizations on local variables." 4726 "Activate all customizations on local variables."
@@ -4754,10 +4738,10 @@ Key bindings:
4754(defun vhdl-write-file-hooks-init () 4738(defun vhdl-write-file-hooks-init ()
4755 "Add/remove hooks when buffer is saved." 4739 "Add/remove hooks when buffer is saved."
4756 (if vhdl-modify-date-on-saving 4740 (if vhdl-modify-date-on-saving
4757 (add-hook 'local-write-file-hooks 'vhdl-template-modify-noerror) 4741 (add-hook 'local-write-file-hooks 'vhdl-template-modify-noerror nil t)
4758 (remove-hook 'local-write-file-hooks 'vhdl-template-modify-noerror)) 4742 (remove-hook 'local-write-file-hooks 'vhdl-template-modify-noerror t))
4759 (make-local-variable 'after-save-hook) 4743 (if (featurep 'xemacs) (make-local-hook 'after-save-hook))
4760 (add-hook 'after-save-hook 'vhdl-add-modified-file)) 4744 (add-hook 'after-save-hook 'vhdl-add-modified-file nil t))
4761 4745
4762(defun vhdl-process-command-line-option (option) 4746(defun vhdl-process-command-line-option (option)
4763 "Process command line options for VHDL Mode." 4747 "Process command line options for VHDL Mode."
@@ -5271,13 +5255,12 @@ argument. The styles are chosen from the `vhdl-style-alist' variable."
5271 (lambda (varentry) 5255 (lambda (varentry)
5272 (let ((var (car varentry)) 5256 (let ((var (car varentry))
5273 (val (cdr varentry))) 5257 (val (cdr varentry)))
5274 (and local
5275 (make-local-variable var))
5276 ;; special case for vhdl-offsets-alist 5258 ;; special case for vhdl-offsets-alist
5277 (if (not (eq var 'vhdl-offsets-alist)) 5259 (if (not (eq var 'vhdl-offsets-alist))
5278 (set var val) 5260 (set (if local (make-local-variable var) var) val)
5279 ;; reset vhdl-offsets-alist to the default value first 5261 ;; reset vhdl-offsets-alist to the default value first
5280 (setq vhdl-offsets-alist (copy-alist vhdl-offsets-alist-default)) 5262 (set (if local (make-local-variable var) var)
5263 (copy-alist vhdl-offsets-alist-default))
5281 ;; now set the langelems that are different 5264 ;; now set the langelems that are different
5282 (mapcar 5265 (mapcar
5283 (function 5266 (function
@@ -12500,10 +12483,10 @@ File statistics: \"%s\"\n\
12500 (cons (list 'vhdl-mode vhdl-hs-start-regexp nil "--\\( \\|$\\)" 12483 (cons (list 'vhdl-mode vhdl-hs-start-regexp nil "--\\( \\|$\\)"
12501 'vhdl-hs-forward-sexp-func nil) 12484 'vhdl-hs-forward-sexp-func nil)
12502 hs-special-modes-alist))) 12485 hs-special-modes-alist)))
12503 (make-local-variable 'hs-minor-mode-hook) 12486 (if (featurep 'xemacs) (make-local-hook 'hs-minor-mode-hook))
12504 (if vhdl-hide-all-init 12487 (if vhdl-hide-all-init
12505 (add-hook 'hs-minor-mode-hook 'hs-hide-all) 12488 (add-hook 'hs-minor-mode-hook 'hs-hide-all nil t)
12506 (remove-hook 'hs-minor-mode-hook 'hs-hide-all)) 12489 (remove-hook 'hs-minor-mode-hook 'hs-hide-all t))
12507 (hs-minor-mode arg) 12490 (hs-minor-mode arg)
12508 (force-mode-line-update))) ; hack to update menu bar 12491 (force-mode-line-update))) ; hack to update menu bar
12509 12492
@@ -12970,8 +12953,8 @@ This does background highlighting of translate-off regions.")
12970 (if (featurep 'xemacs) 12953 (if (featurep 'xemacs)
12971 (when (boundp 'ps-print-color-p) 12954 (when (boundp 'ps-print-color-p)
12972 (vhdl-ps-print-settings)) 12955 (vhdl-ps-print-settings))
12973 (make-local-variable 'ps-print-hook) 12956 (if (featurep 'xemacs) (make-local-hook 'ps-print-hook))
12974 (add-hook 'ps-print-hook 'vhdl-ps-print-settings))) 12957 (add-hook 'ps-print-hook 'vhdl-ps-print-settings nil t)))
12975 12958
12976 12959
12977;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 12960;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index 6262e1c1958..e06dbf46a9a 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -283,8 +283,7 @@ If no function name is found, return nil."
283 (null which-function-imenu-failed)) 283 (null which-function-imenu-failed))
284 (imenu--make-index-alist t) 284 (imenu--make-index-alist t)
285 (unless imenu--index-alist 285 (unless imenu--index-alist
286 (make-local-variable 'which-function-imenu-failed) 286 (set (make-local-variable 'which-function-imenu-failed) t)))
287 (setq which-function-imenu-failed t)))
288 ;; If we have an index alist, use it. 287 ;; If we have an index alist, use it.
289 (when (and (null name) 288 (when (and (null name)
290 (boundp 'imenu--index-alist) imenu--index-alist) 289 (boundp 'imenu--index-alist) imenu--index-alist)
diff --git a/lisp/progmodes/xscheme.el b/lisp/progmodes/xscheme.el
index 217424b9424..f83a67f4adf 100644
--- a/lisp/progmodes/xscheme.el
+++ b/lisp/progmodes/xscheme.el
@@ -186,8 +186,7 @@ With argument, asks for a command line."
186 (setq-default xscheme-process-command-line command-line) 186 (setq-default xscheme-process-command-line command-line)
187 (switch-to-buffer 187 (switch-to-buffer
188 (xscheme-start-process command-line process-name buffer-name)) 188 (xscheme-start-process command-line process-name buffer-name))
189 (make-local-variable 'xscheme-process-command-line) 189 (set (make-local-variable 'xscheme-process-command-line) command-line))
190 (setq xscheme-process-command-line command-line))
191 190
192(defun xscheme-read-command-line (arg) 191(defun xscheme-read-command-line (arg)
193 (let ((default 192 (let ((default
@@ -278,13 +277,11 @@ With argument, asks for a command line."
278 xscheme-buffer-name 277 xscheme-buffer-name
279 t))) 278 t)))
280 (let ((process-name (verify-xscheme-buffer buffer-name t))) 279 (let ((process-name (verify-xscheme-buffer buffer-name t)))
281 (make-local-variable 'xscheme-buffer-name) 280 (set (make-local-variable 'xscheme-buffer-name) buffer-name)
282 (setq xscheme-buffer-name buffer-name) 281 (set (make-local-variable 'xscheme-process-name) process-name)
283 (make-local-variable 'xscheme-process-name) 282 (set (make-local-variable 'xscheme-runlight)
284 (setq xscheme-process-name process-name) 283 (with-current-buffer buffer-name
285 (make-local-variable 'xscheme-runlight) 284 xscheme-runlight))))
286 (setq xscheme-runlight (with-current-buffer buffer-name
287 xscheme-runlight))))
288 285
289(defun local-clear-scheme-interaction-buffer () 286(defun local-clear-scheme-interaction-buffer ()
290 "Make the current buffer use the default scheme interaction buffer." 287 "Make the current buffer use the default scheme interaction buffer."
@@ -386,21 +383,19 @@ Entry to this mode calls the value of scheme-interaction-mode-hook
386with no args, if that value is non-nil. 383with no args, if that value is non-nil.
387 Likewise with the value of scheme-mode-hook. 384 Likewise with the value of scheme-mode-hook.
388 scheme-interaction-mode-hook is called after scheme-mode-hook." 385 scheme-interaction-mode-hook is called after scheme-mode-hook."
386 ;; FIXME: Use define-derived-mode.
389 (interactive "P") 387 (interactive "P")
390 (if (not preserve) 388 (if (not preserve)
391 (let ((previous-mode major-mode)) 389 (let ((previous-mode major-mode))
392 (kill-all-local-variables) 390 (kill-all-local-variables)
393 (make-local-variable 'xscheme-previous-mode)
394 (make-local-variable 'xscheme-buffer-name)
395 (make-local-variable 'xscheme-process-name) 391 (make-local-variable 'xscheme-process-name)
396 (make-local-variable 'xscheme-previous-process-state) 392 (make-local-variable 'xscheme-previous-process-state)
397 (make-local-variable 'xscheme-runlight-string) 393 (make-local-variable 'xscheme-runlight-string)
398 (make-local-variable 'xscheme-runlight) 394 (make-local-variable 'xscheme-runlight)
399 (make-local-variable 'xscheme-last-input-end) 395 (set (make-local-variable 'xscheme-previous-mode) previous-mode)
400 (setq xscheme-previous-mode previous-mode)
401 (let ((buffer (current-buffer))) 396 (let ((buffer (current-buffer)))
402 (setq xscheme-buffer-name (buffer-name buffer)) 397 (set (make-local-variable 'xscheme-buffer-name) (buffer-name buffer))
403 (setq xscheme-last-input-end (make-marker)) 398 (set (make-local-variable 'xscheme-last-input-end) (make-marker))
404 (let ((process (get-buffer-process buffer))) 399 (let ((process (get-buffer-process buffer)))
405 (if process 400 (if process
406 (progn 401 (progn
@@ -420,7 +415,7 @@ with no args, if that value is non-nil.
420(defun exit-scheme-interaction-mode () 415(defun exit-scheme-interaction-mode ()
421 "Take buffer out of scheme interaction mode" 416 "Take buffer out of scheme interaction mode"
422 (interactive) 417 (interactive)
423 (if (not (eq major-mode 'scheme-interaction-mode)) 418 (if (not (derived-mode-p 'scheme-interaction-mode))
424 (error "Buffer not in scheme interaction mode")) 419 (error "Buffer not in scheme interaction mode"))
425 (let ((previous-state xscheme-previous-process-state)) 420 (let ((previous-state xscheme-previous-process-state))
426 (funcall xscheme-previous-mode) 421 (funcall xscheme-previous-mode)
@@ -437,7 +432,7 @@ with no args, if that value is non-nil.
437 432
438(defun scheme-interaction-mode-initialize () 433(defun scheme-interaction-mode-initialize ()
439 (use-local-map scheme-interaction-mode-map) 434 (use-local-map scheme-interaction-mode-map)
440 (setq major-mode 'scheme-interaction-mode) 435 (setq major-mode 'scheme-interaction-mode) ;FIXME: Use define-derived-mode.
441 (setq mode-name "Scheme Interaction")) 436 (setq mode-name "Scheme Interaction"))
442 437
443(defun scheme-interaction-mode-commands (keymap) 438(defun scheme-interaction-mode-commands (keymap)
@@ -469,8 +464,8 @@ with no args, if that value is non-nil.
469 464
470(defun xscheme-enter-interaction-mode () 465(defun xscheme-enter-interaction-mode ()
471 (with-current-buffer (xscheme-process-buffer) 466 (with-current-buffer (xscheme-process-buffer)
472 (if (not (eq major-mode 'scheme-interaction-mode)) 467 (if (not (derived-mode-p 'scheme-interaction-mode))
473 (if (eq major-mode 'scheme-debugger-mode) 468 (if (derived-mode-p 'scheme-debugger-mode)
474 (scheme-interaction-mode-initialize) 469 (scheme-interaction-mode-initialize)
475 (scheme-interaction-mode t))))) 470 (scheme-interaction-mode t)))))
476 471
@@ -494,7 +489,7 @@ Commands:
494 489
495(defun scheme-debugger-mode-initialize () 490(defun scheme-debugger-mode-initialize ()
496 (use-local-map scheme-debugger-mode-map) 491 (use-local-map scheme-debugger-mode-map)
497 (setq major-mode 'scheme-debugger-mode) 492 (setq major-mode 'scheme-debugger-mode) ;FIXME: Use define-derived-mode.
498 (setq mode-name "Scheme Debugger")) 493 (setq mode-name "Scheme Debugger"))
499 494
500(defun scheme-debugger-mode-commands (keymap) 495(defun scheme-debugger-mode-commands (keymap)
@@ -518,9 +513,9 @@ Commands:
518 513
519(defun xscheme-enter-debugger-mode (prompt-string) 514(defun xscheme-enter-debugger-mode (prompt-string)
520 (with-current-buffer (xscheme-process-buffer) 515 (with-current-buffer (xscheme-process-buffer)
521 (if (not (eq major-mode 'scheme-debugger-mode)) 516 (if (not (derived-mode-p 'scheme-debugger-mode))
522 (progn 517 (progn
523 (if (not (eq major-mode 'scheme-interaction-mode)) 518 (if (not (derived-mode-p 'scheme-interaction-mode))
524 (scheme-interaction-mode t)) 519 (scheme-interaction-mode t))
525 (scheme-debugger-mode-initialize))))) 520 (scheme-debugger-mode-initialize)))))
526 521
@@ -528,7 +523,7 @@ Commands:
528 (let ((buffer (xscheme-process-buffer))) 523 (let ((buffer (xscheme-process-buffer)))
529 (and buffer 524 (and buffer
530 (with-current-buffer buffer 525 (with-current-buffer buffer
531 (eq major-mode 'scheme-debugger-mode))))) 526 (derived-mode-p 'scheme-debugger-mode)))))
532 527
533;;;; Evaluation Commands 528;;;; Evaluation Commands
534 529
@@ -550,7 +545,7 @@ The strings are concatenated and terminated by a newline."
550(defun xscheme-send-string-1 (strings) 545(defun xscheme-send-string-1 (strings)
551 (let ((string (apply 'concat strings))) 546 (let ((string (apply 'concat strings)))
552 (xscheme-send-string-2 string) 547 (xscheme-send-string-2 string)
553 (if (eq major-mode 'scheme-interaction-mode) 548 (if (derived-mode-p 'scheme-interaction-mode)
554 (xscheme-insert-expression string)))) 549 (xscheme-insert-expression string))))
555 550
556(defun xscheme-send-string-2 (string) 551(defun xscheme-send-string-2 (string)