1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 14:30:50 -08:00

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.
This commit is contained in:
Stefan Monnier 2010-12-10 15:00:25 -05:00
parent fe646d2c4e
commit 175069efeb
47 changed files with 710 additions and 1016 deletions

View file

@ -1,3 +1,118 @@
2010-12-10 Stefan Monnier <monnier@iro.umontreal.ca>
Derive from prog-mode, use derived-mode-p, and fix up various
minor style issues in lisp/progmodes.
* progmodes/vhdl-mode.el (vhdl-mode):
* progmodes/verilog-mode.el (verilog-mode):
* progmodes/vera-mode.el (vera-mode):
* progmodes/sql.el (sql-mode):
* progmodes/scheme.el (scheme-mode):
* progmodes/perl-mode.el (perl-mode):
* progmodes/octave-inf.el (inferior-octave-mode):
* progmodes/autoconf.el (autoconf-mode):
* progmodes/m4-mode.el (m4-mode):
* progmodes/inf-lisp.el (inferior-lisp-mode):
* progmodes/idlwave.el (idlwave-mode):
* progmodes/icon.el (icon-mode):
* progmodes/idlw-help.el (idlwave-help-mode):
* progmodes/dcl-mode.el (dcl-mode):
* progmodes/idlw-shell.el (idlwave-shell-mode):
* progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode)
(ebrowse-member-mode, ebrowse-electric-position-mode):
Use define-derived-mode.
* progmodes/xscheme.el (exit-scheme-interaction-mode)
(xscheme-enter-interaction-mode, xscheme-enter-debugger-mode)
(xscheme-debugger-mode-p, xscheme-send-string-1):
* progmodes/tcl.el (inferior-tcl-proc, tcl-current-word)
(tcl-load-file, tcl-restart-with-file):
* progmodes/ps-mode.el (ps-run-running):
* progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint):
* progmodes/js.el (js--get-all-known-symbols):
* progmodes/inf-lisp.el (inferior-lisp-proc):
* 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):
* progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add)
(idlwave-toolbar-remove):
* progmodes/idlw-shell.el (idlwave-shell-save-and-action)
(idlwave-shell-file-name, idlwave-shell-electric-debug-all-off)
(idlwave-shell-menu-def):
* progmodes/idlw-complete-structtag.el
(idlwave-prepare-structure-tag-completion):
* progmodes/gud.el (gud-set-buffer):
* progmodes/f90.el (f90-backslash-not-special):
* progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
* progmodes/xscheme.el (xscheme-start)
(local-set-scheme-interaction-buffer, scheme-interaction-mode):
* progmodes/which-func.el (which-function):
* progmodes/vhdl-mode.el (vhdl-set-style):
* progmodes/verilog-mode.el (verilog-set-compile-command)
(verilog-modify-compile-command, verilog-error-regexp-add-xemacs)
(verilog-set-define, verilog-auto-reeval-locals):
* progmodes/sql.el (sql-product-font-lock, sql-interactive-mode):
* progmodes/simula.el (simula-mode):
* progmodes/scheme.el (scheme-mode-variables, dsssl-mode):
* progmodes/python.el (python-check, python-mode):
* progmodes/prolog.el (prolog-mode-variables):
* progmodes/gud.el (gud-tooltip-activate-mouse-motions):
* progmodes/ebrowse.el (ebrowse-view-file-other-frame):
* progmodes/delphi.el (delphi-mode):
* progmodes/cc-styles.el (c-setup-paragraph-variables):
* progmodes/cc-mode.el (c-basic-common-init, c-common-init)
(c-font-lock-init): Move make-local-variable to their setq.
* progmodes/vhdl-mode.el (vhdl-write-file-hooks-init)
(vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable ->
make-local-hook.
* 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.
* progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column
since we never set it.
* progmodes/ebrowse.el (ebrowse-set-tree-indentation):
Use read-string and standard prompt.
* progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration.
* 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.
* progmodes/js.el (js-mode): Call syntax-propertize rather than messing
around with font-lock.
* progmodes/etags.el (select-tags-table-mode):
Derive from special-mode.
* progmodes/octave-mod.el (octave-mode):
* 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.
* 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.
* progmodes/mixal-mode.el (mixal-mode):
* progmodes/f90.el (f90-mode):
* progmodes/cfengine.el (cfengine-mode): Don't bother setting
require-final-newline since prog-mode does it already.
* progmodes/cc-cmds.el (c-update-modeline): Use match-string.
* progmodes/asm-mode.el (asm-mode-map): Fix menu setup.
* 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.
* progmodes/ada-mode.el: Use derived-mode-p.
(ada-mode): Use define-derived-mode.
Use hack-local-variables-hook.
2010-12-10 Stefan Monnier <monnier@iro.umontreal.ca> 2010-12-10 Stefan Monnier <monnier@iro.umontreal.ca>
* textmodes/texinfo.el (texinfo-mode-map): Bind texinfo-insert-@end. * textmodes/texinfo.el (texinfo-mode-map): Bind texinfo-insert-@end.

View file

@ -461,6 +461,7 @@ The extensions should include a `.' if needed.")
(defvar ada-mode-abbrev-table nil (defvar ada-mode-abbrev-table nil
"Local abbrev table for Ada mode.") "Local abbrev table for Ada mode.")
(define-abbrev-table 'ada-mode-abbrev-table ())
(defvar ada-mode-syntax-table nil (defvar ada-mode-syntax-table nil
"Syntax table to be used for editing Ada source code.") "Syntax table to be used for editing Ada source code.")
@ -1123,16 +1124,8 @@ the file name."
(defvar ada-font-lock-syntactic-keywords) ; defined below (defvar ada-font-lock-syntactic-keywords) ; defined below
;;;###autoload ;;;###autoload
(defun ada-mode () (define-derived-mode ada-mode prog-mode "Ada"
"Ada mode is the major mode for editing Ada code. "Ada mode is the major mode for editing Ada code."
\\{ada-mode-map}"
(interactive)
(kill-all-local-variables)
(set-syntax-table ada-mode-syntax-table)
(set (make-local-variable 'require-final-newline) mode-require-final-newline)
;; Set the paragraph delimiters so that one can select a whole block ;; Set the paragraph delimiters so that one can select a whole block
;; simply with M-h ;; simply with M-h
@ -1303,64 +1296,54 @@ the file name."
(define-key ada-mode-map ada-popup-key 'ada-popup-menu)) (define-key ada-mode-map ada-popup-key 'ada-popup-menu))
;; Support for Abbreviations (the user still need to "M-x abbrev-mode" ;; Support for Abbreviations (the user still need to "M-x abbrev-mode"
(define-abbrev-table 'ada-mode-abbrev-table ())
(setq local-abbrev-table ada-mode-abbrev-table) (setq local-abbrev-table ada-mode-abbrev-table)
;; Support for which-function mode ;; Support for which-function mode
(make-local-variable 'which-func-functions) (set (make-local-variable 'which-func-functions) '(ada-which-function))
(setq which-func-functions '(ada-which-function))
;; Support for indent-new-comment-line (Especially for XEmacs) ;; Support for indent-new-comment-line (Especially for XEmacs)
(set (make-local-variable 'comment-multi-line) nil) (set (make-local-variable 'comment-multi-line) nil)
;; Support for add-log ;; Support for add-log
(set (make-local-variable 'add-log-current-defun-function) 'ada-which-function) (set (make-local-variable 'add-log-current-defun-function)
'ada-which-function)
(setq major-mode 'ada-mode
mode-name "Ada")
(use-local-map ada-mode-map)
(easy-menu-add ada-mode-menu ada-mode-map) (easy-menu-add ada-mode-menu ada-mode-map)
(set-syntax-table ada-mode-syntax-table)
(set (make-local-variable 'skeleton-further-elements) (set (make-local-variable 'skeleton-further-elements)
'((< '(backward-delete-char-untabify '((< '(backward-delete-char-untabify
(min ada-indent (current-column)))))) (min ada-indent (current-column))))))
(add-hook 'skeleton-end-hook 'ada-adjust-case-skeleton nil t) (add-hook 'skeleton-end-hook 'ada-adjust-case-skeleton nil t)
(run-mode-hooks 'ada-mode-hook)
;; To be run after the hook, in case the user modified ;; To be run after the hook, in case the user modified
;; ada-fill-comment-prefix ;; ada-fill-comment-prefix
;; FIXME: if the user modified ada-fill-comment-prefix in his .emacs (add-hook 'hack-local-variables-hook
;; then it was already available before running the hook, and if he (lambda ()
;; modifies it in the hook, he might as well modify comment-start instead. (set (make-local-variable 'comment-start)
(set (make-local-variable 'comment-start) (or ada-fill-comment-prefix "-- ")) (or ada-fill-comment-prefix "-- "))
;; Run this after the hook to give the users a chance to activate ;; Run this after the hook to give the users a chance
;; font-lock-mode ;; to activate font-lock-mode.
(unless (or (eval-when-compile (fboundp 'syntax-propertize-via-font-lock)) (unless (or (eval-when-compile (fboundp 'syntax-propertize-via-font-lock))
(featurep 'xemacs)) (featurep 'xemacs))
(ada-initialize-syntax-table-properties) (ada-initialize-syntax-table-properties)
(add-hook 'font-lock-mode-hook 'ada-handle-syntax-table-properties nil t)) (add-hook 'font-lock-mode-hook
'ada-handle-syntax-table-properties nil t))
;; the following has to be done after running the ada-mode-hook ;; FIXME: ada-language-version might be set in the mode
;; because users might want to set the values of these variable ;; hook or it might even be set later on via file-local
;; inside the hook ;; vars, so ada-keywords should be set lazily.
;; FIXME: it might even be set later on via file-local vars, no? (cond ((eq ada-language-version 'ada83)
;; so maybe ada-keywords should be set lazily. (setq ada-keywords ada-83-keywords))
(cond ((eq ada-language-version 'ada83) ((eq ada-language-version 'ada95)
(setq ada-keywords ada-83-keywords)) (setq ada-keywords ada-95-keywords))
((eq ada-language-version 'ada95) ((eq ada-language-version 'ada2005)
(setq ada-keywords ada-95-keywords)) (setq ada-keywords ada-2005-keywords)))
((eq ada-language-version 'ada2005)
(setq ada-keywords ada-2005-keywords)))
(if ada-auto-case (if ada-auto-case
(ada-activate-keys-for-case))) (ada-activate-keys-for-case)))
nil 'local))
(defun ada-adjust-case-skeleton () (defun ada-adjust-case-skeleton ()
"Adjust the case of the text inserted by a skeleton." "Adjust the case of the text inserted by a skeleton."
@ -4632,7 +4615,7 @@ Moves to 'begin' if in a declarative part."
["Gdb Documentation" (info "gdb") ["Gdb Documentation" (info "gdb")
(eq ada-which-compiler 'gnat)] (eq ada-which-compiler 'gnat)]
["Ada95 Reference Manual" (info "arm95") t]) ["Ada95 Reference Manual" (info "arm95") t])
("Options" :included (eq major-mode 'ada-mode) ("Options" :included (derived-mode-p 'ada-mode)
["Auto Casing" (setq ada-auto-case (not ada-auto-case)) ["Auto Casing" (setq ada-auto-case (not ada-auto-case))
:style toggle :selected ada-auto-case] :style toggle :selected ada-auto-case]
["Auto Indent After Return" ["Auto Indent After Return"
@ -4669,7 +4652,7 @@ Moves to 'begin' if in a declarative part."
["Load..." ada-set-default-project-file t] ["Load..." ada-set-default-project-file t]
["New..." ada-prj-new t] ["New..." ada-prj-new t]
["Edit..." ada-prj-edit t]) ["Edit..." ada-prj-edit t])
("Goto" :included (eq major-mode 'ada-mode) ("Goto" :included (derived-mode-p 'ada-mode)
["Goto Declaration/Body" ada-goto-declaration ["Goto Declaration/Body" ada-goto-declaration
(eq ada-which-compiler 'gnat)] (eq ada-which-compiler 'gnat)]
["Goto Body" ada-goto-body ["Goto Body" ada-goto-body
@ -4698,7 +4681,7 @@ Moves to 'begin' if in a declarative part."
["-" nil nil] ["-" nil nil]
["Other File" ff-find-other-file t] ["Other File" ff-find-other-file t]
["Other File Other Window" ada-ff-other-window t]) ["Other File Other Window" ada-ff-other-window t])
("Edit" :included (eq major-mode 'ada-mode) ("Edit" :included (derived-mode-p 'ada-mode)
["Search File On Source Path" ada-find-file t] ["Search File On Source Path" ada-find-file t]
["------" nil nil] ["------" nil nil]
["Complete Identifier" ada-complete-identifier t] ["Complete Identifier" ada-complete-identifier t]
@ -4730,7 +4713,7 @@ Moves to 'begin' if in a declarative part."
["-----" nil nil] ["-----" nil nil]
["Narrow to subprogram" ada-narrow-to-defun t]) ["Narrow to subprogram" ada-narrow-to-defun t])
("Templates" ("Templates"
:included (eq major-mode 'ada-mode) :included (derived-mode-p 'ada-mode)
["Header" ada-header t] ["Header" ada-header t]
["-" nil nil] ["-" nil nil]
["Package Body" ada-package-body t] ["Package Body" ada-package-body t]

View file

@ -514,11 +514,18 @@ If FILENAME is given, edit that file."
(set (make-local-variable 'ada-prj-ada-buffer) ada-buffer) (set (make-local-variable 'ada-prj-ada-buffer) ada-buffer)
(use-local-map (copy-keymap custom-mode-map)) (use-local-map
(local-set-key "\C-x\C-s" 'ada-prj-save) (let ((map (make-sparse-keymap)))
(set-keymap-parent map custom-mode-map)
(define-key map "\C-x\C-s" 'ada-prj-save)
map))
(make-local-variable 'widget-keymap) ;; FIXME: Not sure if this works!!
(define-key widget-keymap "\C-x\C-s" 'ada-prj-save) (set (make-local-variable 'widget-keymap)
(let ((map (make-sparse-keymap)))
(set-keymap-parent map widget-keymap)
(define-key map "\C-x\C-s" 'ada-prj-save)
map))
(set (make-local-variable 'ada-old-cross-prefix) (set (make-local-variable 'ada-old-cross-prefix)
(ada-xref-get-project-field 'cross-prefix)) (ada-xref-get-project-field 'cross-prefix))

View file

@ -87,6 +87,7 @@
(require 'cl)) (require 'cl))
(require 'easymenu) (require 'easymenu)
(require 'cc-mode)
;; Just to get the rid of the byte compiler warning. The code for ;; Just to get the rid of the byte compiler warning. The code for
;; this function and its friends are too complex for their own good. ;; 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
(defvar antlr-mode-hook nil (defvar antlr-mode-hook nil
"Hook called by `antlr-mode'.") "Hook called by `antlr-mode'.")
(defvar antlr-mode-syntax-table nil (defvar antlr-mode-syntax-table
(let ((st (make-syntax-table)))
(c-populate-syntax-table st)
st)
"Syntax table used in `antlr-mode' buffers. "Syntax table used in `antlr-mode' buffers.
If non-nil, it will be initialized in `antlr-mode'.") If non-nil, it will be initialized in `antlr-mode'.")
;; used for "in Java/C++ code" = syntactic-depth>0 ;; used for "in Java/C++ code" = syntactic-depth>0
(defvar antlr-action-syntax-table nil (defvar antlr-action-syntax-table
(let ((st (copy-syntax-table antlr-mode-syntax-table))
(slist (nth 3 antlr-font-lock-defaults)))
(while slist
(modify-syntax-entry (caar slist) (cdar slist) st)
(setq slist (cdr slist)))
st)
"Syntax table used for ANTLR action parsing. "Syntax table used for ANTLR action parsing.
Initialized by `antlr-mode-syntax-table', changed by SYNTAX-ALIST in Initialized by `antlr-mode-syntax-table', changed by SYNTAX-ALIST in
`antlr-font-lock-defaults'. This table should be selected if you use `antlr-font-lock-defaults'. This table should be selected if you use
@ -2189,7 +2199,7 @@ export vocabulary specified in that file."
(insert-file-contents file t nil nil t) (insert-file-contents file t nil nil t)
(normal-mode t) ; necessary for major-mode, syntax (normal-mode t) ; necessary for major-mode, syntax
; table and `antlr-language' ; table and `antlr-language'
(when (eq major-mode 'antlr-mode) (when (derived-mode-p 'antlr-mode)
(let* ((file-deps (antlr-file-dependencies)) (let* ((file-deps (antlr-file-dependencies))
(file (car file-deps))) (file (car file-deps)))
(when file-deps (when file-deps
@ -2373,7 +2383,7 @@ are used according to variable `antlr-unknown-file-formats' and a
commentary with value `antlr-help-unknown-file-text' is added. The commentary with value `antlr-help-unknown-file-text' is added. The
*Help* buffer always starts with the text in `antlr-help-rules-intro'." *Help* buffer always starts with the text in `antlr-help-rules-intro'."
(interactive) (interactive)
(if (null (eq major-mode 'makefile-mode)) (if (null (derived-mode-p 'makefile-mode))
(antlr-with-displaying-help-buffer 'antlr-insert-makefile-rules) (antlr-with-displaying-help-buffer 'antlr-insert-makefile-rules)
(push-mark) (push-mark)
(antlr-insert-makefile-rules t))) (antlr-insert-makefile-rules t)))
@ -2563,13 +2573,15 @@ ANTLR's syntax and influences the auto indentation, see
"Find language in `antlr-language-alist' for language option. "Find language in `antlr-language-alist' for language option.
If SEARCH is non-nil, find element for language option. Otherwise, find If SEARCH is non-nil, find element for language option. Otherwise, find
the default language." the default language."
(let ((value (and search (let ((value
(save-excursion (and search
(goto-char (point-min)) (save-excursion
(re-search-forward (cdr antlr-language-limit-n-regexp) (goto-char (point-min))
(car antlr-language-limit-n-regexp) (re-search-forward (cdr antlr-language-limit-n-regexp)
t)) (+ (point)
(match-string 1))) (car antlr-language-limit-n-regexp))
t))
(match-string 1)))
(seq antlr-language-alist) (seq antlr-language-alist)
r) r)
;; Like (find VALUE antlr-language-alist :key 'cddr :test 'member) ;; Like (find VALUE antlr-language-alist :key 'cddr :test 'member)
@ -2581,35 +2593,20 @@ the default language."
(car r))) (car r)))
;;;###autoload ;;;###autoload
(defun antlr-mode () (define-derived-mode antlr-mode prog-mode
"Major mode for editing ANTLR grammar files. ;; FIXME: Since it uses cc-mode, it bumps into c-update-modeline's
\\{antlr-mode-map}" ;; limitation to mode-name being a string.
(interactive) ;; '("Antlr." (:eval (cadr (assq antlr-language antlr-language-alist))))
(kill-all-local-variables) "Antlr"
"Major mode for editing ANTLR grammar files."
:abbrev-table antlr-mode-abbrev-table
(c-initialize-cc-mode) ; cc-mode is required (c-initialize-cc-mode) ; cc-mode is required
(unless (fboundp 'c-forward-sws) ; see above (unless (fboundp 'c-forward-sws) ; see above
(fset 'antlr-c-forward-sws 'c-forward-syntactic-ws)) (fset 'antlr-c-forward-sws 'c-forward-syntactic-ws))
;; ANTLR specific ---------------------------------------------------------- ;; ANTLR specific ----------------------------------------------------------
(setq major-mode 'antlr-mode
mode-name "Antlr")
(setq local-abbrev-table antlr-mode-abbrev-table)
(unless antlr-mode-syntax-table
(setq antlr-mode-syntax-table (make-syntax-table))
(c-populate-syntax-table antlr-mode-syntax-table))
(set-syntax-table antlr-mode-syntax-table)
(unless antlr-action-syntax-table
(let ((slist (nth 3 antlr-font-lock-defaults)))
(setq antlr-action-syntax-table
(copy-syntax-table antlr-mode-syntax-table))
(while slist
(modify-syntax-entry (caar slist) (cdar slist)
antlr-action-syntax-table)
(setq slist (cdr slist)))))
(use-local-map antlr-mode-map)
(make-local-variable 'antlr-language)
(unless antlr-language (unless antlr-language
(setq antlr-language (set (make-local-variable 'antlr-language)
(or (antlr-language-option t) (antlr-language-option nil)))) (or (antlr-language-option t) (antlr-language-option nil))))
(if (stringp (cadr (assq antlr-language antlr-language-alist))) (if (stringp (cadr (assq antlr-language antlr-language-alist)))
(setq mode-name (setq mode-name
(concat "Antlr." (concat "Antlr."
@ -2627,33 +2624,24 @@ the default language."
(t ; cc-mode upto 5.28 (t ; cc-mode upto 5.28
(antlr-c-init-language-vars))) ; do it myself (antlr-c-init-language-vars))) ; do it myself
(c-basic-common-init antlr-language (or antlr-indent-style "gnu")) (c-basic-common-init antlr-language (or antlr-indent-style "gnu"))
(make-local-variable 'outline-regexp) (set (make-local-variable 'outline-regexp) "[^#\n\^M]")
(make-local-variable 'outline-level) (set (make-local-variable 'outline-level) 'c-outline-level) ;TODO: define own
(make-local-variable 'require-final-newline) (set (make-local-variable 'indent-line-function) 'antlr-indent-line)
(make-local-variable 'indent-line-function) (set (make-local-variable 'indent-region-function) nil) ; too lazy
(make-local-variable 'indent-region-function)
(setq outline-regexp "[^#\n\^M]"
outline-level 'c-outline-level) ; TODO: define own
(setq require-final-newline mode-require-final-newline)
(setq indent-line-function 'antlr-indent-line
indent-region-function nil) ; too lazy
(setq comment-start "// " (setq comment-start "// "
comment-end "" comment-end ""
comment-start-skip "/\\*+ *\\|// *") comment-start-skip "/\\*+ *\\|// *")
;; various ----------------------------------------------------------------- ;; various -----------------------------------------------------------------
(make-local-variable 'font-lock-defaults) (set (make-local-variable 'font-lock-defaults) antlr-font-lock-defaults)
(setq font-lock-defaults antlr-font-lock-defaults)
(easy-menu-add antlr-mode-menu) (easy-menu-add antlr-mode-menu)
(make-local-variable 'imenu-create-index-function) (set (make-local-variable 'imenu-create-index-function)
(setq imenu-create-index-function 'antlr-imenu-create-index-function) 'antlr-imenu-create-index-function)
(make-local-variable 'imenu-generic-expression) (set (make-local-variable 'imenu-generic-expression) t) ; fool stupid test
(setq imenu-generic-expression t) ; fool stupid test
(and antlr-imenu-name ; there should be a global variable... (and antlr-imenu-name ; there should be a global variable...
(fboundp 'imenu-add-to-menubar) (fboundp 'imenu-add-to-menubar)
(imenu-add-to-menubar (imenu-add-to-menubar
(if (stringp antlr-imenu-name) antlr-imenu-name "Index"))) (if (stringp antlr-imenu-name) antlr-imenu-name "Index")))
(antlr-set-tabs) (antlr-set-tabs))
(run-mode-hooks 'antlr-mode-hook))
;; A smarter version of `group-buffers-menu-by-mode-then-alphabetically' (in ;; A smarter version of `group-buffers-menu-by-mode-then-alphabetically' (in
;; XEmacs) could use the following property. The header of the submenu would ;; XEmacs) could use the following property. The header of the submenu would

View file

@ -77,15 +77,14 @@
(define-key map "\C-c;" 'comment-region) (define-key map "\C-c;" 'comment-region)
(define-key map "\C-j" 'newline-and-indent) (define-key map "\C-j" 'newline-and-indent)
(define-key map "\C-m" 'newline-and-indent) (define-key map "\C-m" 'newline-and-indent)
(define-key map [menu-bar] (make-sparse-keymap)) (define-key map [menu-bar asm-mode] (cons "Asm" (make-sparse-keymap)))
(define-key map [menu-bar asm-mode] (cons "Asm" map)) (define-key map [menu-bar asm-mode comment-region]
(define-key map [comment-region]
'(menu-item "Comment Region" comment-region '(menu-item "Comment Region" comment-region
:help "Comment or uncomment each line in the region")) :help "Comment or uncomment each line in the region"))
(define-key map [newline-and-indent] (define-key map [menu-bar asm-mode newline-and-indent]
'(menu-item "Insert Newline and Indent" newline-and-indent '(menu-item "Insert Newline and Indent" newline-and-indent
:help "Insert a newline, then indent according to major mode")) :help "Insert a newline, then indent according to major mode"))
(define-key map [asm-colon] (define-key map [menu-bar asm-mode asm-colon]
'(menu-item "Insert Colon" asm-colon '(menu-item "Insert Colon" asm-colon
:help "Insert a colon; if it follows a label, delete the label's indentation")) :help "Insert a colon; if it follows a label, delete the label's indentation"))
map) map)
@ -142,16 +141,12 @@ Special commands:
(set-syntax-table (make-syntax-table asm-mode-syntax-table)) (set-syntax-table (make-syntax-table asm-mode-syntax-table))
(modify-syntax-entry asm-comment-char "< b") (modify-syntax-entry asm-comment-char "< b")
(make-local-variable 'comment-start) (set (make-local-variable 'comment-start) (string asm-comment-char))
(setq comment-start (string asm-comment-char)) (set (make-local-variable 'comment-add) 1)
(make-local-variable 'comment-add) (set (make-local-variable 'comment-start-skip)
(setq comment-add 1) "\\(?:\\s<+\\|/[/*]+\\)[ \t]*")
(make-local-variable 'comment-start-skip) (set (make-local-variable 'comment-end-skip) "[ \t]*\\(\\s>\\|\\*+/\\)")
(setq comment-start-skip "\\(?:\\s<+\\|/[/*]+\\)[ \t]*") (set (make-local-variable 'comment-end) "")
(make-local-variable 'comment-end-skip)
(setq comment-end-skip "[ \t]*\\(\\s>\\|\\*+/\\)")
(make-local-variable 'comment-end)
(setq comment-end "")
(setq fill-prefix "\t")) (setq fill-prefix "\t"))
(defun asm-indent-line () (defun asm-indent-line ()

View file

@ -78,14 +78,8 @@ searching backwards at another AC_... command."
(match-string-no-properties 3))))) (match-string-no-properties 3)))))
;;;###autoload ;;;###autoload
(defun autoconf-mode () (define-derived-mode autoconf-mode prog-mode "Autoconf"
"Major mode for editing Autoconf configure.in files." "Major mode for editing Autoconf configure.in files."
(interactive)
(kill-all-local-variables)
(use-local-map autoconf-mode-map)
(setq major-mode 'autoconf-mode)
(setq mode-name "Autoconf")
(set-syntax-table autoconf-mode-syntax-table)
(set (make-local-variable 'parens-require-spaces) nil) ; for M4 arg lists (set (make-local-variable 'parens-require-spaces) nil) ; for M4 arg lists
(set (make-local-variable 'defun-prompt-regexp) (set (make-local-variable 'defun-prompt-regexp)
"^[ \t]*A[CM]_\\(\\sw\\|\\s_\\)+") "^[ \t]*A[CM]_\\(\\sw\\|\\s_\\)+")
@ -100,8 +94,7 @@ searching backwards at another AC_... command."
(set (make-local-variable 'imenu-syntax-alist) '(("_" . "w"))) (set (make-local-variable 'imenu-syntax-alist) '(("_" . "w")))
(set (make-local-variable 'indent-line-function) #'indent-relative) (set (make-local-variable 'indent-line-function) #'indent-relative)
(set (make-local-variable 'add-log-current-defun-function) (set (make-local-variable 'add-log-current-defun-function)
#'autoconf-current-defun-function) #'autoconf-current-defun-function))
(run-mode-hooks 'autoconf-mode-hook))
(provide 'autoconf-mode) (provide 'autoconf-mode)
(provide 'autoconf) (provide 'autoconf)

View file

@ -266,8 +266,10 @@ With universal argument, inserts the analysis as a comment on that line."
(symbol-value 'subword-mode)) (symbol-value 'subword-mode))
"w" "w"
""))) "")))
;; FIXME: Derived modes might want to use something else
;; than a string for `mode-name'.
(bare-mode-name (if (string-match "\\(^[^/]*\\)/" mode-name) (bare-mode-name (if (string-match "\\(^[^/]*\\)/" mode-name)
(substring mode-name (match-beginning 1) (match-end 1)) (match-string 1 mode-name)
mode-name))) mode-name)))
;; (setq c-submode-indicators ;; (setq c-submode-indicators
;; (if (> (length fmt) 1) ;; (if (> (length fmt) 1)

View file

@ -487,15 +487,10 @@ that requires a literal mode spec at compile time."
;; these variables should always be buffer local; they do not affect ;; these variables should always be buffer local; they do not affect
;; indentation style. ;; indentation style.
(make-local-variable 'parse-sexp-ignore-comments)
(make-local-variable 'indent-line-function)
(make-local-variable 'indent-region-function)
(make-local-variable 'normal-auto-fill-function)
(make-local-variable 'comment-start) (make-local-variable 'comment-start)
(make-local-variable 'comment-end) (make-local-variable 'comment-end)
(make-local-variable 'comment-start-skip) (make-local-variable 'comment-start-skip)
(make-local-variable 'comment-multi-line)
(make-local-variable 'comment-line-break-function)
(make-local-variable 'paragraph-start) (make-local-variable 'paragraph-start)
(make-local-variable 'paragraph-separate) (make-local-variable 'paragraph-separate)
(make-local-variable 'paragraph-ignore-fill-prefix) (make-local-variable 'paragraph-ignore-fill-prefix)
@ -503,18 +498,18 @@ that requires a literal mode spec at compile time."
(make-local-variable 'adaptive-fill-regexp) (make-local-variable 'adaptive-fill-regexp)
;; now set their values ;; now set their values
(setq parse-sexp-ignore-comments t (set (make-local-variable 'parse-sexp-ignore-comments) t)
indent-line-function 'c-indent-line (set (make-local-variable 'indent-line-function) 'c-indent-line)
indent-region-function 'c-indent-region (set (make-local-variable 'indent-region-function) 'c-indent-region)
normal-auto-fill-function 'c-do-auto-fill (set (make-local-variable 'normal-auto-fill-function) 'c-do-auto-fill)
comment-multi-line t (set (make-local-variable 'comment-multi-line) t)
comment-line-break-function 'c-indent-new-comment-line) (set (make-local-variable 'comment-line-break-function)
'c-indent-new-comment-line)
;; Install `c-fill-paragraph' on `fill-paragraph-function' so that a ;; Install `c-fill-paragraph' on `fill-paragraph-function' so that a
;; direct call to `fill-paragraph' behaves better. This still ;; direct call to `fill-paragraph' behaves better. This still
;; doesn't work with filladapt but it's better than nothing. ;; doesn't work with filladapt but it's better than nothing.
(make-local-variable 'fill-paragraph-function) (set (make-local-variable 'fill-paragraph-function) 'c-fill-paragraph)
(setq fill-paragraph-function 'c-fill-paragraph)
;; Initialise the cache of brace pairs, and opening braces/brackets/parens. ;; Initialise the cache of brace pairs, and opening braces/brackets/parens.
(c-state-cache-init) (c-state-cache-init)
@ -532,22 +527,19 @@ that requires a literal mode spec at compile time."
;; Emacs. ;; Emacs.
(when (boundp 'parse-sexp-lookup-properties) (when (boundp 'parse-sexp-lookup-properties)
(make-local-variable 'parse-sexp-lookup-properties) (set (make-local-variable 'parse-sexp-lookup-properties) t))
(setq parse-sexp-lookup-properties t))
;; Same as above for XEmacs. ;; Same as above for XEmacs.
(when (boundp 'lookup-syntax-properties) (when (boundp 'lookup-syntax-properties)
(make-local-variable 'lookup-syntax-properties) (set (make-local-variable 'lookup-syntax-properties) t)))
(setq lookup-syntax-properties t)))
;; Use this in Emacs 21+ to avoid meddling with the rear-nonsticky ;; Use this in Emacs 21+ to avoid meddling with the rear-nonsticky
;; property on each character. ;; property on each character.
(when (boundp 'text-property-default-nonsticky) (when (boundp 'text-property-default-nonsticky)
(make-local-variable 'text-property-default-nonsticky)
(mapc (lambda (tprop) (mapc (lambda (tprop)
(unless (assq tprop text-property-default-nonsticky) (unless (assq tprop text-property-default-nonsticky)
(setq text-property-default-nonsticky (set (make-local-variable 'text-property-default-nonsticky)
(cons `(,tprop . t) text-property-default-nonsticky)))) (cons `(,tprop . t) text-property-default-nonsticky))))
'(syntax-table category c-type))) '(syntax-table category c-type)))
;; In Emacs 21 and later it's possible to turn off the ad-hoc ;; In Emacs 21 and later it's possible to turn off the ad-hoc
@ -587,8 +579,7 @@ that requires a literal mode spec at compile time."
(setq c-offsets-alist (copy-alist c-offsets-alist)) (setq c-offsets-alist (copy-alist c-offsets-alist))
;; setup the comment indent variable in a Emacs version portable way ;; setup the comment indent variable in a Emacs version portable way
(make-local-variable 'comment-indent-function) (set (make-local-variable 'comment-indent-function) 'c-comment-indent)
(setq comment-indent-function 'c-comment-indent)
;; ;; Put submode indicators onto minor-mode-alist, but only once. ;; ;; Put submode indicators onto minor-mode-alist, but only once.
;; (or (assq 'c-submode-indicators minor-mode-alist) ;; (or (assq 'c-submode-indicators minor-mode-alist)
@ -660,16 +651,14 @@ compatible with old code; callers should always specify it."
(funcall c-before-font-lock-function (point-min) (point-max) (funcall c-before-font-lock-function (point-min) (point-max)
(- (point-max) (point-min)))))) (- (point-max) (point-min))))))
(make-local-variable 'outline-regexp) (set (make-local-variable 'outline-regexp) "[^#\n\^M]")
(make-local-variable 'outline-level) (set (make-local-variable 'outline-level) 'c-outline-level)
(setq outline-regexp "[^#\n\^M]"
outline-level 'c-outline-level)
(let ((rfn (assq mode c-require-final-newline))) (let ((rfn (assq mode c-require-final-newline)))
(when rfn (when rfn
(make-local-variable 'require-final-newline)
(and (cdr rfn) (and (cdr rfn)
(setq require-final-newline mode-require-final-newline))))) (set (make-local-variable 'require-final-newline)
mode-require-final-newline)))))
(defun c-count-cfss (lv-alist) (defun c-count-cfss (lv-alist)
;; LV-ALIST is an alist like `file-local-variables-alist'. Count how many ;; LV-ALIST is an alist like `file-local-variables-alist'. Count how many
@ -1100,8 +1089,7 @@ Note that the style variables are always made local to the buffer."
This does not load the font-lock package. Use after This does not load the font-lock package. Use after
`c-basic-common-init' and after cc-fonts has been loaded." `c-basic-common-init' and after cc-fonts has been loaded."
(make-local-variable 'font-lock-defaults) (set (make-local-variable 'font-lock-defaults)
(setq font-lock-defaults
`(,(if (c-major-mode-is 'awk-mode) `(,(if (c-major-mode-is 'awk-mode)
;; awk-mode currently has only one font lock level. ;; awk-mode currently has only one font lock level.
'awk-font-lock-keywords 'awk-font-lock-keywords
@ -1206,7 +1194,7 @@ Key bindings:
(kill-all-local-variables) (kill-all-local-variables)
(c-initialize-cc-mode t) (c-initialize-cc-mode t)
(set-syntax-table c-mode-syntax-table) (set-syntax-table c-mode-syntax-table)
(setq major-mode 'c-mode (setq major-mode 'c-mode ; FIXME: Use define-derived-mode.
mode-name "C" mode-name "C"
local-abbrev-table c-mode-abbrev-table local-abbrev-table c-mode-abbrev-table
abbrev-mode t) abbrev-mode t)
@ -1269,7 +1257,7 @@ Key bindings:
(kill-all-local-variables) (kill-all-local-variables)
(c-initialize-cc-mode t) (c-initialize-cc-mode t)
(set-syntax-table c++-mode-syntax-table) (set-syntax-table c++-mode-syntax-table)
(setq major-mode 'c++-mode (setq major-mode 'c++-mode ; FIXME: Use define-derived-mode.
mode-name "C++" mode-name "C++"
local-abbrev-table c++-mode-abbrev-table local-abbrev-table c++-mode-abbrev-table
abbrev-mode t) abbrev-mode t)
@ -1330,7 +1318,7 @@ Key bindings:
(kill-all-local-variables) (kill-all-local-variables)
(c-initialize-cc-mode t) (c-initialize-cc-mode t)
(set-syntax-table objc-mode-syntax-table) (set-syntax-table objc-mode-syntax-table)
(setq major-mode 'objc-mode (setq major-mode 'objc-mode ; FIXME: Use define-derived-mode.
mode-name "ObjC" mode-name "ObjC"
local-abbrev-table objc-mode-abbrev-table local-abbrev-table objc-mode-abbrev-table
abbrev-mode t) abbrev-mode t)
@ -1400,7 +1388,7 @@ Key bindings:
(kill-all-local-variables) (kill-all-local-variables)
(c-initialize-cc-mode t) (c-initialize-cc-mode t)
(set-syntax-table java-mode-syntax-table) (set-syntax-table java-mode-syntax-table)
(setq major-mode 'java-mode (setq major-mode 'java-mode ; FIXME: Use define-derived-mode.
mode-name "Java" mode-name "Java"
local-abbrev-table java-mode-abbrev-table local-abbrev-table java-mode-abbrev-table
abbrev-mode t) abbrev-mode t)
@ -1459,7 +1447,7 @@ Key bindings:
(kill-all-local-variables) (kill-all-local-variables)
(c-initialize-cc-mode t) (c-initialize-cc-mode t)
(set-syntax-table idl-mode-syntax-table) (set-syntax-table idl-mode-syntax-table)
(setq major-mode 'idl-mode (setq major-mode 'idl-mode ; FIXME: Use define-derived-mode.
mode-name "IDL" mode-name "IDL"
local-abbrev-table idl-mode-abbrev-table) local-abbrev-table idl-mode-abbrev-table)
(use-local-map idl-mode-map) (use-local-map idl-mode-map)
@ -1520,7 +1508,7 @@ Key bindings:
(kill-all-local-variables) (kill-all-local-variables)
(c-initialize-cc-mode t) (c-initialize-cc-mode t)
(set-syntax-table pike-mode-syntax-table) (set-syntax-table pike-mode-syntax-table)
(setq major-mode 'pike-mode (setq major-mode 'pike-mode ; FIXME: Use define-derived-mode.
mode-name "Pike" mode-name "Pike"
local-abbrev-table pike-mode-abbrev-table local-abbrev-table pike-mode-abbrev-table
abbrev-mode t) abbrev-mode t)
@ -1594,7 +1582,7 @@ Key bindings:
(kill-all-local-variables) (kill-all-local-variables)
(c-initialize-cc-mode t) (c-initialize-cc-mode t)
(set-syntax-table awk-mode-syntax-table) (set-syntax-table awk-mode-syntax-table)
(setq major-mode 'awk-mode (setq major-mode 'awk-mode ; FIXME: Use define-derived-mode.
mode-name "AWK" mode-name "AWK"
local-abbrev-table awk-mode-abbrev-table local-abbrev-table awk-mode-abbrev-table
abbrev-mode t) abbrev-mode t)
@ -1680,7 +1668,7 @@ Key bindings:
adaptive-fill-regexp) adaptive-fill-regexp)
nil))) nil)))
(mapc (lambda (var) (unless (boundp var) (mapc (lambda (var) (unless (boundp var)
(setq vars (delq var vars)))) (setq vars (delq var vars))))
'(signal-error-on-buffer-boundary '(signal-error-on-buffer-boundary
filladapt-mode filladapt-mode
defun-prompt-regexp defun-prompt-regexp

View file

@ -540,13 +540,12 @@ variables."
(when (boundp 'adaptive-fill-first-line-regexp) (when (boundp 'adaptive-fill-first-line-regexp)
;; XEmacs adaptive fill mode doesn't have this. ;; XEmacs adaptive fill mode doesn't have this.
(make-local-variable 'adaptive-fill-first-line-regexp) (set (make-local-variable 'adaptive-fill-first-line-regexp)
(setq adaptive-fill-first-line-regexp (concat "\\`" comment-line-prefix
(concat "\\`" comment-line-prefix ;; Maybe we should incorporate the old value here,
;; Maybe we should incorporate the old value here, ;; but then we have to do all sorts of kludges to
;; but then we have to do all sorts of kludges to ;; deal with the \` and \' it probably contains.
;; deal with the \` and \' it probably contains. "\\'"))))
"\\'"))))
;; Set up the values for use in strings. These are the default ;; Set up the values for use in strings. These are the default
;; paragraph-start/separate values, enhanced to accept escaped EOLs as ;; paragraph-start/separate values, enhanced to accept escaped EOLs as

View file

@ -221,7 +221,6 @@ to the action header."
;; movement. ;; movement.
(set (make-local-variable 'parens-require-spaces) nil) (set (make-local-variable 'parens-require-spaces) nil)
(set (make-local-variable 'require-final-newline) mode-require-final-newline)
(set (make-local-variable 'comment-start) "# ") (set (make-local-variable 'comment-start) "# ")
(set (make-local-variable 'comment-start-skip) (set (make-local-variable 'comment-start-skip)
"\\(\\(?:^\\|[^\\\\\n]\\)\\(?:\\\\\\\\\\)*\\)#+[ \t]*") "\\(\\(?:^\\|[^\\\\\n]\\)\\(?:\\\\\\\\\\)*\\)#+[ \t]*")

View file

@ -1606,7 +1606,7 @@ Runs `compilation-mode-hook' with `run-mode-hooks' (which see).
;; Let windows scroll along with the output. ;; Let windows scroll along with the output.
(set (make-local-variable 'window-point-insertion-type) t) (set (make-local-variable 'window-point-insertion-type) t)
(set (make-local-variable 'tool-bar-map) compilation-mode-tool-bar-map) (set (make-local-variable 'tool-bar-map) compilation-mode-tool-bar-map)
(setq major-mode 'compilation-mode (setq major-mode 'compilation-mode ; FIXME: Use define-derived-mode.
mode-name (or name-of-mode "Compilation")) mode-name (or name-of-mode "Compilation"))
(set (make-local-variable 'page-delimiter) (set (make-local-variable 'page-delimiter)
compilation-page-delimiter) compilation-page-delimiter)

View file

@ -416,63 +416,59 @@ A prefix arg suppresses display of that buffer."
;;; Edit Buffer: ;;; Edit Buffer:
(defvar cpp-edit-map nil) (defvar cpp-edit-mode-map
;; Keymap for `cpp-edit-mode'. (let ((map (make-keymap)))
(suppress-keymap map)
(define-key map [ down-mouse-2 ] 'cpp-push-button)
(define-key map [ mouse-2 ] 'ignore)
(define-key map " " 'scroll-up)
(define-key map "\C-?" 'scroll-down)
(define-key map [ delete ] 'scroll-down)
(define-key map "\C-c\C-c" 'cpp-edit-apply)
(define-key map "a" 'cpp-edit-apply)
(define-key map "A" 'cpp-edit-apply)
(define-key map "r" 'cpp-edit-reset)
(define-key map "R" 'cpp-edit-reset)
(define-key map "s" 'cpp-edit-save)
(define-key map "S" 'cpp-edit-save)
(define-key map "l" 'cpp-edit-load)
(define-key map "L" 'cpp-edit-load)
(define-key map "h" 'cpp-edit-home)
(define-key map "H" 'cpp-edit-home)
(define-key map "b" 'cpp-edit-background)
(define-key map "B" 'cpp-edit-background)
(define-key map "k" 'cpp-edit-known)
(define-key map "K" 'cpp-edit-known)
(define-key map "u" 'cpp-edit-unknown)
(define-key map "u" 'cpp-edit-unknown)
(define-key map "t" 'cpp-edit-true)
(define-key map "T" 'cpp-edit-true)
(define-key map "f" 'cpp-edit-false)
(define-key map "F" 'cpp-edit-false)
(define-key map "w" 'cpp-edit-write)
(define-key map "W" 'cpp-edit-write)
(define-key map "X" 'cpp-edit-toggle-known)
(define-key map "x" 'cpp-edit-toggle-known)
(define-key map "Y" 'cpp-edit-toggle-unknown)
(define-key map "y" 'cpp-edit-toggle-unknown)
(define-key map "q" 'bury-buffer)
(define-key map "Q" 'bury-buffer)
map)
"Keymap for `cpp-edit-mode'.")
(if cpp-edit-map
()
(setq cpp-edit-map (make-keymap))
(suppress-keymap cpp-edit-map)
(define-key cpp-edit-map [ down-mouse-2 ] 'cpp-push-button)
(define-key cpp-edit-map [ mouse-2 ] 'ignore)
(define-key cpp-edit-map " " 'scroll-up)
(define-key cpp-edit-map "\C-?" 'scroll-down)
(define-key cpp-edit-map [ delete ] 'scroll-down)
(define-key cpp-edit-map "\C-c\C-c" 'cpp-edit-apply)
(define-key cpp-edit-map "a" 'cpp-edit-apply)
(define-key cpp-edit-map "A" 'cpp-edit-apply)
(define-key cpp-edit-map "r" 'cpp-edit-reset)
(define-key cpp-edit-map "R" 'cpp-edit-reset)
(define-key cpp-edit-map "s" 'cpp-edit-save)
(define-key cpp-edit-map "S" 'cpp-edit-save)
(define-key cpp-edit-map "l" 'cpp-edit-load)
(define-key cpp-edit-map "L" 'cpp-edit-load)
(define-key cpp-edit-map "h" 'cpp-edit-home)
(define-key cpp-edit-map "H" 'cpp-edit-home)
(define-key cpp-edit-map "b" 'cpp-edit-background)
(define-key cpp-edit-map "B" 'cpp-edit-background)
(define-key cpp-edit-map "k" 'cpp-edit-known)
(define-key cpp-edit-map "K" 'cpp-edit-known)
(define-key cpp-edit-map "u" 'cpp-edit-unknown)
(define-key cpp-edit-map "u" 'cpp-edit-unknown)
(define-key cpp-edit-map "t" 'cpp-edit-true)
(define-key cpp-edit-map "T" 'cpp-edit-true)
(define-key cpp-edit-map "f" 'cpp-edit-false)
(define-key cpp-edit-map "F" 'cpp-edit-false)
(define-key cpp-edit-map "w" 'cpp-edit-write)
(define-key cpp-edit-map "W" 'cpp-edit-write)
(define-key cpp-edit-map "X" 'cpp-edit-toggle-known)
(define-key cpp-edit-map "x" 'cpp-edit-toggle-known)
(define-key cpp-edit-map "Y" 'cpp-edit-toggle-unknown)
(define-key cpp-edit-map "y" 'cpp-edit-toggle-unknown)
(define-key cpp-edit-map "q" 'bury-buffer)
(define-key cpp-edit-map "Q" 'bury-buffer))
(defvar cpp-edit-symbols nil) (defvar cpp-edit-symbols nil)
;; Symbols defined in the edit buffer. ;; Symbols defined in the edit buffer.
(make-variable-buffer-local 'cpp-edit-symbols) (make-variable-buffer-local 'cpp-edit-symbols)
(defun cpp-edit-mode () (define-derived-mode cpp-edit-mode fundamental-mode "CPP Edit"
"Major mode for editing the criteria for highlighting cpp conditionals. "Major mode for editing the criteria for highlighting cpp conditionals.
Click on objects to change them. Click on objects to change them.
You can also use the keyboard accelerators indicated like this: [K]ey." You can also use the keyboard accelerators indicated like this: [K]ey."
(kill-all-local-variables)
(buffer-disable-undo) (buffer-disable-undo)
(auto-save-mode -1) (auto-save-mode -1)
(setq buffer-read-only t) (setq buffer-read-only t))
(setq major-mode 'cpp-edit-mode)
(setq mode-name "CPP Edit")
(use-local-map cpp-edit-map))
(defun cpp-edit-apply () (defun cpp-edit-apply ()
"Apply edited display information to original buffer." "Apply edited display information to original buffer."
@ -568,7 +564,7 @@ You can also use the keyboard accelerators indicated like this: [K]ey."
(load-file cpp-config-file)) (load-file cpp-config-file))
((file-readable-p (concat "~/" cpp-config-file)) ((file-readable-p (concat "~/" cpp-config-file))
(load-file cpp-config-file))) (load-file cpp-config-file)))
(if (eq major-mode 'cpp-edit-mode) (if (derived-mode-p 'cpp-edit-mode)
(cpp-edit-reset))) (cpp-edit-reset)))
(defun cpp-edit-save () (defun cpp-edit-save ()

View file

@ -296,72 +296,69 @@ See `imenu-generic-expression' for details."
) )
(defvar dcl-mode-map () (defvar dcl-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\e\n" 'dcl-split-line)
(define-key map "\e\t" 'tempo-complete-tag)
(define-key map "\e^" 'dcl-delete-indentation)
(define-key map "\em" 'dcl-back-to-indentation)
(define-key map "\ee" 'dcl-forward-command)
(define-key map "\ea" 'dcl-backward-command)
(define-key map "\e\C-q" 'dcl-indent-command)
(define-key map "\t" 'dcl-tab)
(define-key map ":" 'dcl-electric-character)
(define-key map "F" 'dcl-electric-character)
(define-key map "f" 'dcl-electric-character)
(define-key map "E" 'dcl-electric-character)
(define-key map "e" 'dcl-electric-character)
(define-key map "\C-c\C-o" 'dcl-set-option)
(define-key map "\C-c\C-f" 'tempo-forward-mark)
(define-key map "\C-c\C-b" 'tempo-backward-mark)
(define-key map [menu-bar] (make-sparse-keymap))
(define-key map [menu-bar dcl]
(cons "DCL" (make-sparse-keymap "DCL")))
;; Define these in bottom-up order
(define-key map [menu-bar dcl tempo-backward-mark]
'("Previous template mark" . tempo-backward-mark))
(define-key map [menu-bar dcl tempo-forward-mark]
'("Next template mark" . tempo-forward-mark))
(define-key map [menu-bar dcl tempo-complete-tag]
'("Complete template tag" . tempo-complete-tag))
(define-key map [menu-bar dcl dcl-separator-tempo]
'("--"))
(define-key map [menu-bar dcl dcl-save-all-options]
'("Save all options" . dcl-save-all-options))
(define-key map [menu-bar dcl dcl-save-nondefault-options]
'("Save changed options" . dcl-save-nondefault-options))
(define-key map [menu-bar dcl dcl-set-option]
'("Set option" . dcl-set-option))
(define-key map [menu-bar dcl dcl-separator-option]
'("--"))
(define-key map [menu-bar dcl dcl-delete-indentation]
'("Delete indentation" . dcl-delete-indentation))
(define-key map [menu-bar dcl dcl-split-line]
'("Split line" . dcl-split-line))
(define-key map [menu-bar dcl dcl-indent-command]
'("Indent command" . dcl-indent-command))
(define-key map [menu-bar dcl dcl-tab]
'("Indent line/insert tab" . dcl-tab))
(define-key map [menu-bar dcl dcl-back-to-indentation]
'("Back to indentation" . dcl-back-to-indentation))
(define-key map [menu-bar dcl dcl-forward-command]
'("End of statement" . dcl-forward-command))
(define-key map [menu-bar dcl dcl-backward-command]
'("Beginning of statement" . dcl-backward-command))
;; imenu is only supported for versions with imenu-generic-expression
(if (boundp 'imenu-generic-expression)
(progn
(define-key map [menu-bar dcl dcl-separator-movement]
'("--"))
(define-key map [menu-bar dcl imenu]
'("Buffer index menu" . imenu))))
map)
"Keymap used in DCL-mode buffers.") "Keymap used in DCL-mode buffers.")
(if dcl-mode-map
()
(setq dcl-mode-map (make-sparse-keymap))
(define-key dcl-mode-map "\e\n" 'dcl-split-line)
(define-key dcl-mode-map "\e\t" 'tempo-complete-tag)
(define-key dcl-mode-map "\e^" 'dcl-delete-indentation)
(define-key dcl-mode-map "\em" 'dcl-back-to-indentation)
(define-key dcl-mode-map "\ee" 'dcl-forward-command)
(define-key dcl-mode-map "\ea" 'dcl-backward-command)
(define-key dcl-mode-map "\e\C-q" 'dcl-indent-command)
(define-key dcl-mode-map "\t" 'dcl-tab)
(define-key dcl-mode-map ":" 'dcl-electric-character)
(define-key dcl-mode-map "F" 'dcl-electric-character)
(define-key dcl-mode-map "f" 'dcl-electric-character)
(define-key dcl-mode-map "E" 'dcl-electric-character)
(define-key dcl-mode-map "e" 'dcl-electric-character)
(define-key dcl-mode-map "\C-c\C-o" 'dcl-set-option)
(define-key dcl-mode-map "\C-c\C-f" 'tempo-forward-mark)
(define-key dcl-mode-map "\C-c\C-b" 'tempo-backward-mark)
(define-key dcl-mode-map [menu-bar] (make-sparse-keymap))
(define-key dcl-mode-map [menu-bar dcl]
(cons "DCL" (make-sparse-keymap "DCL")))
;; Define these in bottom-up order
(define-key dcl-mode-map [menu-bar dcl tempo-backward-mark]
'("Previous template mark" . tempo-backward-mark))
(define-key dcl-mode-map [menu-bar dcl tempo-forward-mark]
'("Next template mark" . tempo-forward-mark))
(define-key dcl-mode-map [menu-bar dcl tempo-complete-tag]
'("Complete template tag" . tempo-complete-tag))
(define-key dcl-mode-map [menu-bar dcl dcl-separator-tempo]
'("--"))
(define-key dcl-mode-map [menu-bar dcl dcl-save-all-options]
'("Save all options" . dcl-save-all-options))
(define-key dcl-mode-map [menu-bar dcl dcl-save-nondefault-options]
'("Save changed options" . dcl-save-nondefault-options))
(define-key dcl-mode-map [menu-bar dcl dcl-set-option]
'("Set option" . dcl-set-option))
(define-key dcl-mode-map [menu-bar dcl dcl-separator-option]
'("--"))
(define-key dcl-mode-map [menu-bar dcl dcl-delete-indentation]
'("Delete indentation" . dcl-delete-indentation))
(define-key dcl-mode-map [menu-bar dcl dcl-split-line]
'("Split line" . dcl-split-line))
(define-key dcl-mode-map [menu-bar dcl dcl-indent-command]
'("Indent command" . dcl-indent-command))
(define-key dcl-mode-map [menu-bar dcl dcl-tab]
'("Indent line/insert tab" . dcl-tab))
(define-key dcl-mode-map [menu-bar dcl dcl-back-to-indentation]
'("Back to indentation" . dcl-back-to-indentation))
(define-key dcl-mode-map [menu-bar dcl dcl-forward-command]
'("End of statement" . dcl-forward-command))
(define-key dcl-mode-map [menu-bar dcl dcl-backward-command]
'("Beginning of statement" . dcl-backward-command))
;; imenu is only supported for versions with imenu-generic-expression
(if (boundp 'imenu-generic-expression)
(progn
(define-key dcl-mode-map [menu-bar dcl dcl-separator-movement]
'("--"))
(define-key dcl-mode-map [menu-bar dcl imenu]
'("Buffer index menu" . imenu))))
)
(defcustom dcl-ws-r (defcustom dcl-ws-r
"\\([ \t]*-[ \t]*\\(!.*\\)*\n\\)*[ \t]*" "\\([ \t]*-[ \t]*\\(!.*\\)*\n\\)*[ \t]*"
@ -475,7 +472,7 @@ Preloaded with all known option names from dcl-option-alist")
;;;###autoload ;;;###autoload
(defun dcl-mode () (define-derived-mode dcl-mode prog-mode "DCL"
"Major mode for editing DCL-files. "Major mode for editing DCL-files.
This mode indents command lines in blocks. (A block is commands between This mode indents command lines in blocks. (A block is commands between
@ -593,29 +590,17 @@ $
There is some minimal font-lock support (see vars There is some minimal font-lock support (see vars
`dcl-font-lock-defaults' and `dcl-font-lock-keywords')." `dcl-font-lock-defaults' and `dcl-font-lock-keywords')."
(interactive) (set (make-local-variable 'indent-line-function) 'dcl-indent-line)
(kill-all-local-variables) (set (make-local-variable 'comment-start) "!")
(set-syntax-table dcl-mode-syntax-table) (set (make-local-variable 'comment-end) "")
(set (make-local-variable 'comment-multi-line) nil)
(make-local-variable 'indent-line-function)
(setq indent-line-function 'dcl-indent-line)
(make-local-variable 'comment-start)
(setq comment-start "!")
(make-local-variable 'comment-end)
(setq comment-end "")
(make-local-variable 'comment-multi-line)
(setq comment-multi-line nil)
;; This used to be "^\\$[ \t]*![ \t]*" which looks more correct. ;; This used to be "^\\$[ \t]*![ \t]*" which looks more correct.
;; The drawback was that you couldn't make empty comment lines by pressing ;; The drawback was that you couldn't make empty comment lines by pressing
;; C-M-j repeatedly - only the first line became a comment line. ;; C-M-j repeatedly - only the first line became a comment line.
;; This version has the drawback that the "$" can be anywhere in the line, ;; This version has the drawback that the "$" can be anywhere in the line,
;; and something inappropriate might be interpreted as a comment. ;; and something inappropriate might be interpreted as a comment.
(make-local-variable 'comment-start-skip) (set (make-local-variable 'comment-start-skip) "\\$[ \t]*![ \t]*")
(setq comment-start-skip "\\$[ \t]*![ \t]*")
(if (boundp 'imenu-generic-expression) (if (boundp 'imenu-generic-expression)
(progn (setq imenu-generic-expression dcl-imenu-generic-expression) (progn (setq imenu-generic-expression dcl-imenu-generic-expression)
@ -636,14 +621,9 @@ There is some minimal font-lock support (see vars
(make-local-variable 'dcl-electric-reindent-regexps) (make-local-variable 'dcl-electric-reindent-regexps)
;; font lock ;; font lock
(make-local-variable 'font-lock-defaults) (set (make-local-variable 'font-lock-defaults) dcl-font-lock-defaults)
(setq font-lock-defaults dcl-font-lock-defaults)
(setq major-mode 'dcl-mode) (tempo-use-tag-list 'dcl-tempo-tags))
(setq mode-name "DCL")
(use-local-map dcl-mode-map)
(tempo-use-tag-list 'dcl-tempo-tags)
(run-mode-hooks 'dcl-mode-hook))
;;; *** Movement commands *************************************************** ;;; *** Movement commands ***************************************************

View file

@ -1779,7 +1779,7 @@ If no extension is specified, .pas is assumed. Creates a buffer for the unit."
(if (null file) (if (null file)
(error "unit not found: %s" unit-file) (error "unit not found: %s" unit-file)
(find-file file) (find-file file)
(if (not (eq major-mode 'delphi-mode)) (if (not (derived-mode-p 'delphi-mode))
(delphi-mode))) (delphi-mode)))
file)) file))
@ -2015,7 +2015,7 @@ no args, if that value is non-nil."
(interactive) (interactive)
(kill-all-local-variables) (kill-all-local-variables)
(use-local-map delphi-mode-map) (use-local-map delphi-mode-map)
(setq major-mode 'delphi-mode) (setq major-mode 'delphi-mode) ;FIXME: Use define-derived-mode.
(setq mode-name "Delphi") (setq mode-name "Delphi")
(setq local-abbrev-table delphi-mode-abbrev-table) (setq local-abbrev-table delphi-mode-abbrev-table)
@ -2025,8 +2025,7 @@ no args, if that value is non-nil."
(mapc #'(lambda (var) (mapc #'(lambda (var)
(let ((var-symb (car var)) (let ((var-symb (car var))
(var-val (cadr var))) (var-val (cadr var)))
(make-local-variable var-symb) (set (make-local-variable var-symb) var-val)))
(set var-symb var-val)))
(list '(indent-line-function delphi-indent-line) (list '(indent-line-function delphi-indent-line)
'(comment-indent-function delphi-indent-line) '(comment-indent-function delphi-indent-line)
'(case-fold-search t) '(case-fold-search t)

View file

@ -1116,7 +1116,7 @@ if for some reason a circle is in the inheritance graph."
;;; Tree-mode - mode for tree buffers ;;; Tree-mode - mode for tree buffers
;;;###autoload ;;;###autoload
(defun ebrowse-tree-mode () (define-derived-mode ebrowse-tree-mode special-mode "Ebrowse-Tree"
"Major mode for Ebrowse class tree buffers. "Major mode for Ebrowse class tree buffers.
Each line corresponds to a class in a class tree. Each line corresponds to a class in a class tree.
Letters do not insert themselves, they are commands. Letters 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.
Tree mode key bindings: Tree mode key bindings:
\\{ebrowse-tree-mode-map}" \\{ebrowse-tree-mode-map}"
(interactive)
(let* ((ident (propertized-buffer-identification "C++ Tree")) (let* ((ident (propertized-buffer-identification "C++ Tree"))
header tree buffer-read-only) (inhibit-read-only t)
header tree)
(kill-all-local-variables)
(use-local-map ebrowse-tree-mode-map)
(buffer-disable-undo) (buffer-disable-undo)
(unless (zerop (buffer-size)) (unless (zerop (buffer-size))
@ -1141,38 +1139,27 @@ Tree mode key bindings:
(erase-buffer) (erase-buffer)
(message nil)) (message nil))
(mapc 'make-local-variable (set (make-local-variable 'ebrowse--show-file-names-flag) nil)
'(ebrowse--tags-file-name (set (make-local-variable 'ebrowse--tree-obarray) (make-vector 127 0))
ebrowse--indentation (set (make-local-variable 'ebrowse--frozen-flag) nil)
ebrowse--tree (setq mode-line-buffer-identification ident)
ebrowse--header (setq buffer-read-only t)
ebrowse--show-file-names-flag (setq selective-display t)
ebrowse--frozen-flag (setq selective-display-ellipses t)
ebrowse--tree-obarray (set (make-local-variable 'revert-buffer-function)
revert-buffer-function)) #'ebrowse-revert-tree-buffer-from-file)
(set (make-local-variable 'ebrowse--header) header)
(set (make-local-variable 'ebrowse--tree) tree)
(set (make-local-variable 'ebrowse--tags-file-name) buffer-file-name)
(set (make-local-variable 'ebrowse--tree-obarray)
(and tree (ebrowse-build-tree-obarray tree)))
(set (make-local-variable 'ebrowse--frozen-flag) nil)
(setf ebrowse--show-file-names-flag nil (add-hook 'local-write-file-hooks 'ebrowse-write-file-hook-fn nil t)
ebrowse--tree-obarray (make-vector 127 0)
ebrowse--frozen-flag nil
major-mode 'ebrowse-tree-mode
mode-name "Ebrowse-Tree"
mode-line-buffer-identification ident
buffer-read-only t
selective-display t
selective-display-ellipses t
revert-buffer-function 'ebrowse-revert-tree-buffer-from-file
ebrowse--header header
ebrowse--tree tree
ebrowse--tags-file-name (buffer-file-name)
ebrowse--tree-obarray (and tree (ebrowse-build-tree-obarray tree))
ebrowse--frozen-flag nil)
(add-hook 'local-write-file-hooks 'ebrowse-write-file-hook-fn)
(modify-syntax-entry ?_ (char-to-string (char-syntax ?a))) (modify-syntax-entry ?_ (char-to-string (char-syntax ?a)))
(when tree (when tree
(ebrowse-redraw-tree) (ebrowse-redraw-tree)
(set-buffer-modified-p nil)) (set-buffer-modified-p nil))))
(run-mode-hooks 'ebrowse-tree-mode-hook)))
@ -1340,6 +1327,7 @@ With PREFIX, insert that many filenames."
(defun ebrowse-member-buffer-p (buffer) (defun ebrowse-member-buffer-p (buffer)
"Value is non-nil if BUFFER is a member buffer." "Value is non-nil if BUFFER is a member buffer."
;; FIXME: Why not (buffer-local-value 'major-mode buffer)?
(eq (cdr (assoc 'major-mode (buffer-local-variables buffer))) (eq (cdr (assoc 'major-mode (buffer-local-variables buffer)))
'ebrowse-member-mode)) 'ebrowse-member-mode))
@ -1459,12 +1447,13 @@ Pop to member buffer if no prefix ARG, to tree buffer otherwise."
(defun ebrowse-set-tree-indentation () (defun ebrowse-set-tree-indentation ()
"Set the indentation width of the tree display." "Set the indentation width of the tree display."
(interactive) (interactive)
(let ((width (string-to-number (read-from-minibuffer (let ((width (string-to-number (read-string
(concat "Indentation (" (concat "Indentation (default "
(int-to-string ebrowse--indentation) (int-to-string ebrowse--indentation)
"): "))))) "): ")
nil nil ebrowse--indentation))))
(when (plusp width) (when (plusp width)
(setf ebrowse--indentation width) (set (make-local-variable 'ebrowse--indentation) width)
(ebrowse-redraw-tree)))) (ebrowse-redraw-tree))))
@ -1632,13 +1621,12 @@ The new frame is deleted when you quit viewing the file in that frame."
(had-a-buf (get-file-buffer file)) (had-a-buf (get-file-buffer file))
(buf-to-view (find-file-noselect file))) (buf-to-view (find-file-noselect file)))
(switch-to-buffer-other-frame buf-to-view) (switch-to-buffer-other-frame buf-to-view)
(make-local-variable 'ebrowse--frame-configuration) (set (make-local-variable 'ebrowse--frame-configuration)
(setq ebrowse--frame-configuration old-frame-configuration) old-frame-configuration)
(make-local-variable 'ebrowse--view-exit-action) (set (make-local-variable 'ebrowse--view-exit-action)
(setq ebrowse--view-exit-action (and (not had-a-buf)
(and (not had-a-buf) (not (buffer-modified-p buf-to-view))
(not (buffer-modified-p buf-to-view)) 'kill-buffer))
'kill-buffer))
(view-mode-enter (cons (selected-window) (cons (selected-window) t)) (view-mode-enter (cons (selected-window) (cons (selected-window) t))
'ebrowse-view-exit-fn))) 'ebrowse-view-exit-fn)))
@ -2006,21 +1994,16 @@ COLLAPSE non-nil means collapse the branch."
(put 'ebrowse-electric-list-undefined 'suppress-keymap t) (put 'ebrowse-electric-list-undefined 'suppress-keymap t)
(defun ebrowse-electric-list-mode () (define-derived-mode ebrowse-electric-list-mode
fundamental-mode "Electric Position Menu"
"Mode for electric tree list mode." "Mode for electric tree list mode."
(kill-all-local-variables) (setq mode-line-buffer-identification "Electric Tree Menu")
(use-local-map ebrowse-electric-list-mode-map)
(setq mode-name "Electric Position Menu"
mode-line-buffer-identification "Electric Tree Menu")
(when (memq 'mode-name mode-line-format) (when (memq 'mode-name mode-line-format)
(setq mode-line-format (copy-sequence mode-line-format)) (setq mode-line-format (copy-sequence mode-line-format))
(setcar (memq 'mode-name mode-line-format) "Tree Buffers")) (setcar (memq 'mode-name mode-line-format) "Tree Buffers"))
(make-local-variable 'Helper-return-blurb) (set (make-local-variable 'Helper-return-blurb) "return to buffer editing")
(setq Helper-return-blurb "return to buffer editing" (setq truncate-lines t
truncate-lines t buffer-read-only t))
buffer-read-only t
major-mode 'ebrowse-electric-list-mode)
(run-mode-hooks 'ebrowse-electric-list-mode-hook))
(defun ebrowse-list-tree-buffers () (defun ebrowse-list-tree-buffers ()
@ -2226,13 +2209,8 @@ See 'Electric-command-loop' for a description of STATE and CONDITION."
;;; Member mode ;;; Member mode
;;;###autoload ;;;###autoload
(defun ebrowse-member-mode () (define-derived-mode ebrowse-member-mode special-mode "Ebrowse-Members"
"Major mode for Ebrowse member buffers. "Major mode for Ebrowse member buffers."
\\{ebrowse-member-mode-map}"
(kill-all-local-variables)
(use-local-map ebrowse-member-mode-map)
(setq major-mode 'ebrowse-member-mode)
(mapc 'make-local-variable (mapc 'make-local-variable
'(ebrowse--decl-column ;display column '(ebrowse--decl-column ;display column
ebrowse--n-columns ;number of short columns ebrowse--n-columns ;number of short columns
@ -2255,8 +2233,7 @@ See 'Electric-command-loop' for a description of STATE and CONDITION."
ebrowse--const-display-flag ebrowse--const-display-flag
ebrowse--pure-display-flag ebrowse--pure-display-flag
ebrowse--frozen-flag)) ;buffer not automagically reused ebrowse--frozen-flag)) ;buffer not automagically reused
(setq mode-name "Ebrowse-Members" (setq mode-line-buffer-identification
mode-line-buffer-identification
(propertized-buffer-identification "C++ Members") (propertized-buffer-identification "C++ Members")
buffer-read-only t buffer-read-only t
ebrowse--long-display-flag nil ebrowse--long-display-flag nil
@ -2270,8 +2247,7 @@ See 'Electric-command-loop' for a description of STATE and CONDITION."
ebrowse--inline-display-flag nil ebrowse--inline-display-flag nil
ebrowse--const-display-flag nil ebrowse--const-display-flag nil
ebrowse--pure-display-flag nil) ebrowse--pure-display-flag nil)
(modify-syntax-entry ?_ (char-to-string (char-syntax ?a))) (modify-syntax-entry ?_ (char-to-string (char-syntax ?a))))
(run-mode-hooks 'ebrowse-member-mode-hook))
@ -3967,22 +3943,17 @@ Prefix arg ARG says how much."
(put 'ebrowse-electric-position-undefined 'suppress-keymap t) (put 'ebrowse-electric-position-undefined 'suppress-keymap t)
(defun ebrowse-electric-position-mode () (define-derived-mode ebrowse-electric-position-mode
fundamental-mode "Electric Position Menu"
"Mode for electric position buffers. "Mode for electric position buffers.
Runs the hook `ebrowse-electric-position-mode-hook'." Runs the hook `ebrowse-electric-position-mode-hook'."
(kill-all-local-variables) (setq mode-line-buffer-identification "Electric Position Menu")
(use-local-map ebrowse-electric-position-mode-map)
(setq mode-name "Electric Position Menu"
mode-line-buffer-identification "Electric Position Menu")
(when (memq 'mode-name mode-line-format) (when (memq 'mode-name mode-line-format)
(setq mode-line-format (copy-sequence mode-line-format)) (setq mode-line-format (copy-sequence mode-line-format))
(setcar (memq 'mode-name mode-line-format) "Positions")) (setcar (memq 'mode-name mode-line-format) "Positions"))
(make-local-variable 'Helper-return-blurb) (set (make-local-variable 'Helper-return-blurb) "return to buffer editing")
(setq Helper-return-blurb "return to buffer editing" (setq truncate-lines t
truncate-lines t buffer-read-only t))
buffer-read-only t
major-mode 'ebrowse-electric-position-mode)
(run-mode-hooks 'ebrowse-electric-position-mode-hook))
(defun ebrowse-draw-position-buffer () (defun ebrowse-draw-position-buffer ()

View file

@ -280,7 +280,7 @@ buffer-local and set them to nil."
(defun tags-table-mode () (defun tags-table-mode ()
"Major mode for tags table file buffers." "Major mode for tags table file buffers."
(interactive) (interactive)
(setq major-mode 'tags-table-mode (setq major-mode 'tags-table-mode ;FIXME: Use define-derived-mode.
mode-name "Tags Table" mode-name "Tags Table"
buffer-undo-list t) buffer-undo-list t)
(initialize-new-tags-table)) (initialize-new-tags-table))
@ -2030,10 +2030,8 @@ see the doc of that variable if you want to add names to the list."
(define-key map "q" 'select-tags-table-quit) (define-key map "q" 'select-tags-table-quit)
map)) map))
(define-derived-mode select-tags-table-mode fundamental-mode "Select Tags Table" (define-derived-mode select-tags-table-mode special-mode "Select Tags Table"
"Major mode for choosing a current tags table among those already loaded. "Major mode for choosing a current tags table among those already loaded."
\\{select-tags-table-mode-map}"
(setq buffer-read-only t)) (setq buffer-read-only t))
(defun select-tags-table-select (button) (defun select-tags-table-select (button)

View file

@ -1067,11 +1067,9 @@ Variables controlling indentation style and extra features:
Turning on F90 mode calls the value of the variable `f90-mode-hook' Turning on F90 mode calls the value of the variable `f90-mode-hook'
with no args, if that value is non-nil." with no args, if that value is non-nil."
:group 'f90 :group 'f90
:syntax-table f90-mode-syntax-table
:abbrev-table f90-mode-abbrev-table :abbrev-table f90-mode-abbrev-table
(set (make-local-variable 'indent-line-function) 'f90-indent-line) (set (make-local-variable 'indent-line-function) 'f90-indent-line)
(set (make-local-variable 'indent-region-function) 'f90-indent-region) (set (make-local-variable 'indent-region-function) 'f90-indent-region)
(set (make-local-variable 'require-final-newline) mode-require-final-newline)
(set (make-local-variable 'comment-start) "!") (set (make-local-variable 'comment-start) "!")
(set (make-local-variable 'comment-start-skip) "!+ *") (set (make-local-variable 'comment-start-skip) "!+ *")
(set (make-local-variable 'comment-indent-function) 'f90-comment-indent) (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."
With optional argument ALL, change the default for all present With optional argument ALL, change the default for all present
and future F90 buffers. F90 mode normally treats backslash as an and future F90 buffers. F90 mode normally treats backslash as an
escape character." escape character."
(or (eq major-mode 'f90-mode) (or (derived-mode-p 'f90-mode)
(error "This function should only be used in F90 buffers")) (error "This function should only be used in F90 buffers"))
(when (equal (char-syntax ?\\ ) ?\\ ) (when (equal (char-syntax ?\\ ) ?\\ )
(or all (set-syntax-table (copy-syntax-table (syntax-table)))) (or all (set-syntax-table (copy-syntax-table (syntax-table))))

View file

@ -1016,7 +1016,7 @@ With arg, enter name of variable to be watched in the minibuffer."
'gud-gdb-complete-command) 'gud-gdb-complete-command)
(if (and transient-mark-mode mark-active) (if (and transient-mark-mode mark-active)
(buffer-substring (region-beginning) (region-end)) (buffer-substring (region-beginning) (region-end))
(concat (if (eq major-mode 'gdb-registers-mode) "$") (concat (if (derived-mode-p 'gdb-registers-mode) "$")
(tooltip-identifier-from-point (point))))))) (tooltip-identifier-from-point (point)))))))
(set-text-properties 0 (length expr) nil expr) (set-text-properties 0 (length expr) nil expr)
(gdb-input (gdb-input
@ -1483,14 +1483,9 @@ DOC is an optional documentation string."
;; We want to use comint because it has various nifty and familiar features. ;; We want to use comint because it has various nifty and familiar features.
(define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O" (define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O"
"Major mode for gdb inferior-io. "Major mode for gdb inferior-io."
The following commands are available:
\\{gdb-inferior-io-mode-map}"
:syntax-table nil :abbrev-table nil :syntax-table nil :abbrev-table nil
(make-comint-in-buffer "gdb-inferior" (current-buffer) nil))
(make-comint-in-buffer "gdb-inferior" (current-buffer) nil))
(defun gdb-inferior-filter (proc string) (defun gdb-inferior-filter (proc string)
(unless (string-equal string "") (unless (string-equal string "")
@ -2443,7 +2438,7 @@ If not in a source or disassembly buffer just set point."
(mouse-minibuffer-check event) (mouse-minibuffer-check event)
(let ((posn (event-end event))) (let ((posn (event-end event)))
(with-selected-window (posn-window posn) (with-selected-window (posn-window posn)
(if (or (buffer-file-name) (eq major-mode 'gdb-disassembly-mode)) (if (or (buffer-file-name) (derived-mode-p 'gdb-disassembly-mode))
(if (numberp (posn-point posn)) (if (numberp (posn-point posn))
(save-excursion (save-excursion
(goto-char (posn-point posn)) (goto-char (posn-point posn))
@ -2627,15 +2622,12 @@ corresponding to the mode line clicked."
nil nil mode-line))) nil nil mode-line)))
(define-derived-mode gdb-threads-mode gdb-parent-mode "Threads" (define-derived-mode gdb-threads-mode gdb-parent-mode "Threads"
"Major mode for GDB threads. "Major mode for GDB threads."
\\{gdb-threads-mode-map}"
(setq gdb-thread-position (make-marker)) (setq gdb-thread-position (make-marker))
(add-to-list 'overlay-arrow-variable-list 'gdb-thread-position) (add-to-list 'overlay-arrow-variable-list 'gdb-thread-position)
(setq header-line-format gdb-threads-header) (setq header-line-format gdb-threads-header)
(set (make-local-variable 'font-lock-defaults) (set (make-local-variable 'font-lock-defaults)
'(gdb-threads-font-lock-keywords)) '(gdb-threads-font-lock-keywords))
(run-mode-hooks 'gdb-threads-mode-hook)
'gdb-invalidate-threads) 'gdb-invalidate-threads)
(defun gdb-thread-list-handler-custom () (defun gdb-thread-list-handler-custom ()
@ -3161,13 +3153,10 @@ DOC is an optional documentation string."
"Header line used in `gdb-memory-mode'.") "Header line used in `gdb-memory-mode'.")
(define-derived-mode gdb-memory-mode gdb-parent-mode "Memory" (define-derived-mode gdb-memory-mode gdb-parent-mode "Memory"
"Major mode for examining memory. "Major mode for examining memory."
\\{gdb-memory-mode-map}"
(setq header-line-format gdb-memory-header) (setq header-line-format gdb-memory-header)
(set (make-local-variable 'font-lock-defaults) (set (make-local-variable 'font-lock-defaults)
'(gdb-memory-font-lock-keywords)) '(gdb-memory-font-lock-keywords))
(run-mode-hooks 'gdb-memory-mode-hook)
'gdb-invalidate-memory) 'gdb-invalidate-memory)
(defun gdb-memory-buffer-name () (defun gdb-memory-buffer-name ()
@ -3256,16 +3245,13 @@ DOC is an optional documentation string."
map)) map))
(define-derived-mode gdb-disassembly-mode gdb-parent-mode "Disassembly" (define-derived-mode gdb-disassembly-mode gdb-parent-mode "Disassembly"
"Major mode for GDB disassembly information. "Major mode for GDB disassembly information."
\\{gdb-disassembly-mode-map}"
;; TODO Rename overlay variable for disassembly mode ;; TODO Rename overlay variable for disassembly mode
(add-to-list 'overlay-arrow-variable-list 'gdb-disassembly-position) (add-to-list 'overlay-arrow-variable-list 'gdb-disassembly-position)
(setq fringes-outside-margins t) (setq fringes-outside-margins t)
(set (make-local-variable 'gdb-disassembly-position) (make-marker)) (set (make-local-variable 'gdb-disassembly-position) (make-marker))
(set (make-local-variable 'font-lock-defaults) (set (make-local-variable 'font-lock-defaults)
'(gdb-disassembly-font-lock-keywords)) '(gdb-disassembly-font-lock-keywords))
(run-mode-hooks 'gdb-disassembly-mode-hook)
'gdb-invalidate-disassembly) 'gdb-invalidate-disassembly)
(defun gdb-disassembly-handler-custom () (defun gdb-disassembly-handler-custom ()
@ -3323,11 +3309,8 @@ DOC is an optional documentation string."
;;; Breakpoints view ;;; Breakpoints view
(define-derived-mode gdb-breakpoints-mode gdb-parent-mode "Breakpoints" (define-derived-mode gdb-breakpoints-mode gdb-parent-mode "Breakpoints"
"Major mode for gdb breakpoints. "Major mode for gdb breakpoints."
\\{gdb-breakpoints-mode-map}"
(setq header-line-format gdb-breakpoints-header) (setq header-line-format gdb-breakpoints-header)
(run-mode-hooks 'gdb-breakpoints-mode-hook)
'gdb-invalidate-breakpoints) 'gdb-invalidate-breakpoints)
(defun gdb-toggle-breakpoint () (defun gdb-toggle-breakpoint ()
@ -3466,15 +3449,12 @@ member."
"Font lock keywords used in `gdb-frames-mode'.") "Font lock keywords used in `gdb-frames-mode'.")
(define-derived-mode gdb-frames-mode gdb-parent-mode "Frames" (define-derived-mode gdb-frames-mode gdb-parent-mode "Frames"
"Major mode for gdb call stack. "Major mode for gdb call stack."
\\{gdb-frames-mode-map}"
(setq gdb-stack-position (make-marker)) (setq gdb-stack-position (make-marker))
(add-to-list 'overlay-arrow-variable-list 'gdb-stack-position) (add-to-list 'overlay-arrow-variable-list 'gdb-stack-position)
(setq truncate-lines t) ;; Make it easier to see overlay arrow. (setq truncate-lines t) ;; Make it easier to see overlay arrow.
(set (make-local-variable 'font-lock-defaults) (set (make-local-variable 'font-lock-defaults)
'(gdb-frames-font-lock-keywords)) '(gdb-frames-font-lock-keywords))
(run-mode-hooks 'gdb-frames-mode-hook)
'gdb-invalidate-frames) 'gdb-invalidate-frames)
(defun gdb-select-frame (&optional event) (defun gdb-select-frame (&optional event)
@ -3588,11 +3568,8 @@ member."
map)) map))
(define-derived-mode gdb-locals-mode gdb-parent-mode "Locals" (define-derived-mode gdb-locals-mode gdb-parent-mode "Locals"
"Major mode for gdb locals. "Major mode for gdb locals."
\\{gdb-locals-mode-map}"
(setq header-line-format gdb-locals-header) (setq header-line-format gdb-locals-header)
(run-mode-hooks 'gdb-locals-mode-hook)
'gdb-invalidate-locals) 'gdb-invalidate-locals)
(defun gdb-locals-buffer-name () (defun gdb-locals-buffer-name ()
@ -3687,11 +3664,8 @@ member."
nil nil mode-line))) nil nil mode-line)))
(define-derived-mode gdb-registers-mode gdb-parent-mode "Registers" (define-derived-mode gdb-registers-mode gdb-parent-mode "Registers"
"Major mode for gdb registers. "Major mode for gdb registers."
\\{gdb-registers-mode-map}"
(setq header-line-format gdb-registers-header) (setq header-line-format gdb-registers-header)
(run-mode-hooks 'gdb-registers-mode-hook)
'gdb-invalidate-registers) 'gdb-invalidate-registers)
(defun gdb-registers-buffer-name () (defun gdb-registers-buffer-name ()

View file

@ -2533,7 +2533,7 @@ comint mode, which see."
(gud-set-buffer)) (gud-set-buffer))
(defun gud-set-buffer () (defun gud-set-buffer ()
(when (eq major-mode 'gud-mode) (when (derived-mode-p 'gud-mode)
(setq gud-comint-buffer (current-buffer)))) (setq gud-comint-buffer (current-buffer))))
(defvar gud-filter-defer-flag nil (defvar gud-filter-defer-flag nil
@ -3344,10 +3344,8 @@ only tooltips in the buffer containing the overlay arrow."
ACTIVATEP non-nil means activate mouse motion events." ACTIVATEP non-nil means activate mouse motion events."
(if activatep (if activatep
(progn (progn
(make-local-variable 'gud-tooltip-mouse-motions-active) (set (make-local-variable 'gud-tooltip-mouse-motions-active) t)
(setq gud-tooltip-mouse-motions-active t) (set (make-local-variable 'track-mouse) t))
(make-local-variable 'track-mouse)
(setq track-mouse t))
(when gud-tooltip-mouse-motions-active (when gud-tooltip-mouse-motions-active
(kill-local-variable 'gud-tooltip-mouse-motions-active) (kill-local-variable 'gud-tooltip-mouse-motions-active)
(kill-local-variable 'track-mouse)))) (kill-local-variable 'track-mouse))))

View file

@ -131,7 +131,7 @@ when the TAB command is used."
;;;###autoload ;;;###autoload
(defun icon-mode () (define-derived-mode icon-mode prog-mode "Icon"
"Major mode for editing Icon code. "Major mode for editing Icon code.
Expression and list commands understand all Icon brackets. Expression and list commands understand all Icon brackets.
Tab indents for Icon code. Tab indents for Icon code.
@ -163,49 +163,33 @@ Variables controlling indentation style:
Turning on Icon mode calls the value of the variable `icon-mode-hook' Turning on Icon mode calls the value of the variable `icon-mode-hook'
with no args, if that value is non-nil." with no args, if that value is non-nil."
(interactive) :abbrev-table icon-mode-abbrev-table
(kill-all-local-variables) (set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter))
(use-local-map icon-mode-map) (set (make-local-variable 'paragraph-separate) paragraph-start)
(setq major-mode 'icon-mode) (set (make-local-variable 'indent-line-function) #'icon-indent-line)
(setq mode-name "Icon") (set (make-local-variable 'comment-start) "# ")
(setq local-abbrev-table icon-mode-abbrev-table) (set (make-local-variable 'comment-end) "")
(set-syntax-table icon-mode-syntax-table) (set (make-local-variable 'comment-start-skip) "# *")
(make-local-variable 'paragraph-start) (set (make-local-variable 'comment-indent-function) 'icon-comment-indent)
(setq paragraph-start (concat "$\\|" page-delimiter))
(make-local-variable 'paragraph-separate)
(setq paragraph-separate paragraph-start)
(make-local-variable 'indent-line-function)
(setq indent-line-function 'icon-indent-line)
(make-local-variable 'require-final-newline)
(setq require-final-newline mode-require-final-newline)
(make-local-variable 'comment-start)
(setq comment-start "# ")
(make-local-variable 'comment-end)
(setq comment-end "")
(make-local-variable 'comment-start-skip)
(setq comment-start-skip "# *")
(make-local-variable 'comment-indent-function)
(setq comment-indent-function 'icon-comment-indent)
(set (make-local-variable 'indent-line-function) 'icon-indent-line) (set (make-local-variable 'indent-line-function) 'icon-indent-line)
;; font-lock support ;; font-lock support
(setq font-lock-defaults (set (make-local-variable 'font-lock-defaults)
'((icon-font-lock-keywords '((icon-font-lock-keywords
icon-font-lock-keywords-1 icon-font-lock-keywords-2) icon-font-lock-keywords-1 icon-font-lock-keywords-2)
nil nil ((?_ . "w")) beginning-of-defun nil nil ((?_ . "w")) beginning-of-defun
;; Obsoleted by Emacs 19.35 parse-partial-sexp's COMMENTSTOP. ;; Obsoleted by Emacs 19.35 parse-partial-sexp's COMMENTSTOP.
;(font-lock-comment-start-regexp . "#") ;;(font-lock-comment-start-regexp . "#")
(font-lock-mark-block-function . mark-defun))) (font-lock-mark-block-function . mark-defun)))
;; imenu support ;; imenu support
(make-local-variable 'imenu-generic-expression) (set (make-local-variable 'imenu-generic-expression)
(setq imenu-generic-expression icon-imenu-generic-expression) icon-imenu-generic-expression)
;; hideshow support ;; hideshow support
;; we start from the assertion that `hs-special-modes-alist' is autoloaded. ;; we start from the assertion that `hs-special-modes-alist' is autoloaded.
(unless (assq 'icon-mode hs-special-modes-alist) (unless (assq 'icon-mode hs-special-modes-alist)
(setq hs-special-modes-alist (setq hs-special-modes-alist
(cons '(icon-mode "\\<procedure\\>" "\\<end\\>" nil (cons '(icon-mode "\\<procedure\\>" "\\<end\\>" nil
icon-forward-sexp-function) icon-forward-sexp-function)
hs-special-modes-alist))) hs-special-modes-alist))))
(run-mode-hooks 'icon-mode-hook))
;; This is used by indent-for-comment to decide how much to ;; This is used by indent-for-comment to decide how much to
;; indent a comment in Icon code based on its context. ;; indent a comment in Icon code based on its context.

View file

@ -167,7 +167,7 @@ an up-to-date completion list."
(defun idlwave-prepare-structure-tag-completion (var) (defun idlwave-prepare-structure-tag-completion (var)
"Find and parse the tag list for structure tag completion." "Find and parse the tag list for structure tag completion."
;; This works differently in source buffers and in the shell ;; This works differently in source buffers and in the shell
(if (eq major-mode 'idlwave-shell-mode) (if (derived-mode-p 'idlwave-shell-mode)
;; OK, we are in the shell, do it dynamically ;; OK, we are in the shell, do it dynamically
(progn (progn
(message "preparing shell tags") (message "preparing shell tags")

View file

@ -288,7 +288,7 @@ support."
(declare-function idlwave-what-module-find-class "idlwave") (declare-function idlwave-what-module-find-class "idlwave")
(declare-function idlwave-where "idlwave") (declare-function idlwave-where "idlwave")
(defun idlwave-help-mode () (define-derived-mode idlwave-help-mode special-mode "IDLWAVE Help"
"Major mode for displaying IDL Help. "Major mode for displaying IDL Help.
This is a VIEW mode for the ASCII version of IDL Help files, This is a VIEW mode for the ASCII version of IDL Help files,
@ -308,11 +308,7 @@ Jump: [h] to function doclib header
Here are all keybindings. Here are all keybindings.
\\{idlwave-help-mode-map}" \\{idlwave-help-mode-map}"
(kill-all-local-variables)
(buffer-disable-undo) (buffer-disable-undo)
(setq major-mode 'idlwave-help-mode
mode-name "IDLWAVE Help")
(use-local-map idlwave-help-mode-map)
(easy-menu-add idlwave-help-menu idlwave-help-mode-map) (easy-menu-add idlwave-help-menu idlwave-help-mode-map)
(setq truncate-lines t) (setq truncate-lines t)
(setq case-fold-search t) (setq case-fold-search t)
@ -325,8 +321,7 @@ Here are all keybindings.
(setq buffer-read-only t) (setq buffer-read-only t)
(set (make-local-variable 'idlwave-help-def-pos) nil) (set (make-local-variable 'idlwave-help-def-pos) nil)
(set (make-local-variable 'idlwave-help-args) nil) (set (make-local-variable 'idlwave-help-args) nil)
(set (make-local-variable 'idlwave-help-in-header) nil) (set (make-local-variable 'idlwave-help-in-header) nil))
(run-hooks 'idlwave-help-mode-hook))
(defun idlwave-html-help-location () (defun idlwave-html-help-location ()
"Return the help directory where HTML files are, or nil if that is unknown." "Return the help directory where HTML files are, or nil if that is unknown."

View file

@ -866,7 +866,7 @@ IDL has currently stepped.")
(defvar idlwave-shell-only-prompt-pattern nil) (defvar idlwave-shell-only-prompt-pattern nil)
(defvar tool-bar-map) (defvar tool-bar-map)
(defun idlwave-shell-mode () (define-derived-mode idlwave-shell-mode comint-mode "IDL-Shell"
"Major mode for interacting with an inferior IDL process. "Major mode for interacting with an inferior IDL process.
1. Shell Interaction 1. Shell Interaction
@ -947,28 +947,23 @@ IDL has currently stepped.")
8. Keybindings 8. Keybindings
----------- -----------
\\{idlwave-shell-mode-map}" \\{idlwave-shell-mode-map}"
:abbrev-table idlwave-mode-abbrev-table
(interactive)
(idlwave-setup) ; Make sure config files and paths, etc. are available. (idlwave-setup) ; Make sure config files and paths, etc. are available.
(unless (file-name-absolute-p idlwave-shell-command-history-file) (unless (file-name-absolute-p idlwave-shell-command-history-file)
(setq idlwave-shell-command-history-file (setq idlwave-shell-command-history-file
(expand-file-name idlwave-shell-command-history-file (expand-file-name idlwave-shell-command-history-file
idlwave-config-directory))) idlwave-config-directory)))
;; We don't do `kill-all-local-variables' here, because this is done by
;; comint
(setq comint-prompt-regexp idlwave-shell-prompt-pattern) (setq comint-prompt-regexp idlwave-shell-prompt-pattern)
(setq comint-process-echoes t) (setq comint-process-echoes t)
;; Can not use history expansion because "!" is used for system variables. ;; Can not use history expansion because "!" is used for system variables.
(setq comint-input-autoexpand nil) (setq comint-input-autoexpand nil)
; (setq comint-input-ring-size 64) ;; (setq comint-input-ring-size 64)
(make-local-variable 'comint-completion-addsuffix)
(set (make-local-variable 'completion-ignore-case) t) (set (make-local-variable 'completion-ignore-case) t)
(setq comint-completion-addsuffix '("/" . "")) (set (make-local-variable 'comint-completion-addsuffix) '("/" . ""))
(setq comint-input-ignoredups t) (setq comint-input-ignoredups t)
(setq major-mode 'idlwave-shell-mode)
(setq mode-name "IDL-Shell")
(setq idlwave-shell-mode-line-info nil) (setq idlwave-shell-mode-line-info nil)
(setq mode-line-format (setq mode-line-format
'("" '(""
@ -1023,7 +1018,6 @@ IDL has currently stepped.")
nil 'local) nil 'local)
(add-hook 'kill-buffer-hook 'idlwave-shell-delete-temp-files nil 'local) (add-hook 'kill-buffer-hook 'idlwave-shell-delete-temp-files nil 'local)
(add-hook 'kill-emacs-hook 'idlwave-shell-delete-temp-files) (add-hook 'kill-emacs-hook 'idlwave-shell-delete-temp-files)
(use-local-map idlwave-shell-mode-map)
(easy-menu-add idlwave-shell-mode-menu idlwave-shell-mode-map) (easy-menu-add idlwave-shell-mode-menu idlwave-shell-mode-map)
;; Set the optional comint variables ;; Set the optional comint variables
@ -1054,10 +1048,7 @@ IDL has currently stepped.")
;; with overlay-arrows. ;; with overlay-arrows.
(remove-hook 'comint-output-filter-functions 'py-pdbtrack-track-stack-file) (remove-hook 'comint-output-filter-functions 'py-pdbtrack-track-stack-file)
;; IDLWAVE syntax, and turn on abbreviations ;; IDLWAVE syntax, and turn on abbreviations
(setq local-abbrev-table idlwave-mode-abbrev-table)
(set-syntax-table idlwave-mode-syntax-table)
(set (make-local-variable 'comment-start) ";") (set (make-local-variable 'comment-start) ";")
(setq abbrev-mode t) (setq abbrev-mode t)
@ -1076,8 +1067,6 @@ IDL has currently stepped.")
;; Turn off the non-debug toolbar buttons (open,save,etc.) ;; Turn off the non-debug toolbar buttons (open,save,etc.)
(set (make-local-variable 'tool-bar-map) nil) (set (make-local-variable 'tool-bar-map) nil)
;; Run the hooks.
(run-mode-hooks 'idlwave-shell-mode-hook)
(idlwave-shell-send-command idlwave-shell-initial-commands nil 'hide) (idlwave-shell-send-command idlwave-shell-initial-commands nil 'hide)
;; Turn off IDL's ^d interpreting, and define a system ;; Turn off IDL's ^d interpreting, and define a system
;; variable which knows the version of IDLWAVE ;; variable which knows the version of IDLWAVE
@ -3895,7 +3884,7 @@ handled by this command."
(setq overlay-arrow-string nil) (setq overlay-arrow-string nil)
(let (buf) (let (buf)
(cond (cond
((eq major-mode 'idlwave-mode) ((derived-mode-p 'idlwave-mode)
(save-buffer) (save-buffer)
(setq idlwave-shell-last-save-and-action-file (buffer-file-name))) (setq idlwave-shell-last-save-and-action-file (buffer-file-name)))
(idlwave-shell-last-save-and-action-file (idlwave-shell-last-save-and-action-file
@ -4083,7 +4072,7 @@ of the form:
(defun idlwave-shell-file-name (name) (defun idlwave-shell-file-name (name)
"If `idlwave-shell-use-truename' is non-nil, convert file name to true name. "If `idlwave-shell-use-truename' is non-nil, convert file name to true name.
Otherwise, just expand the file name." Otherwise, just expand the file name."
(let ((def-dir (if (eq major-mode 'idlwave-shell-mode) (let ((def-dir (if (derived-mode-p 'idlwave-shell-mode)
default-directory default-directory
idlwave-shell-default-directory))) idlwave-shell-default-directory)))
(if idlwave-shell-use-truename (if idlwave-shell-use-truename
@ -4346,7 +4335,7 @@ idlwave-shell-electric-debug-mode-map)
(while (setq buf (pop buffers)) (while (setq buf (pop buffers))
(when (buffer-live-p buf) (when (buffer-live-p buf)
(set-buffer buf) (set-buffer buf)
(when (and (eq major-mode 'idlwave-mode) (when (and (derived-mode-p 'idlwave-mode)
buffer-file-name buffer-file-name
idlwave-shell-electric-debug-mode) idlwave-shell-electric-debug-mode)
(idlwave-shell-electric-debug-mode 0)))))) (idlwave-shell-electric-debug-mode 0))))))
@ -4371,51 +4360,51 @@ idlwave-shell-electric-debug-mode-map)
["Electric Debug Mode" ["Electric Debug Mode"
idlwave-shell-electric-debug-mode idlwave-shell-electric-debug-mode
:style toggle :selected idlwave-shell-electric-debug-mode :style toggle :selected idlwave-shell-electric-debug-mode
:included (eq major-mode 'idlwave-mode) :keys "C-c C-d C-v"] :included (derived-mode-p 'idlwave-mode) :keys "C-c C-d C-v"]
"--" "--"
("Compile & Run" ("Compile & Run"
["Save and .RUN" idlwave-shell-save-and-run ["Save and .RUN" idlwave-shell-save-and-run
(or (eq major-mode 'idlwave-mode) (or (derived-mode-p 'idlwave-mode)
idlwave-shell-last-save-and-action-file)] idlwave-shell-last-save-and-action-file)]
["Save and .COMPILE" idlwave-shell-save-and-compile ["Save and .COMPILE" idlwave-shell-save-and-compile
(or (eq major-mode 'idlwave-mode) (or (derived-mode-p 'idlwave-mode)
idlwave-shell-last-save-and-action-file)] idlwave-shell-last-save-and-action-file)]
["Save and @Batch" idlwave-shell-save-and-batch ["Save and @Batch" idlwave-shell-save-and-batch
(or (eq major-mode 'idlwave-mode) (or (derived-mode-p 'idlwave-mode)
idlwave-shell-last-save-and-action-file)] idlwave-shell-last-save-and-action-file)]
"--" "--"
["Goto Next Error" idlwave-shell-goto-next-error t] ["Goto Next Error" idlwave-shell-goto-next-error t]
"--" "--"
["Compile and Run Region" idlwave-shell-run-region ["Compile and Run Region" idlwave-shell-run-region
(eq major-mode 'idlwave-mode)] (derived-mode-p 'idlwave-mode)]
["Evaluate Region" idlwave-shell-evaluate-region ["Evaluate Region" idlwave-shell-evaluate-region
(eq major-mode 'idlwave-mode)] (derived-mode-p 'idlwave-mode)]
"--" "--"
["Execute Default Cmd" idlwave-shell-execute-default-command-line t] ["Execute Default Cmd" idlwave-shell-execute-default-command-line t]
["Edit Default Cmd" idlwave-shell-edit-default-command-line t]) ["Edit Default Cmd" idlwave-shell-edit-default-command-line t])
("Breakpoints" ("Breakpoints"
["Set Breakpoint" idlwave-shell-break-here ["Set Breakpoint" idlwave-shell-break-here
:keys "C-c C-d C-b" :active (eq major-mode 'idlwave-mode)] :keys "C-c C-d C-b" :active (derived-mode-p 'idlwave-mode)]
("Set Special Breakpoint" ("Set Special Breakpoint"
["Set After Count Breakpoint" ["Set After Count Breakpoint"
(progn (progn
(let ((count (string-to-number (read-string "Break after count: ")))) (let ((count (string-to-number (read-string "Break after count: "))))
(if (integerp count) (idlwave-shell-break-here count)))) (if (integerp count) (idlwave-shell-break-here count))))
:active (eq major-mode 'idlwave-mode)] :active (derived-mode-p 'idlwave-mode)]
["Set Condition Breakpoint" ["Set Condition Breakpoint"
(idlwave-shell-break-here '(4)) (idlwave-shell-break-here '(4))
:active (eq major-mode 'idlwave-mode)]) :active (derived-mode-p 'idlwave-mode)])
["Break in Module" idlwave-shell-break-in ["Break in Module" idlwave-shell-break-in
:keys "C-c C-d C-i" :active (eq major-mode 'idlwave-mode)] :keys "C-c C-d C-i" :active (derived-mode-p 'idlwave-mode)]
["Break in this Module" idlwave-shell-break-this-module ["Break in this Module" idlwave-shell-break-this-module
:keys "C-c C-d C-j" :active (eq major-mode 'idlwave-mode)] :keys "C-c C-d C-j" :active (derived-mode-p 'idlwave-mode)]
["Clear Breakpoint" idlwave-shell-clear-current-bp t] ["Clear Breakpoint" idlwave-shell-clear-current-bp t]
["Clear All Breakpoints" idlwave-shell-clear-all-bp t] ["Clear All Breakpoints" idlwave-shell-clear-all-bp t]
["Disable/Enable Breakpoint" idlwave-shell-toggle-enable-current-bp t] ["Disable/Enable Breakpoint" idlwave-shell-toggle-enable-current-bp t]
["Goto Previous Breakpoint" idlwave-shell-goto-previous-bp ["Goto Previous Breakpoint" idlwave-shell-goto-previous-bp
:keys "C-c C-d [" :active (eq major-mode 'idlwave-mode)] :keys "C-c C-d [" :active (derived-mode-p 'idlwave-mode)]
["Goto Next Breakpoint" idlwave-shell-goto-next-bp ["Goto Next Breakpoint" idlwave-shell-goto-next-bp
:keys "C-c C-d ]" :active (eq major-mode 'idlwave-mode)] :keys "C-c C-d ]" :active (derived-mode-p 'idlwave-mode)]
["List All Breakpoints" idlwave-shell-list-all-bp t] ["List All Breakpoints" idlwave-shell-list-all-bp t]
["Resync Breakpoints" idlwave-shell-bp-query t]) ["Resync Breakpoints" idlwave-shell-bp-query t])
("Continue/Step" ("Continue/Step"
@ -4427,7 +4416,7 @@ idlwave-shell-electric-debug-mode-map)
["... to End of Subprog" idlwave-shell-return t] ["... to End of Subprog" idlwave-shell-return t]
["... to End of Subprog+1" idlwave-shell-out t] ["... to End of Subprog+1" idlwave-shell-out t]
["... to Here (Cursor Line)" idlwave-shell-to-here ["... to Here (Cursor Line)" idlwave-shell-to-here
:keys "C-c C-d C-h" :active (eq major-mode 'idlwave-mode)]) :keys "C-c C-d C-h" :active (derived-mode-p 'idlwave-mode)])
("Examine Expressions" ("Examine Expressions"
["Print expression" idlwave-shell-print t] ["Print expression" idlwave-shell-print t]
["Help on expression" idlwave-shell-help-expression t] ["Help on expression" idlwave-shell-help-expression t]
@ -4512,7 +4501,7 @@ idlwave-shell-electric-debug-mode-map)
(save-current-buffer (save-current-buffer
(dolist (buf (buffer-list)) (dolist (buf (buffer-list))
(set-buffer buf) (set-buffer buf)
(if (eq major-mode 'idlwave-mode) (if (derived-mode-p 'idlwave-mode)
(progn (progn
(easy-menu-remove idlwave-mode-debug-menu) (easy-menu-remove idlwave-mode-debug-menu)
(easy-menu-add idlwave-mode-debug-menu))))))) (easy-menu-add idlwave-mode-debug-menu)))))))

View file

@ -807,7 +807,7 @@ static char * file[] = {
"Goto Next Error"] "Goto Next Error"]
[idlwave-toolbar-stop-at-icon [idlwave-toolbar-stop-at-icon
idlwave-shell-break-here idlwave-shell-break-here
(eq major-mode 'idlwave-mode) (derived-mode-p 'idlwave-mode)
"Set Breakpoint at selected position"] "Set Breakpoint at selected position"]
[idlwave-toolbar-clear-at-icon [idlwave-toolbar-clear-at-icon
idlwave-shell-clear-current-bp idlwave-shell-clear-current-bp
@ -819,7 +819,7 @@ static char * file[] = {
"Clear all Breakpoints"] "Clear all Breakpoints"]
[idlwave-toolbar-stop-beginning-icon [idlwave-toolbar-stop-beginning-icon
idlwave-shell-break-this-module idlwave-shell-break-this-module
(eq major-mode 'idlwave-mode) (derived-mode-p 'idlwave-mode)
"Stop at beginning of enclosing Routine"] "Stop at beginning of enclosing Routine"]
[idlwave-toolbar-stop-in-icon [idlwave-toolbar-stop-in-icon
idlwave-shell-break-in idlwave-shell-break-in
@ -839,7 +839,7 @@ static char * file[] = {
"Continue Current Program"] "Continue Current Program"]
[idlwave-toolbar-to-here-icon [idlwave-toolbar-to-here-icon
idlwave-shell-to-here idlwave-shell-to-here
(eq major-mode 'idlwave-mode) (derived-mode-p 'idlwave-mode)
"Continue to Here (cursor position)"] "Continue to Here (cursor position)"]
[idlwave-toolbar-step-over-icon [idlwave-toolbar-step-over-icon
idlwave-shell-stepover idlwave-shell-stepover
@ -871,7 +871,7 @@ static char * file[] = {
"Reset IDL (RETALL & CLOSE,/ALL and more)"] "Reset IDL (RETALL & CLOSE,/ALL and more)"]
[idlwave-toolbar-electric-debug-icon [idlwave-toolbar-electric-debug-icon
idlwave-shell-electric-debug-mode idlwave-shell-electric-debug-mode
(eq major-mode 'idlwave-mode) (derived-mode-p 'idlwave-mode)
"Toggle Electric Debug Mode"] "Toggle Electric Debug Mode"]
)) ))
@ -884,8 +884,7 @@ static char * file[] = {
"Add the IDLWAVE toolbar if appropriate." "Add the IDLWAVE toolbar if appropriate."
(if (and (featurep 'xemacs) ; This is a noop on Emacs (if (and (featurep 'xemacs) ; This is a noop on Emacs
(boundp 'idlwave-toolbar-is-possible) (boundp 'idlwave-toolbar-is-possible)
(or (eq major-mode 'idlwave-mode) (derived-mode-p 'idlwave-mode 'idlwave-shell-mode))
(eq major-mode 'idlwave-shell-mode)))
(set-specifier default-toolbar (cons (current-buffer) (set-specifier default-toolbar (cons (current-buffer)
idlwave-toolbar)))) idlwave-toolbar))))
@ -893,8 +892,7 @@ static char * file[] = {
"Add the IDLWAVE toolbar if appropriate." "Add the IDLWAVE toolbar if appropriate."
(if (and (featurep 'xemacs) ; This is a noop on Emacs (if (and (featurep 'xemacs) ; This is a noop on Emacs
(boundp 'idlwave-toolbar-is-possible) (boundp 'idlwave-toolbar-is-possible)
(or (eq major-mode 'idlwave-mode) (derived-mode-p 'idlwave-mode 'idlwave-shell-mode))
(eq major-mode 'idlwave-shell-mode)))
(remove-specifier default-toolbar (current-buffer)))) (remove-specifier default-toolbar (current-buffer))))
(defvar idlwave-shell-mode-map) (defvar idlwave-shell-mode-map)

View file

@ -1776,7 +1776,7 @@ If NOPREFIX is non-nil, don't prepend prefix character. Installs into
(defvar idlwave-mode-debug-menu) (defvar idlwave-mode-debug-menu)
;;;###autoload ;;;###autoload
(defun idlwave-mode () (define-derived-mode idlwave-mode prog-mode "IDLWAVE"
"Major mode for editing IDL source files (version 6.1_em22). "Major mode for editing IDL source files (version 6.1_em22).
The main features of this mode are The main features of this mode are
@ -1895,21 +1895,15 @@ The main features of this mode are
followed by the key sequence to see what the key sequence does. followed by the key sequence to see what the key sequence does.
\\{idlwave-mode-map}" \\{idlwave-mode-map}"
:abbrev-table idlwave-mode-abbrev-table
(interactive)
(kill-all-local-variables)
(if idlwave-startup-message (if idlwave-startup-message
(message "Emacs IDLWAVE mode version %s." idlwave-mode-version)) (message "Emacs IDLWAVE mode version %s." idlwave-mode-version))
(setq idlwave-startup-message nil) (setq idlwave-startup-message nil)
(setq local-abbrev-table idlwave-mode-abbrev-table)
(set-syntax-table idlwave-mode-syntax-table)
(set (make-local-variable 'indent-line-function) 'idlwave-indent-and-action) (set (make-local-variable 'indent-line-function) 'idlwave-indent-and-action)
(make-local-variable idlwave-comment-indent-function) (set (make-local-variable idlwave-comment-indent-function)
(set idlwave-comment-indent-function 'idlwave-comment-hook) #'idlwave-comment-hook)
(set (make-local-variable 'comment-start-skip) ";+[ \t]*") (set (make-local-variable 'comment-start-skip) ";+[ \t]*")
(set (make-local-variable 'comment-start) ";") (set (make-local-variable 'comment-start) ";")
@ -1919,14 +1913,10 @@ The main features of this mode are
(set (make-local-variable 'indent-tabs-mode) nil) (set (make-local-variable 'indent-tabs-mode) nil)
(set (make-local-variable 'completion-ignore-case) t) (set (make-local-variable 'completion-ignore-case) t)
(use-local-map idlwave-mode-map)
(when (featurep 'easymenu) (when (featurep 'easymenu)
(easy-menu-add idlwave-mode-menu idlwave-mode-map) (easy-menu-add idlwave-mode-menu idlwave-mode-map)
(easy-menu-add idlwave-mode-debug-menu idlwave-mode-map)) (easy-menu-add idlwave-mode-debug-menu idlwave-mode-map))
(setq mode-name "IDLWAVE")
(setq major-mode 'idlwave-mode)
(setq abbrev-mode t) (setq abbrev-mode t)
(set (make-local-variable idlwave-fill-function) 'idlwave-auto-fill) (set (make-local-variable idlwave-fill-function) 'idlwave-auto-fill)
@ -1991,10 +1981,7 @@ The main features of this mode are
(idlwave-new-buffer-update) (idlwave-new-buffer-update)
;; Check help location ;; Check help location
(idlwave-help-check-locations) (idlwave-help-check-locations))
;; Run the mode hook
(run-mode-hooks 'idlwave-mode-hook))
(defvar idlwave-setup-done nil) (defvar idlwave-setup-done nil)
(defun idlwave-setup () (defun idlwave-setup ()
@ -2543,7 +2530,7 @@ Point is placed at the beginning of the line whether or not this is an
actual statement." actual statement."
(interactive) (interactive)
(cond (cond
((eq major-mode 'idlwave-shell-mode) ((derived-mode-p 'idlwave-shell-mode)
(if (re-search-backward idlwave-shell-prompt-pattern nil t) (if (re-search-backward idlwave-shell-prompt-pattern nil t)
(goto-char (match-end 0)))) (goto-char (match-end 0))))
(t (t
@ -3732,7 +3719,7 @@ expression to enter.
The lines containing S1 and S2 are reindented using `indent-region' The lines containing S1 and S2 are reindented using `indent-region'
unless the optional second argument NOINDENT is non-nil." unless the optional second argument NOINDENT is non-nil."
(if (eq major-mode 'idlwave-shell-mode) (if (derived-mode-p 'idlwave-shell-mode)
;; This is a gross hack to avoit template abbrev expansion ;; This is a gross hack to avoit template abbrev expansion
;; in the shell. FIXME: This is a dirty hack. ;; in the shell. FIXME: This is a dirty hack.
(if (and (eq this-command 'self-insert-command) (if (and (eq this-command 'self-insert-command)
@ -5088,7 +5075,7 @@ Cache to disk for quick recovery."
(setq res nil)) (setq res nil))
(t (t
;; Just scan this buffer ;; Just scan this buffer
(if (eq major-mode 'idlwave-mode) (if (derived-mode-p 'idlwave-mode)
(progn (progn
(message "Scanning current buffer...") (message "Scanning current buffer...")
(setq res (idlwave-get-routine-info-from-buffers (setq res (idlwave-get-routine-info-from-buffers
@ -5142,7 +5129,7 @@ Cache to disk for quick recovery."
(defun idlwave-update-current-buffer-info (why) (defun idlwave-update-current-buffer-info (why)
"Update `idlwave-routines' for current buffer. "Update `idlwave-routines' for current buffer.
Can run from `after-save-hook'." Can run from `after-save-hook'."
(when (and (eq major-mode 'idlwave-mode) (when (and (derived-mode-p 'idlwave-mode)
(or (eq t idlwave-auto-routine-info-updates) (or (eq t idlwave-auto-routine-info-updates)
(memq why idlwave-auto-routine-info-updates)) (memq why idlwave-auto-routine-info-updates))
idlwave-scan-all-buffers-for-routine-info idlwave-scan-all-buffers-for-routine-info
@ -5188,7 +5175,7 @@ Can run from `after-save-hook'."
(save-excursion (save-excursion
(while (setq buf (pop buffers)) (while (setq buf (pop buffers))
(set-buffer buf) (set-buffer buf)
(if (and (eq major-mode 'idlwave-mode) (if (and (derived-mode-p 'idlwave-mode)
buffer-file-name) buffer-file-name)
;; yes, this buffer has the right mode. ;; yes, this buffer has the right mode.
(progn (setq res (condition-case nil (progn (setq res (condition-case nil
@ -7030,7 +7017,7 @@ sort the list before displaying."
"Call FUNCTION as a completion chooser and pass ARGS to it." "Call FUNCTION as a completion chooser and pass ARGS to it."
(let ((completion-ignore-case t)) ; install correct value (let ((completion-ignore-case t)) ; install correct value
(apply function args)) (apply function args))
(if (and (eq major-mode 'idlwave-shell-mode) (if (and (derived-mode-p 'idlwave-shell-mode)
(boundp 'font-lock-mode) (boundp 'font-lock-mode)
(not font-lock-mode)) (not font-lock-mode))
;; For the shell, remove the fontification of the word before point ;; For the shell, remove the fontification of the word before point
@ -7431,7 +7418,7 @@ class/struct definition."
;; Read the file in temporarily ;; Read the file in temporarily
(set-buffer (get-buffer-create " *IDLWAVE-tmp*")) (set-buffer (get-buffer-create " *IDLWAVE-tmp*"))
(erase-buffer) (erase-buffer)
(unless (eq major-mode 'idlwave-mode) (unless (derived-mode-p 'idlwave-mode)
(idlwave-mode)) (idlwave-mode))
(insert-file-contents file)) (insert-file-contents file))
(save-excursion (save-excursion
@ -8183,8 +8170,7 @@ demand _EXTRA in the keyword list."
;; If this is the OBJ_NEW function, try to figure out the class and use ;; If this is the OBJ_NEW function, try to figure out the class and use
;; the keywords from the corresponding INIT method. ;; the keywords from the corresponding INIT method.
(if (and (equal (upcase name) "OBJ_NEW") (if (and (equal (upcase name) "OBJ_NEW")
(or (eq major-mode 'idlwave-mode) (derived-mode-p 'idlwave-mode 'idlwave-shell-mode))
(eq major-mode 'idlwave-shell-mode)))
(let* ((bos (save-excursion (idlwave-beginning-of-statement) (point))) (let* ((bos (save-excursion (idlwave-beginning-of-statement) (point)))
(string (buffer-substring bos (point))) (string (buffer-substring bos (point)))
(case-fold-search t) (case-fold-search t)
@ -8634,7 +8620,7 @@ was pressed."
"List the load path shadows of all routines defined in current buffer." "List the load path shadows of all routines defined in current buffer."
(interactive "P") (interactive "P")
(idlwave-routines) (idlwave-routines)
(if (eq major-mode 'idlwave-mode) (if (derived-mode-p 'idlwave-mode)
(idlwave-list-load-path-shadows (idlwave-list-load-path-shadows
nil (idlwave-update-current-buffer-info 'save-buffer) nil (idlwave-update-current-buffer-info 'save-buffer)
"in current buffer") "in current buffer")

View file

@ -216,7 +216,7 @@ buffer with \\[set-variable].")
(put 'inferior-lisp-mode 'mode-class 'special) (put 'inferior-lisp-mode 'mode-class 'special)
(defun inferior-lisp-mode () (define-derived-mode inferior-lisp-mode comint-mode "Inferior Lisp"
"Major mode for interacting with an inferior Lisp process. "Major mode for interacting with an inferior Lisp process.
Runs a Lisp interpreter as a subprocess of Emacs, with Lisp I/O through an Runs a Lisp interpreter as a subprocess of Emacs, with Lisp I/O through an
Emacs buffer. Variable `inferior-lisp-program' controls which Lisp interpreter Emacs 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
Paragraphs are separated only by blank lines. Semicolons start comments. Paragraphs are separated only by blank lines. Semicolons start comments.
If you accidentally suspend your process, use \\[comint-continue-subjob] If you accidentally suspend your process, use \\[comint-continue-subjob]
to continue it." to continue it."
(interactive)
(delay-mode-hooks
(comint-mode))
(setq comint-prompt-regexp inferior-lisp-prompt) (setq comint-prompt-regexp inferior-lisp-prompt)
(setq major-mode 'inferior-lisp-mode)
(setq mode-name "Inferior Lisp")
(setq mode-line-process '(":%s")) (setq mode-line-process '(":%s"))
(lisp-mode-variables t) (lisp-mode-variables t)
(use-local-map inferior-lisp-mode-map) ;c-c c-k for "kompile" file
(setq comint-get-old-input (function lisp-get-old-input)) (setq comint-get-old-input (function lisp-get-old-input))
(setq comint-input-filter (function lisp-input-filter)) (setq comint-input-filter (function lisp-input-filter)))
(run-mode-hooks 'inferior-lisp-mode-hook))
(defun lisp-get-old-input () (defun lisp-get-old-input ()
"Return a string containing the sexp ending at point." "Return a string containing the sexp ending at point."
@ -600,7 +593,7 @@ See variable `lisp-describe-sym-command'."
;; "Returns the current inferior Lisp process. ;; "Returns the current inferior Lisp process.
;; See variable `inferior-lisp-buffer'." ;; See variable `inferior-lisp-buffer'."
(defun inferior-lisp-proc () (defun inferior-lisp-proc ()
(let ((proc (get-buffer-process (if (eq major-mode 'inferior-lisp-mode) (let ((proc (get-buffer-process (if (derived-mode-p 'inferior-lisp-mode)
(current-buffer) (current-buffer)
inferior-lisp-buffer)))) inferior-lisp-buffer))))
(or proc (or proc

View file

@ -2135,7 +2135,7 @@ and each value is a marker giving the location of that symbol."
with imenu-use-markers = t with imenu-use-markers = t
for buffer being the buffers for buffer being the buffers
for imenu-index = (with-current-buffer buffer for imenu-index = (with-current-buffer buffer
(when (eq major-mode 'js-mode) (when (derived-mode-p 'js-mode)
(js--imenu-create-index))) (js--imenu-create-index)))
do (js--imenu-to-flat imenu-index "" symbols) do (js--imenu-to-flat imenu-index "" symbols)
finally return symbols)) finally return symbols))
@ -3286,15 +3286,9 @@ If one hasn't been set, or if it's stale, prompt for a new one."
;;; Main Function ;;; Main Function
;;;###autoload ;;;###autoload
(define-derived-mode js-mode prog-mode "js" (define-derived-mode js-mode prog-mode "Javascript"
"Major mode for editing JavaScript. "Major mode for editing JavaScript."
Key bindings:
\\{js-mode-map}"
:group 'js :group 'js
:syntax-table js-mode-syntax-table
(set (make-local-variable 'indent-line-function) 'js-indent-line) (set (make-local-variable 'indent-line-function) 'js-indent-line)
(set (make-local-variable 'beginning-of-defun-function) (set (make-local-variable 'beginning-of-defun-function)
@ -3330,9 +3324,6 @@ Key bindings:
(set (make-local-variable 'imenu-create-index-function) (set (make-local-variable 'imenu-create-index-function)
#'js--imenu-create-index) #'js--imenu-create-index)
(setq major-mode 'js-mode)
(setq mode-name "Javascript")
;; for filling, pretend we're cc-mode ;; for filling, pretend we're cc-mode
(setq c-comment-prefix-regexp "//+\\|\\**" (setq c-comment-prefix-regexp "//+\\|\\**"
c-paragraph-start "$" c-paragraph-start "$"
@ -3363,10 +3354,9 @@ Key bindings:
;; the buffer containing the problem, JIT-lock will apply the ;; the buffer containing the problem, JIT-lock will apply the
;; correct syntax to the regular expresion literal and the problem ;; correct syntax to the regular expresion literal and the problem
;; will mysteriously disappear. ;; will mysteriously disappear.
(font-lock-set-defaults) ;; FIXME: We should actually do this fontification lazily by adding
;; calls to syntax-propertize wherever it's really needed.
(let (font-lock-keywords) ; leaves syntactic keywords intact (syntax-propertize (point-max)))
(font-lock-fontify-buffer)))
;;;###autoload ;;;###autoload
(defalias 'javascript-mode 'js-mode) (defalias 'javascript-mode 'js-mode)

View file

@ -143,27 +143,12 @@
(switch-to-buffer-other-window "*m4-output*")) (switch-to-buffer-other-window "*m4-output*"))
;;;###autoload ;;;###autoload
(defun m4-mode () (define-derived-mode m4-mode prog-mode "m4"
"A major mode to edit m4 macro files. "A major mode to edit m4 macro files."
\\{m4-mode-map} :abbrev-table m4-mode-abbrev-table
" (set (make-local-variable 'comment-start) "#")
(interactive) (set (make-local-variable 'parse-sexp-ignore-comments) t)
(kill-all-local-variables) (set (make-local-variable 'font-lock-defaults) '(m4-font-lock-keywords nil)))
(use-local-map m4-mode-map)
(make-local-variable 'comment-start)
(setq comment-start "#")
(make-local-variable 'parse-sexp-ignore-comments)
(setq parse-sexp-ignore-comments t)
(setq local-abbrev-table m4-mode-abbrev-table)
(make-local-variable 'font-lock-defaults)
(setq major-mode 'm4-mode
mode-name "m4"
font-lock-defaults '(m4-font-lock-keywords nil)
)
(set-syntax-table m4-mode-syntax-table)
(run-mode-hooks 'm4-mode-hook))
(provide 'm4-mode) (provide 'm4-mode)
;;stuff to play with for debugging ;;stuff to play with for debugging

View file

@ -474,6 +474,7 @@ If the list was changed, sort the list and remove duplicates first."
(defun meta-complete-symbol () (defun meta-complete-symbol ()
"Perform completion on Metafont or MetaPost symbol preceding point." "Perform completion on Metafont or MetaPost symbol preceding point."
;; FIXME: Use completion-at-point-functions.
(interactive "*") (interactive "*")
(let ((list meta-complete-list) (let ((list meta-complete-list)
entry) entry)
@ -844,11 +845,10 @@ The environment marked is the one that contains point or follows point."
;;; Syntax table, keymap and menu. ;;; Syntax table, keymap and menu.
(defvar meta-mode-abbrev-table nil (define-abbrev-table 'meta-mode-abbrev-table ()
"Abbrev table used in Metafont or MetaPost mode.") "Abbrev table used in Metafont or MetaPost mode.")
(define-abbrev-table 'meta-mode-abbrev-table ())
(defvar meta-mode-syntax-table (defvar meta-common-mode-syntax-table
(let ((st (make-syntax-table))) (let ((st (make-syntax-table)))
;; underscores are word constituents ;; underscores are word constituents
(modify-syntax-entry ?_ "w" st) (modify-syntax-entry ?_ "w" st)
@ -885,9 +885,8 @@ The environment marked is the one that contains point or follows point."
st) st)
"Syntax table used in Metafont or MetaPost mode.") "Syntax table used in Metafont or MetaPost mode.")
(defvar meta-mode-map (defvar meta-common-mode-map
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
(define-key map "\C-m" 'reindent-then-newline-and-indent)
;; Comment Paragraphs: ;; Comment Paragraphs:
;; (define-key map "\M-a" 'backward-sentence) ;; (define-key map "\M-a" 'backward-sentence)
;; (define-key map "\M-e" 'forward-sentence) ;; (define-key map "\M-e" 'forward-sentence)
@ -915,10 +914,10 @@ The environment marked is the one that contains point or follows point."
;; (define-key map "\C-c\C-l" 'meta-recenter-output) ;; (define-key map "\C-c\C-l" 'meta-recenter-output)
map) map)
"Keymap used in Metafont or MetaPost mode.") "Keymap used in Metafont or MetaPost mode.")
(define-obsolete-variable-alias 'meta-mode-map 'meta-common-mode-map "24.1")
(easy-menu-define (easy-menu-define
meta-mode-menu meta-mode-map meta-mode-menu meta-common-mode-map
"Menu used in Metafont or MetaPost mode." "Menu used in Metafont or MetaPost mode."
(list "Meta" (list "Meta"
["Forward Environment" meta-beginning-of-defun t] ["Forward Environment" meta-beginning-of-defun t]
@ -976,106 +975,62 @@ The environment marked is the one that contains point or follows point."
;;; Initialization. ;;; Initialization.
(defun meta-common-initialization () (define-derived-mode meta-common-mode prog-mode "-Meta-common-"
"Common initialization for Metafont or MetaPost mode." "Common initialization for Metafont or MetaPost mode."
(kill-all-local-variables) :abbrev-table meta-mode-abbrev-table
(set (make-local-variable 'paragraph-start)
(concat page-delimiter "\\|$"))
(set (make-local-variable 'paragraph-separate)
(concat page-delimiter "\\|$"))
(make-local-variable 'paragraph-start) (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
(make-local-variable 'paragraph-separate)
(setq paragraph-start
(concat page-delimiter "\\|$"))
(setq paragraph-separate
(concat page-delimiter "\\|$"))
(make-local-variable 'paragraph-ignore-fill-prefix) (set (make-local-variable 'comment-start-skip) "%+[ \t\f]*")
(setq paragraph-ignore-fill-prefix t) (set (make-local-variable 'comment-start) "%")
(set (make-local-variable 'comment-end) "")
(make-local-variable 'comment-start-skip) (set (make-local-variable 'comment-multi-line) nil)
(make-local-variable 'comment-start)
(make-local-variable 'comment-end)
(make-local-variable 'comment-multi-line)
(setq comment-start-skip "%+[ \t\f]*")
(setq comment-start "%")
(setq comment-end "")
(setq comment-multi-line nil)
;; We use `back-to-indentation' but \f is no indentation sign. ;; We use `back-to-indentation' but \f is no indentation sign.
(modify-syntax-entry ?\f "_ ") (modify-syntax-entry ?\f "_ ")
(make-local-variable 'parse-sexp-ignore-comments) (set (make-local-variable 'parse-sexp-ignore-comments) t)
(setq parse-sexp-ignore-comments t)
(make-local-variable 'comment-indent-function) (set (make-local-variable 'comment-indent-function) #'meta-comment-indent)
(setq comment-indent-function 'meta-comment-indent) (set (make-local-variable 'indent-line-function) #'meta-indent-line)
(make-local-variable 'indent-line-function)
(setq indent-line-function 'meta-indent-line)
;; No need to define a mode-specific 'indent-region-function. ;; No need to define a mode-specific 'indent-region-function.
;; Simply use the generic 'indent-region and 'comment-region. ;; Simply use the generic 'indent-region and 'comment-region.
;; Set defaults for font-lock mode. ;; Set defaults for font-lock mode.
(make-local-variable 'font-lock-defaults) (set (make-local-variable 'font-lock-defaults)
(setq font-lock-defaults '(meta-font-lock-keywords
'(meta-font-lock-keywords nil nil ((?_ . "w")) nil
nil nil ((?_ . "w")) nil (font-lock-comment-start-regexp . "%")))
(font-lock-comment-start-regexp . "%")))
;; Activate syntax table, keymap and menu. ;; Activate syntax table, keymap and menu.
(setq local-abbrev-table meta-mode-abbrev-table) (easy-menu-add meta-mode-menu))
(set-syntax-table meta-mode-syntax-table)
(use-local-map meta-mode-map)
(easy-menu-add meta-mode-menu)
)
;;;###autoload ;;;###autoload
(defun metafont-mode () (define-derived-mode metafont-mode meta-common-mode "Metafont"
"Major mode for editing Metafont sources. "Major mode for editing Metafont sources."
Special commands:
\\{meta-mode-map}
Turning on Metafont mode calls the value of the variables
`meta-common-mode-hook' and `metafont-mode-hook'."
(interactive)
(meta-common-initialization)
(setq mode-name "Metafont")
(setq major-mode 'metafont-mode)
;; Set defaults for completion function. ;; Set defaults for completion function.
(make-local-variable 'meta-symbol-list) (set (make-local-variable 'meta-symbol-list) nil)
(make-local-variable 'meta-symbol-changed) (set (make-local-variable 'meta-symbol-changed) nil)
(make-local-variable 'meta-complete-list)
(setq meta-symbol-list nil)
(setq meta-symbol-changed nil)
(apply 'meta-add-symbols metafont-symbol-list) (apply 'meta-add-symbols metafont-symbol-list)
(setq meta-complete-list (set (make-local-variable 'meta-complete-list)
(list (list "\\<\\(\\sw+\\)" 1 'meta-symbol-list) (list (list "\\<\\(\\sw+\\)" 1 'meta-symbol-list)
(list "" 'ispell-complete-word))) (list "" 'ispell-complete-word))))
(run-mode-hooks 'meta-common-mode-hook 'metafont-mode-hook))
;;;###autoload ;;;###autoload
(defun metapost-mode () (define-derived-mode metapost-mode meta-common-mode "MetaPost"
"Major mode for editing MetaPost sources. "Major mode for editing MetaPost sources."
Special commands:
\\{meta-mode-map}
Turning on MetaPost mode calls the value of the variable
`meta-common-mode-hook' and `metafont-mode-hook'."
(interactive)
(meta-common-initialization)
(setq mode-name "MetaPost")
(setq major-mode 'metapost-mode)
;; Set defaults for completion function. ;; Set defaults for completion function.
(make-local-variable 'meta-symbol-list) (set (make-local-variable 'meta-symbol-list) nil)
(make-local-variable 'meta-symbol-changed) (set (make-local-variable 'meta-symbol-changed) nil)
(make-local-variable 'meta-complete-list)
(setq meta-symbol-list nil)
(setq meta-symbol-changed nil)
(apply 'meta-add-symbols metapost-symbol-list) (apply 'meta-add-symbols metapost-symbol-list)
(setq meta-complete-list (set (make-local-variable 'meta-complete-list)
(list (list "\\<\\(\\sw+\\)" 1 'meta-symbol-list) (list (list "\\<\\(\\sw+\\)" 1 'meta-symbol-list)
(list "" 'ispell-complete-word))) (list "" 'ispell-complete-word))))
(run-mode-hooks 'meta-common-mode-hook 'metapost-mode-hook))
;;; Just in case ... ;;; Just in case ...

View file

@ -1106,8 +1106,7 @@ Assumes that file has been compiled with debugging support."
;;;###autoload ;;;###autoload
(define-derived-mode mixal-mode fundamental-mode "mixal" (define-derived-mode mixal-mode fundamental-mode "mixal"
"Major mode for the mixal asm language. "Major mode for the mixal asm language."
\\{mixal-mode-map}"
(set (make-local-variable 'comment-start) "*") (set (make-local-variable 'comment-start) "*")
(set (make-local-variable 'comment-start-skip) "^\\*[ \t]*") (set (make-local-variable 'comment-start-skip) "^\\*[ \t]*")
(set (make-local-variable 'font-lock-defaults) (set (make-local-variable 'font-lock-defaults)
@ -1117,11 +1116,7 @@ Assumes that file has been compiled with debugging support."
;; might add an indent function in the future ;; might add an indent function in the future
;; (set (make-local-variable 'indent-line-function) 'mixal-indent-line) ;; (set (make-local-variable 'indent-line-function) 'mixal-indent-line)
(set (make-local-variable 'compile-command) (concat "mixasm " (set (make-local-variable 'compile-command) (concat "mixasm "
buffer-file-name)) buffer-file-name)))
;; mixasm will do strange when there is no final newline,
;; so let Emacs ensure that it is always there
(set (make-local-variable 'require-final-newline)
mode-require-final-newline))
(provide 'mixal-mode) (provide 'mixal-mode)

View file

@ -308,8 +308,6 @@ followed by the first character of the construct.
`m2-indent' controls the number of spaces for each indentation. `m2-indent' controls the number of spaces for each indentation.
`m2-compile-command' holds the command to compile a Modula-2 program. `m2-compile-command' holds the command to compile a Modula-2 program.
`m2-link-command' holds the command to link a Modula-2 program." `m2-link-command' holds the command to link a Modula-2 program."
(make-local-variable 'm2-end-comment-column)
(set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter)) (set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter))
(set (make-local-variable 'paragraph-separate) paragraph-start) (set (make-local-variable 'paragraph-separate) paragraph-start)
(set (make-local-variable 'paragraph-ignore-fill-prefix) t) (set (make-local-variable 'paragraph-ignore-fill-prefix) t)

View file

@ -121,34 +121,24 @@ the regular expression `comint-prompt-regexp', a buffer local variable."
This variable is used to initialize `comint-dynamic-complete-functions' This variable is used to initialize `comint-dynamic-complete-functions'
in the Inferior Octave buffer.") in the Inferior Octave buffer.")
(defun inferior-octave-mode () (define-derived-mode inferior-octave-mode comint-mode "Inferior Octave"
"Major mode for interacting with an inferior Octave process. "Major mode for interacting with an inferior Octave process.
Runs Octave as a subprocess of Emacs, with Octave I/O through an Emacs Runs Octave as a subprocess of Emacs, with Octave I/O through an Emacs
buffer. buffer.
Entry to this mode successively runs the hooks `comint-mode-hook' and Entry to this mode successively runs the hooks `comint-mode-hook' and
`inferior-octave-mode-hook'." `inferior-octave-mode-hook'."
(interactive)
(delay-mode-hooks (comint-mode))
(setq comint-prompt-regexp inferior-octave-prompt (setq comint-prompt-regexp inferior-octave-prompt
major-mode 'inferior-octave-mode
mode-name "Inferior Octave"
mode-line-process '(":%s") mode-line-process '(":%s")
local-abbrev-table octave-abbrev-table) local-abbrev-table octave-abbrev-table)
(use-local-map inferior-octave-mode-map)
(set-syntax-table inferior-octave-mode-syntax-table)
(make-local-variable 'comment-start) (set (make-local-variable 'comment-start) octave-comment-start)
(setq comment-start octave-comment-start) (set (make-local-variable 'comment-end) "")
(make-local-variable 'comment-end) (set (make-local-variable 'comment-column) 32)
(setq comment-end "") (set (make-local-variable 'comment-start-skip) octave-comment-start-skip)
(make-local-variable 'comment-column)
(setq comment-column 32)
(make-local-variable 'comment-start-skip)
(setq comment-start-skip octave-comment-start-skip)
(make-local-variable 'font-lock-defaults) (set (make-local-variable 'font-lock-defaults)
(setq font-lock-defaults '(inferior-octave-font-lock-keywords nil nil)) '(inferior-octave-font-lock-keywords nil nil))
(setq comint-input-ring-file-name (setq comint-input-ring-file-name
(or (getenv "OCTAVE_HISTFILE") "~/.octave_hist") (or (getenv "OCTAVE_HISTFILE") "~/.octave_hist")
@ -157,9 +147,7 @@ Entry to this mode successively runs the hooks `comint-mode-hook' and
inferior-octave-dynamic-complete-functions) inferior-octave-dynamic-complete-functions)
(add-hook 'comint-input-filter-functions (add-hook 'comint-input-filter-functions
'inferior-octave-directory-tracker nil t) 'inferior-octave-directory-tracker nil t)
(comint-read-input-ring t) (comint-read-input-ring t))
(run-mode-hooks 'inferior-octave-mode-hook))
;;;###autoload ;;;###autoload
(defun inferior-octave (&optional arg) (defun inferior-octave (&optional arg)

View file

@ -655,8 +655,7 @@ including a reproducible test case and send the message."
'octave-beginning-of-defun) 'octave-beginning-of-defun)
(easy-menu-add octave-mode-menu) (easy-menu-add octave-mode-menu)
(octave-initialize-completions) (octave-initialize-completions))
(run-mode-hooks 'octave-mode-hook))
(defvar info-lookup-mode) (defvar info-lookup-mode)

View file

@ -545,7 +545,7 @@ create a new comment."
"Normal hook to run when entering Perl mode.") "Normal hook to run when entering Perl mode.")
;;;###autoload ;;;###autoload
(defun perl-mode () (define-derived-mode perl-mode prog-mode "Perl"
"Major mode for editing Perl code. "Major mode for editing Perl code.
Expression and list commands understand all Perl brackets. Expression and list commands understand all Perl brackets.
Tab indents for Perl code. Tab indents for Perl code.
@ -592,33 +592,16 @@ Various indentation styles: K&R BSD BLK GNU LW
perl-label-offset -5 -8 -2 -2 -2 perl-label-offset -5 -8 -2 -2 -2
Turning on Perl mode runs the normal hook `perl-mode-hook'." Turning on Perl mode runs the normal hook `perl-mode-hook'."
(interactive) :abbrev-table perl-mode-abbrev-table
(kill-all-local-variables) (set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter))
(use-local-map perl-mode-map) (set (make-local-variable 'paragraph-separate) paragraph-start)
(setq major-mode 'perl-mode) (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
(setq mode-name "Perl") (set (make-local-variable 'indent-line-function) #'perl-indent-line)
(setq local-abbrev-table perl-mode-abbrev-table) (set (make-local-variable 'comment-start) "# ")
(set-syntax-table perl-mode-syntax-table) (set (make-local-variable 'comment-end) "")
(make-local-variable 'paragraph-start) (set (make-local-variable 'comment-start-skip) "\\(^\\|\\s-\\);?#+ *")
(setq paragraph-start (concat "$\\|" page-delimiter)) (set (make-local-variable 'comment-indent-function) #'perl-comment-indent)
(make-local-variable 'paragraph-separate) (set (make-local-variable 'parse-sexp-ignore-comments) t)
(setq paragraph-separate paragraph-start)
(make-local-variable 'paragraph-ignore-fill-prefix)
(setq paragraph-ignore-fill-prefix t)
(make-local-variable 'indent-line-function)
(setq indent-line-function 'perl-indent-line)
(make-local-variable 'require-final-newline)
(setq require-final-newline mode-require-final-newline)
(make-local-variable 'comment-start)
(setq comment-start "# ")
(make-local-variable 'comment-end)
(setq comment-end "")
(make-local-variable 'comment-start-skip)
(setq comment-start-skip "\\(^\\|\\s-\\);?#+ *")
(make-local-variable 'comment-indent-function)
(setq comment-indent-function 'perl-comment-indent)
(make-local-variable 'parse-sexp-ignore-comments)
(setq parse-sexp-ignore-comments t)
;; Tell font-lock.el how to handle Perl. ;; Tell font-lock.el how to handle Perl.
(setq font-lock-defaults '((perl-font-lock-keywords (setq font-lock-defaults '((perl-font-lock-keywords
perl-font-lock-keywords-1 perl-font-lock-keywords-1
@ -636,8 +619,7 @@ Turning on Perl mode runs the normal hook `perl-mode-hook'."
(setq imenu-case-fold-search nil) (setq imenu-case-fold-search nil)
;; Setup outline-minor-mode. ;; Setup outline-minor-mode.
(set (make-local-variable 'outline-regexp) perl-outline-regexp) (set (make-local-variable 'outline-regexp) perl-outline-regexp)
(set (make-local-variable 'outline-level) 'perl-outline-level) (set (make-local-variable 'outline-level) 'perl-outline-level))
(run-mode-hooks 'perl-mode-hook))
;; This is used by indent-for-comment ;; This is used by indent-for-comment
;; to decide how much to indent a comment in Perl code ;; to decide how much to indent a comment in Perl code

View file

@ -180,12 +180,9 @@ When nil, send actual operating system end of file."
(`(:after . ,(or `":-" `"->")) prolog-indent-width))) (`(:after . ,(or `":-" `"->")) prolog-indent-width)))
(defun prolog-mode-variables () (defun prolog-mode-variables ()
(make-local-variable 'paragraph-separate) (set (make-local-variable 'paragraph-separate) (concat "%%\\|$\\|" page-delimiter)) ;'%%..'
(setq paragraph-separate (concat "%%\\|$\\|" page-delimiter)) ;'%%..' (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
(make-local-variable 'paragraph-ignore-fill-prefix) (set (make-local-variable 'imenu-generic-expression) '((nil "^\\sw+" 0)))
(setq paragraph-ignore-fill-prefix t)
(make-local-variable 'imenu-generic-expression)
(setq imenu-generic-expression '((nil "^\\sw+" 0)))
;; Setup SMIE. ;; Setup SMIE.
(smie-setup prolog-smie-grammar #'prolog-smie-rules (smie-setup prolog-smie-grammar #'prolog-smie-rules
@ -197,14 +194,10 @@ When nil, send actual operating system end of file."
;; There's no real closer in Prolog anyway. ;; There's no real closer in Prolog anyway.
(set (make-local-variable 'smie-blink-matching-inners) t) (set (make-local-variable 'smie-blink-matching-inners) t)
(make-local-variable 'comment-start) (set (make-local-variable 'comment-start) "%")
(setq comment-start "%") (set (make-local-variable 'comment-start-skip) "\\(?:%+\\|/\\*+\\)[ \t]*")
(make-local-variable 'comment-start-skip) (set (make-local-variable 'comment-end-skip) "[ \t]*\\(\n\\|\\*+/\\)")
(setq comment-start-skip "\\(?:%+\\|/\\*+\\)[ \t]*") (set (make-local-variable 'comment-column) 48))
(make-local-variable 'comment-end-skip)
(setq comment-end-skip "[ \t]*\\(\n\\|\\*+/\\)")
(make-local-variable 'comment-column)
(setq comment-column 48))
(defvar prolog-mode-map (defvar prolog-mode-map
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))

View file

@ -979,9 +979,7 @@ plus the usually uncoded characters inserted on positions 1 through 28."
(define-derived-mode ps-run-mode comint-mode "Interactive PS" (define-derived-mode ps-run-mode comint-mode "Interactive PS"
"Major mode in interactive PostScript window. "Major mode in interactive PostScript window.
This mode is invoked from `ps-mode' and should not be called directly. This mode is invoked from `ps-mode' and should not be called directly."
\\{ps-run-mode-map}"
(set (make-local-variable 'font-lock-defaults) (set (make-local-variable 'font-lock-defaults)
'((ps-run-font-lock-keywords '((ps-run-font-lock-keywords
ps-run-font-lock-keywords-1 ps-run-font-lock-keywords-1
@ -991,7 +989,7 @@ This mode is invoked from `ps-mode' and should not be called directly.
(defun ps-run-running () (defun ps-run-running ()
"Error if not in `ps-mode' or not running PostScript." "Error if not in `ps-mode' or not running PostScript."
(unless (equal major-mode 'ps-mode) (unless (derived-mode-p 'ps-mode)
(error "This function can only be called from PostScript mode")) (error "This function can only be called from PostScript mode"))
(unless (equal (process-status "ps-run") 'run) (unless (equal (process-status "ps-run") 'run)
(error "No PostScript process running"))) (error "No PostScript process running")))

View file

@ -1317,7 +1317,7 @@ See `python-check-command' for the default."
(let ((name (buffer-file-name))) (let ((name (buffer-file-name)))
(if name (if name
(file-name-nondirectory name)))))))) (file-name-nondirectory name))))))))
(setq python-saved-check-command command) (set (make-local-variable 'python-saved-check-command) command)
(require 'compile) ;To define compilation-* variables. (require 'compile) ;To define compilation-* variables.
(save-some-buffers (not compilation-ask-about-save) nil) (save-some-buffers (not compilation-ask-about-save) nil)
(let ((compilation-error-regexp-alist (let ((compilation-error-regexp-alist
@ -2522,7 +2522,6 @@ with skeleton expansions for compound statement templates.
(set (make-local-variable 'outline-heading-end-regexp) ":\\s-*\n") (set (make-local-variable 'outline-heading-end-regexp) ":\\s-*\n")
(set (make-local-variable 'outline-level) #'python-outline-level) (set (make-local-variable 'outline-level) #'python-outline-level)
(set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil) (set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil)
(make-local-variable 'python-saved-check-command)
(set (make-local-variable 'beginning-of-defun-function) (set (make-local-variable 'beginning-of-defun-function)
'python-beginning-of-defun) 'python-beginning-of-defun)
(set (make-local-variable 'end-of-defun-function) 'python-end-of-defun) (set (make-local-variable 'end-of-defun-function) 'python-end-of-defun)

View file

@ -126,39 +126,27 @@
(defun scheme-mode-variables () (defun scheme-mode-variables ()
(set-syntax-table scheme-mode-syntax-table) (set-syntax-table scheme-mode-syntax-table)
(setq local-abbrev-table scheme-mode-abbrev-table) (setq local-abbrev-table scheme-mode-abbrev-table)
(make-local-variable 'paragraph-start) (set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter))
(setq paragraph-start (concat "$\\|" page-delimiter)) (set (make-local-variable 'paragraph-separate) paragraph-start)
(make-local-variable 'paragraph-separate) (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
(setq paragraph-separate paragraph-start) (set (make-local-variable 'fill-paragraph-function) 'lisp-fill-paragraph)
(make-local-variable 'paragraph-ignore-fill-prefix)
(setq paragraph-ignore-fill-prefix t)
(make-local-variable 'fill-paragraph-function)
(setq fill-paragraph-function 'lisp-fill-paragraph)
;; Adaptive fill mode gets in the way of auto-fill, ;; Adaptive fill mode gets in the way of auto-fill,
;; and should make no difference for explicit fill ;; and should make no difference for explicit fill
;; because lisp-fill-paragraph should do the job. ;; because lisp-fill-paragraph should do the job.
(make-local-variable 'adaptive-fill-mode) (set (make-local-variable 'adaptive-fill-mode) nil)
(setq adaptive-fill-mode nil) (set (make-local-variable 'indent-line-function) 'lisp-indent-line)
(make-local-variable 'indent-line-function) (set (make-local-variable 'parse-sexp-ignore-comments) t)
(setq indent-line-function 'lisp-indent-line) (set (make-local-variable 'outline-regexp) ";;; \\|(....")
(make-local-variable 'parse-sexp-ignore-comments) (set (make-local-variable 'comment-start) ";")
(setq parse-sexp-ignore-comments t)
(make-local-variable 'outline-regexp)
(setq outline-regexp ";;; \\|(....")
(make-local-variable 'comment-start)
(setq comment-start ";")
(set (make-local-variable 'comment-add) 1) (set (make-local-variable 'comment-add) 1)
(make-local-variable 'comment-start-skip)
;; Look within the line for a ; following an even number of backslashes ;; Look within the line for a ; following an even number of backslashes
;; after either a non-backslash or the line beginning. ;; after either a non-backslash or the line beginning.
(setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+[ \t]*") (set (make-local-variable 'comment-start-skip)
"\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+[ \t]*")
(set (make-local-variable 'font-lock-comment-start-skip) ";+ *") (set (make-local-variable 'font-lock-comment-start-skip) ";+ *")
(make-local-variable 'comment-column) (set (make-local-variable 'comment-column) 40)
(setq comment-column 40) (set (make-local-variable 'parse-sexp-ignore-comments) t)
(make-local-variable 'parse-sexp-ignore-comments) (set (make-local-variable 'lisp-indent-function) 'scheme-indent-function)
(setq parse-sexp-ignore-comments t)
(make-local-variable 'lisp-indent-function)
(setq lisp-indent-function 'scheme-indent-function)
(setq mode-line-process '("" scheme-mode-line-process)) (setq mode-line-process '("" scheme-mode-line-process))
(set (make-local-variable 'imenu-case-fold-search) t) (set (make-local-variable 'imenu-case-fold-search) t)
(setq imenu-generic-expression scheme-imenu-generic-expression) (setq imenu-generic-expression scheme-imenu-generic-expression)
@ -206,7 +194,7 @@ All commands in `lisp-mode-shared-map' are inherited by this map.")
(define-key map "\e\C-q" 'indent-sexp)) (define-key map "\e\C-q" 'indent-sexp))
;;;###autoload ;;;###autoload
(defun scheme-mode () (define-derived-mode scheme-mode prog-mode "Scheme"
"Major mode for editing Scheme code. "Major mode for editing Scheme code.
Editing commands are similar to those of `lisp-mode'. Editing commands are similar to those of `lisp-mode'.
@ -225,13 +213,7 @@ Blank lines separate paragraphs. Semicolons start comments.
\\{scheme-mode-map} \\{scheme-mode-map}
Entry to this mode calls the value of `scheme-mode-hook' Entry to this mode calls the value of `scheme-mode-hook'
if that value is non-nil." if that value is non-nil."
(interactive) (scheme-mode-variables))
(kill-all-local-variables)
(use-local-map scheme-mode-map)
(setq major-mode 'scheme-mode)
(setq mode-name "Scheme")
(scheme-mode-variables)
(run-mode-hooks 'scheme-mode-hook))
(defgroup scheme nil (defgroup scheme nil
"Editing Scheme code." "Editing Scheme code."
@ -404,10 +386,7 @@ Blank lines separate paragraphs. Semicolons start comments.
Entering this mode runs the hooks `scheme-mode-hook' and then Entering this mode runs the hooks `scheme-mode-hook' and then
`dsssl-mode-hook' and inserts the value of `dsssl-sgml-declaration' if `dsssl-mode-hook' and inserts the value of `dsssl-sgml-declaration' if
that variable's value is a string." that variable's value is a string."
(make-local-variable 'page-delimiter) (set (make-local-variable 'page-delimiter) "^;;;") ; ^L not valid SGML char
(setq page-delimiter "^;;;" ; ^L not valid SGML char
major-mode 'dsssl-mode
mode-name "DSSSL")
;; Insert a suitable SGML declaration into an empty buffer. ;; Insert a suitable SGML declaration into an empty buffer.
;; FIXME: This should use `auto-insert-alist' instead. ;; FIXME: This should use `auto-insert-alist' instead.
(and (zerop (buffer-size)) (and (zerop (buffer-size))

View file

@ -362,8 +362,6 @@ the car and cdr are the same symbol.")
"The shell being programmed. This is set by \\[sh-set-shell].") "The shell being programmed. This is set by \\[sh-set-shell].")
;;;###autoload(put 'sh-shell 'safe-local-variable 'symbolp) ;;;###autoload(put 'sh-shell 'safe-local-variable 'symbolp)
(defvar sh-mode-abbrev-table nil)
(define-abbrev-table 'sh-mode-abbrev-table ()) (define-abbrev-table 'sh-mode-abbrev-table ())
@ -566,19 +564,6 @@ This is buffer-local in every such buffer.")
:type '(repeat function) :type '(repeat function)
:group 'sh-script) :group 'sh-script)
(defcustom sh-require-final-newline
'((csh . t)
(pdksh . t))
"Value of `require-final-newline' in Shell-Script mode buffers.
\(SHELL . t) means use the value of `mode-require-final-newline' for SHELL.
See `sh-feature'."
:type '(repeat (cons (symbol :tag "Shell")
(choice (const :tag "require" t)
(sexp :format "Evaluate: %v"))))
:group 'sh-script)
(defcustom sh-assignment-regexp (defcustom sh-assignment-regexp
'((csh . "\\<\\([[:alnum:]_]+\\)\\(\\[.+\\]\\)?[ \t]*[-+*/%^]?=") '((csh . "\\<\\([[:alnum:]_]+\\)\\(\\[.+\\]\\)?[ \t]*[-+*/%^]?=")
;; actually spaces are only supported in let/(( ... )) ;; actually spaces are only supported in let/(( ... ))
@ -1717,10 +1702,6 @@ Calls the value of `sh-set-shell-hook' if set."
(setq sh-shell-file (setq sh-shell-file
(executable-set-magic shell (sh-feature sh-shell-arg) (executable-set-magic shell (sh-feature sh-shell-arg)
no-query-flag insert-flag))) no-query-flag insert-flag)))
(let ((tem (sh-feature sh-require-final-newline)))
(if (eq tem t)
(set (make-local-variable 'require-final-newline)
mode-require-final-newline)))
(setq mode-line-process (format "[%s]" sh-shell)) (setq mode-line-process (format "[%s]" sh-shell))
(set (make-local-variable 'sh-shell-variables) nil) (set (make-local-variable 'sh-shell-variables) nil)
(set (make-local-variable 'sh-shell-variables-initialized) nil) (set (make-local-variable 'sh-shell-variables-initialized) nil)

View file

@ -371,33 +371,20 @@ Variables controlling indentation style:
Turning on SIMULA mode calls the value of the variable simula-mode-hook Turning on SIMULA mode calls the value of the variable simula-mode-hook
with no arguments, if that value is non-nil." with no arguments, if that value is non-nil."
(make-local-variable 'comment-column) (set (make-local-variable 'comment-column) 40)
(setq comment-column 40) ;; (set (make-local-variable 'end-comment-column) 75)
; (make-local-variable 'end-comment-column) (set (make-local-variable 'paragraph-start) "[ \t]*$\\|\\f")
; (setq end-comment-column 75) (set (make-local-variable 'paragraph-separate) paragraph-start)
(make-local-variable 'paragraph-start) (set (make-local-variable 'indent-line-function) 'simula-indent-line)
(setq paragraph-start "[ \t]*$\\|\\f") (set (make-local-variable 'comment-start) "! ")
(make-local-variable 'paragraph-separate) (set (make-local-variable 'comment-end) " ;")
(setq paragraph-separate paragraph-start) (set (make-local-variable 'comment-start-skip) "!+ *")
(make-local-variable 'indent-line-function) (set (make-local-variable 'parse-sexp-ignore-comments) nil)
(setq indent-line-function 'simula-indent-line) (set (make-local-variable 'comment-multi-line) t)
(make-local-variable 'require-final-newline) (set (make-local-variable 'font-lock-defaults)
(setq require-final-newline mode-require-final-newline) '((simula-font-lock-keywords simula-font-lock-keywords-1
(make-local-variable 'comment-start) simula-font-lock-keywords-2 simula-font-lock-keywords-3)
(setq comment-start "! ") nil t ((?_ . "w"))))
(make-local-variable 'comment-end)
(setq comment-end " ;")
(make-local-variable 'comment-start-skip)
(setq comment-start-skip "!+ *")
(make-local-variable 'parse-sexp-ignore-comments)
(setq parse-sexp-ignore-comments nil)
(make-local-variable 'comment-multi-line)
(setq comment-multi-line t)
(make-local-variable 'font-lock-defaults)
(setq font-lock-defaults
'((simula-font-lock-keywords simula-font-lock-keywords-1
simula-font-lock-keywords-2 simula-font-lock-keywords-3)
nil t ((?_ . "w"))))
(set (make-local-variable 'syntax-propertize-function) (set (make-local-variable 'syntax-propertize-function)
simula-syntax-propertize-function) simula-syntax-propertize-function)
(abbrev-mode 1)) (abbrev-mode 1))

View file

@ -2303,20 +2303,21 @@ also be configured."
'((?_ . "w") (?. . "w"))))) '((?_ . "w") (?. . "w")))))
;; Get the product-specific keywords. ;; Get the product-specific keywords.
(setq sql-mode-font-lock-keywords (set (make-local-variable 'sql-mode-font-lock-keywords)
(append (append
(unless (eq sql-product 'ansi) (unless (eq sql-product 'ansi)
(sql-get-product-feature sql-product :font-lock)) (sql-get-product-feature sql-product :font-lock))
;; Always highlight ANSI keywords ;; Always highlight ANSI keywords
(sql-get-product-feature 'ansi :font-lock) (sql-get-product-feature 'ansi :font-lock)
;; Fontify object names in CREATE, DROP and ALTER DDL ;; Fontify object names in CREATE, DROP and ALTER DDL
;; statements ;; statements
(list sql-mode-font-lock-object-name))) (list sql-mode-font-lock-object-name)))
;; Setup font-lock. Force re-parsing of `font-lock-defaults'. ;; Setup font-lock. Force re-parsing of `font-lock-defaults'.
(kill-local-variable 'font-lock-set-defaults) (kill-local-variable 'font-lock-set-defaults)
(setq font-lock-defaults (list 'sql-mode-font-lock-keywords (set (make-local-variable 'font-lock-defaults)
keywords-only t syntax-alist)) (list 'sql-mode-font-lock-keywords
keywords-only t syntax-alist))
;; Force font lock to reinitialize if it is already on ;; Force font lock to reinitialize if it is already on
;; Otherwise, we can wait until it can be started. ;; Otherwise, we can wait until it can be started.
@ -3232,7 +3233,7 @@ buffer is popped into a view window. "
;;; SQL mode -- uses SQL interactive mode ;;; SQL mode -- uses SQL interactive mode
;;;###autoload ;;;###autoload
(defun sql-mode () (define-derived-mode sql-mode prog-mode "SQL"
"Major mode to edit SQL. "Major mode to edit SQL.
You can send SQL statements to the SQLi buffer using You 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:
\(add-hook 'sql-mode-hook \(add-hook 'sql-mode-hook
(lambda () (lambda ()
(modify-syntax-entry ?\\\\ \".\" sql-mode-syntax-table)))" (modify-syntax-entry ?\\\\ \".\" sql-mode-syntax-table)))"
(interactive) :abbrev-table sql-mode-abbrev-table
(kill-all-local-variables)
(setq major-mode 'sql-mode)
(setq mode-name "SQL")
(use-local-map sql-mode-map)
(if sql-mode-menu (if sql-mode-menu
(easy-menu-add sql-mode-menu)); XEmacs (easy-menu-add sql-mode-menu)); XEmacs
(set-syntax-table sql-mode-syntax-table)
(make-local-variable 'font-lock-defaults) (set (make-local-variable 'comment-start) "--")
(make-local-variable 'sql-mode-font-lock-keywords)
(make-local-variable 'comment-start)
(setq comment-start "--")
;; Make each buffer in sql-mode remember the "current" SQLi buffer. ;; Make each buffer in sql-mode remember the "current" SQLi buffer.
(make-local-variable 'sql-buffer) (make-local-variable 'sql-buffer)
;; Add imenu support for sql-mode. Note that imenu-generic-expression ;; 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:
imenu-case-fold-search t) imenu-case-fold-search t)
;; Make `sql-send-paragraph' work on paragraphs that contain indented ;; Make `sql-send-paragraph' work on paragraphs that contain indented
;; lines. ;; lines.
(make-local-variable 'paragraph-separate) (set (make-local-variable 'paragraph-separate) "[\f]*$")
(make-local-variable 'paragraph-start) (set (make-local-variable 'paragraph-start) "[\n\f]")
(setq paragraph-separate "[\f]*$"
paragraph-start "[\n\f]")
;; Abbrevs ;; Abbrevs
(setq local-abbrev-table sql-mode-abbrev-table)
(setq abbrev-all-caps 1) (setq abbrev-all-caps 1)
;; Run hook
(run-mode-hooks 'sql-mode-hook)
;; Catch changes to sql-product and highlight accordingly ;; Catch changes to sql-product and highlight accordingly
(sql-highlight-product)
(add-hook 'hack-local-variables-hook 'sql-highlight-product t t)) (add-hook 'hack-local-variables-hook 'sql-highlight-product t t))
@ -3375,15 +3363,14 @@ you entered, right above the output it created.
sql-product)) sql-product))
;; Setup the mode. ;; Setup the mode.
(setq major-mode 'sql-interactive-mode) (setq major-mode 'sql-interactive-mode) ;FIXME: Use define-derived-mode.
(setq mode-name (concat "SQLi[" (or (sql-get-product-feature sql-product :name) (setq mode-name
(symbol-name sql-product)) "]")) (concat "SQLi[" (or (sql-get-product-feature sql-product :name)
(symbol-name sql-product)) "]"))
(use-local-map sql-interactive-mode-map) (use-local-map sql-interactive-mode-map)
(if sql-interactive-mode-menu (if sql-interactive-mode-menu
(easy-menu-add sql-interactive-mode-menu)) ; XEmacs (easy-menu-add sql-interactive-mode-menu)) ; XEmacs
(set-syntax-table sql-mode-syntax-table) (set-syntax-table sql-mode-syntax-table)
(make-local-variable 'sql-mode-font-lock-keywords)
(make-local-variable 'font-lock-defaults)
;; Note that making KEYWORDS-ONLY nil will cause havoc if you try ;; Note that making KEYWORDS-ONLY nil will cause havoc if you try
;; SELECT 'x' FROM DUAL with SQL*Plus, because the title of the column ;; 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.
(sql-product-font-lock t nil) (sql-product-font-lock t nil)
;; Enable commenting and uncommenting of the region. ;; Enable commenting and uncommenting of the region.
(make-local-variable 'comment-start) (set (make-local-variable 'comment-start) "--")
(setq comment-start "--")
;; Abbreviation table init and case-insensitive. It is not activated ;; Abbreviation table init and case-insensitive. It is not activated
;; by default. ;; by default.
(setq local-abbrev-table sql-mode-abbrev-table) (setq local-abbrev-table sql-mode-abbrev-table)
@ -3403,8 +3389,8 @@ you entered, right above the output it created.
;; Save the connection name ;; Save the connection name
(make-local-variable 'sql-connection) (make-local-variable 'sql-connection)
;; Create a usefull name for renaming this buffer later. ;; Create a usefull name for renaming this buffer later.
(make-local-variable 'sql-alternate-buffer-name) (set (make-local-variable 'sql-alternate-buffer-name)
(setq sql-alternate-buffer-name (sql-make-alternate-buffer-name)) (sql-make-alternate-buffer-name))
;; User stuff. Initialize before the hook. ;; User stuff. Initialize before the hook.
(set (make-local-variable 'sql-prompt-regexp) (set (make-local-variable 'sql-prompt-regexp)
(sql-get-product-feature sql-product :prompt-regexp)) (sql-get-product-feature sql-product :prompt-regexp))

View file

@ -572,10 +572,7 @@ documentation for details):
Turning on Tcl mode runs `tcl-mode-hook'. Read the documentation for Turning on Tcl mode runs `tcl-mode-hook'. Read the documentation for
`tcl-mode-hook' to see what kinds of interesting hook functions `tcl-mode-hook' to see what kinds of interesting hook functions
already exist. already exist."
Commands:
\\{tcl-mode-map}"
(unless (and (boundp 'filladapt-mode) filladapt-mode) (unless (and (boundp 'filladapt-mode) filladapt-mode)
(set (make-local-variable 'paragraph-ignore-fill-prefix) t)) (set (make-local-variable 'paragraph-ignore-fill-prefix) t))
@ -1064,7 +1061,7 @@ With argument, positions cursor at end of buffer."
(defun inferior-tcl-proc () (defun inferior-tcl-proc ()
"Return current inferior Tcl process. "Return current inferior Tcl process.
See variable `inferior-tcl-buffer'." See variable `inferior-tcl-buffer'."
(let ((proc (get-buffer-process (if (eq major-mode 'inferior-tcl-mode) (let ((proc (get-buffer-process (if (derived-mode-p 'inferior-tcl-mode)
(current-buffer) (current-buffer)
inferior-tcl-buffer)))) inferior-tcl-buffer))))
(or proc (or proc
@ -1287,7 +1284,7 @@ to update the alist.")
If FLAG is nil, just uses `current-word'. If FLAG is nil, just uses `current-word'.
Otherwise scans backward for most likely Tcl command word." Otherwise scans backward for most likely Tcl command word."
(if (and flag (if (and flag
(memq major-mode '(tcl-mode inferior-tcl-mode))) (derived-mode-p 'tcl-mode 'inferior-tcl-mode))
(condition-case nil (condition-case nil
(save-excursion (save-excursion
;; Look backward for first word actually in alist. ;; Look backward for first word actually in alist.
@ -1363,7 +1360,7 @@ Prefix argument means switch to the Tcl buffer afterwards."
;; filename. ;; filename.
(car (comint-get-source "Load Tcl file: " (car (comint-get-source "Load Tcl file: "
(or (and (or (and
(eq major-mode 'tcl-mode) (derived-mode-p 'tcl-mode)
(buffer-file-name)) (buffer-file-name))
tcl-previous-dir/file) tcl-previous-dir/file)
'(tcl-mode) t)) '(tcl-mode) t))
@ -1383,12 +1380,12 @@ Prefix argument means switch to the Tcl buffer afterwards."
(list (list
(car (comint-get-source "Restart with Tcl file: " (car (comint-get-source "Restart with Tcl file: "
(or (and (or (and
(eq major-mode 'tcl-mode) (derived-mode-p 'tcl-mode)
(buffer-file-name)) (buffer-file-name))
tcl-previous-dir/file) tcl-previous-dir/file)
'(tcl-mode) t)) '(tcl-mode) t))
current-prefix-arg)) current-prefix-arg))
(let* ((buf (if (eq major-mode 'inferior-tcl-mode) (let* ((buf (if (derived-mode-p 'inferior-tcl-mode)
(current-buffer) (current-buffer)
inferior-tcl-buffer)) inferior-tcl-buffer))
(proc (and buf (get-process buf)))) (proc (and buf (get-process buf))))

View file

@ -253,7 +253,7 @@ If nil, TAB always indents current line."
;;;###autoload (add-to-list 'auto-mode-alist (cons (purecopy "\\.vr[hi]?\\'") 'vera-mode)) ;;;###autoload (add-to-list 'auto-mode-alist (cons (purecopy "\\.vr[hi]?\\'") 'vera-mode))
;;;###autoload ;;;###autoload
(defun vera-mode () (define-derived-mode vera-mode prog-mode "Vera"
"Major mode for editing Vera code. "Major mode for editing Vera code.
Usage: Usage:
@ -301,13 +301,6 @@ Key bindings:
------------- -------------
\\{vera-mode-map}" \\{vera-mode-map}"
(interactive)
(kill-all-local-variables)
(setq major-mode 'vera-mode)
(setq mode-name "Vera")
;; set maps and tables
(use-local-map vera-mode-map)
(set-syntax-table vera-mode-syntax-table)
;; set local variables ;; set local variables
(require 'cc-cmds) (require 'cc-cmds)
(set (make-local-variable 'comment-start) "//") (set (make-local-variable 'comment-start) "//")
@ -328,9 +321,7 @@ Key bindings:
;; add menu (XEmacs) ;; add menu (XEmacs)
(easy-menu-add vera-mode-menu) (easy-menu-add vera-mode-menu)
;; miscellaneous ;; miscellaneous
(message "Vera Mode %s. Type C-c C-h for documentation." vera-version) (message "Vera Mode %s. Type C-c C-h for documentation." vera-version))
;; run hooks
(run-hooks 'vera-mode-hook))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

@ -1533,16 +1533,14 @@ portion, will be substituted."
(cond (cond
((or (file-exists-p "makefile") ;If there is a makefile, use it ((or (file-exists-p "makefile") ;If there is a makefile, use it
(file-exists-p "Makefile")) (file-exists-p "Makefile"))
(make-local-variable 'compile-command) (set (make-local-variable 'compile-command) "make "))
(setq compile-command "make "))
(t (t
(make-local-variable 'compile-command) (set (make-local-variable 'compile-command)
(setq compile-command (if verilog-tool
(if verilog-tool (if (string-match "%s" (eval verilog-tool))
(if (string-match "%s" (eval verilog-tool)) (format (eval verilog-tool) (or buffer-file-name ""))
(format (eval verilog-tool) (or buffer-file-name "")) (concat (eval verilog-tool) " " (or buffer-file-name "")))
(concat (eval verilog-tool) " " (or buffer-file-name ""))) ""))))
""))))
(verilog-modify-compile-command)) (verilog-modify-compile-command))
(defun verilog-expand-command (command) (defun verilog-expand-command (command)
@ -1566,8 +1564,8 @@ be substituted."
(when (and (when (and
(stringp compile-command) (stringp compile-command)
(string-match "\\b\\(__FLAGS__\\|__FILE__\\)\\b" compile-command)) (string-match "\\b\\(__FLAGS__\\|__FILE__\\)\\b" compile-command))
(make-local-variable 'compile-command) (set (make-local-variable 'compile-command)
(setq compile-command (verilog-expand-command compile-command)))) (verilog-expand-command compile-command))))
(if (featurep 'xemacs) (if (featurep 'xemacs)
;; Following code only gets called from compilation-mode-hook on XEmacs to add error handling. ;; Following code only gets called from compilation-mode-hook on XEmacs to add error handling.
@ -1588,8 +1586,8 @@ find the errors."
(cdr compilation-error-regexp-alist-alist))))) (cdr compilation-error-regexp-alist-alist)))))
(if (boundp 'compilation-font-lock-keywords) (if (boundp 'compilation-font-lock-keywords)
(progn (progn
(make-local-variable 'compilation-font-lock-keywords) (set (make-local-variable 'compilation-font-lock-keywords)
(setq compilation-font-lock-keywords verilog-error-font-lock-keywords) verilog-error-font-lock-keywords)
(font-lock-set-defaults))) (font-lock-set-defaults)))
;; Need to re-run compilation-error-regexp builder ;; Need to re-run compilation-error-regexp builder
(if (fboundp 'compilation-build-compilation-error-regexp-alist) (if (fboundp 'compilation-build-compilation-error-regexp-alist)
@ -2975,7 +2973,7 @@ Use filename, if current buffer being edited shorten to just buffer name."
;; ;;
(defvar verilog-which-tool 1) (defvar verilog-which-tool 1)
;;;###autoload ;;;###autoload
(defun verilog-mode () (define-derived-mode verilog-mode prog-mode "Verilog"
"Major mode for editing Verilog code. "Major mode for editing Verilog code.
\\<verilog-mode-map> \\<verilog-mode-map>
See \\[describe-function] verilog-auto (\\[verilog-auto]) for details on how See \\[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].
Key bindings specific to `verilog-mode-map' are: Key bindings specific to `verilog-mode-map' are:
\\{verilog-mode-map}" \\{verilog-mode-map}"
(interactive) :abbrev-table verilog-mode-abbrev-table
(kill-all-local-variables)
(use-local-map verilog-mode-map)
(setq major-mode 'verilog-mode)
(setq mode-name "Verilog")
(setq local-abbrev-table verilog-mode-abbrev-table)
(set (make-local-variable 'beginning-of-defun-function) (set (make-local-variable 'beginning-of-defun-function)
'verilog-beg-of-defun) 'verilog-beg-of-defun)
(set (make-local-variable 'end-of-defun-function) (set (make-local-variable 'end-of-defun-function)
'verilog-end-of-defun) 'verilog-end-of-defun)
(set-syntax-table verilog-mode-syntax-table) (set-syntax-table verilog-mode-syntax-table)
(make-local-variable 'indent-line-function) (set (make-local-variable 'indent-line-function)
(setq indent-line-function 'verilog-indent-line-relative) #'verilog-indent-line-relative)
(setq comment-indent-function 'verilog-comment-indent) (setq comment-indent-function 'verilog-comment-indent)
(make-local-variable 'parse-sexp-ignore-comments) (set (make-local-variable 'parse-sexp-ignore-comments) nil)
(setq parse-sexp-ignore-comments nil)
(make-local-variable 'comment-start) (set (make-local-variable 'comment-start) "// ")
(make-local-variable 'comment-end) (set (make-local-variable 'comment-end) "")
(make-local-variable 'comment-multi-line) (set (make-local-variable 'comment-start-skip) "/\\*+ *\\|// *")
(make-local-variable 'comment-start-skip) (set (make-local-variable 'comment-multi-line) nil)
(setq comment-start "// "
comment-end ""
comment-start-skip "/\\*+ *\\|// *"
comment-multi-line nil)
;; Set up for compilation ;; Set up for compilation
(setq verilog-which-tool 1) (setq verilog-which-tool 1)
(setq verilog-tool 'verilog-linter) (setq verilog-tool 'verilog-linter)
@ -3166,8 +3155,8 @@ Key bindings specific to `verilog-mode-map' are:
(add-hook 'after-change-functions 'verilog-highlight-region t t)) (add-hook 'after-change-functions 'verilog-highlight-region t t))
;; Tell imenu how to handle Verilog. ;; Tell imenu how to handle Verilog.
(make-local-variable 'imenu-generic-expression) (set (make-local-variable 'imenu-generic-expression)
(setq imenu-generic-expression verilog-imenu-generic-expression) verilog-imenu-generic-expression)
;; Tell which-func-modes that imenu knows about verilog ;; Tell which-func-modes that imenu knows about verilog
(when (boundp 'which-function-modes) (when (boundp 'which-function-modes)
(add-to-list 'which-func-modes 'verilog-mode)) (add-to-list 'which-func-modes 'verilog-mode))
@ -3180,8 +3169,7 @@ Key bindings specific to `verilog-mode-map' are:
hs-special-modes-alist)))) hs-special-modes-alist))))
;; Stuff for autos ;; Stuff for autos
(add-hook 'write-contents-hooks 'verilog-auto-save-check) ; already local (add-hook 'write-contents-hooks 'verilog-auto-save-check nil 'local))
(run-hooks 'verilog-mode-hook))
;; ;;
@ -8042,8 +8030,7 @@ Optionally associate it with the specified enumeration ENUMNAME."
(let ((enumvar (intern (concat "venum-" enumname)))) (let ((enumvar (intern (concat "venum-" enumname))))
;;(message "Define %s=%s" defname defvalue) (sleep-for 1) ;;(message "Define %s=%s" defname defvalue) (sleep-for 1)
(unless (boundp enumvar) (set enumvar nil)) (unless (boundp enumvar) (set enumvar nil))
(make-local-variable enumvar) (add-to-list (make-local-variable enumvar) defname)))))
(add-to-list enumvar defname)))))
(defun verilog-read-defines (&optional filename recurse subcall) (defun verilog-read-defines (&optional filename recurse subcall)
"Read `defines and parameters for the current file, or optional FILENAME. "Read `defines and parameters for the current file, or optional FILENAME.
@ -9349,10 +9336,9 @@ Typing \\[verilog-inject-auto] will make this into:
(defun verilog-auto-reeval-locals (&optional force) (defun verilog-auto-reeval-locals (&optional force)
"Read file local variable segment at bottom of file if it has changed. "Read file local variable segment at bottom of file if it has changed.
If FORCE, always reread it." If FORCE, always reread it."
(make-local-variable 'verilog-auto-last-file-locals)
(let ((curlocal (verilog-auto-read-locals))) (let ((curlocal (verilog-auto-read-locals)))
(when (or force (not (equal verilog-auto-last-file-locals curlocal))) (when (or force (not (equal verilog-auto-last-file-locals curlocal)))
(setq verilog-auto-last-file-locals curlocal) (set (make-local-variable 'verilog-auto-last-file-locals) curlocal)
;; Note this may cause this function to be recursively invoked, ;; Note this may cause this function to be recursively invoked,
;; because hack-local-variables may call (verilog-mode) ;; because hack-local-variables may call (verilog-mode)
;; The above when statement will prevent it from recursing forever. ;; The above when statement will prevent it from recursing forever.

View file

@ -4117,7 +4117,10 @@ The directory of the current source file is scanned."
;; performs all buffer local initializations ;; performs all buffer local initializations
;;;###autoload ;;;###autoload
(defun vhdl-mode () (define-derived-mode vhdl-mode prog-mode
'("VHDL" (vhdl-electric-mode "/" (vhdl-stutter-mode "/"))
(vhdl-electric-mode "e")
(vhdl-stutter-mode "s"))
"Major mode for editing VHDL code. "Major mode for editing VHDL code.
Usage: Usage:
@ -4650,26 +4653,13 @@ Key bindings:
------------- -------------
\\{vhdl-mode-map}" \\{vhdl-mode-map}"
(interactive) :abbrev-table vhdl-mode-abbrev-table
(kill-all-local-variables)
(setq major-mode 'vhdl-mode)
(setq mode-name '("VHDL"
(vhdl-electric-mode "/" (vhdl-stutter-mode "/"))
(vhdl-electric-mode "e")
(vhdl-stutter-mode "s")))
;; set maps and tables
(use-local-map vhdl-mode-map)
(set-syntax-table vhdl-mode-syntax-table)
(setq local-abbrev-table vhdl-mode-abbrev-table)
;; set local variables ;; set local variables
(set (make-local-variable 'paragraph-start) (set (make-local-variable 'paragraph-start)
"\\s-*\\(--+\\s-*$\\|[^ -]\\|$\\)") "\\s-*\\(--+\\s-*$\\|[^ -]\\|$\\)")
(set (make-local-variable 'paragraph-separate) paragraph-start) (set (make-local-variable 'paragraph-separate) paragraph-start)
(set (make-local-variable 'paragraph-ignore-fill-prefix) t) (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
(set (make-local-variable 'require-final-newline)
(if vhdl-emacs-22 mode-require-final-newline t))
(set (make-local-variable 'parse-sexp-ignore-comments) t) (set (make-local-variable 'parse-sexp-ignore-comments) t)
(set (make-local-variable 'indent-line-function) 'vhdl-indent-line) (set (make-local-variable 'indent-line-function) 'vhdl-indent-line)
(set (make-local-variable 'comment-start) "--") (set (make-local-variable 'comment-start) "--")
@ -4686,8 +4676,7 @@ Key bindings:
;; setup the comment indent variable in a Emacs version portable way ;; setup the comment indent variable in a Emacs version portable way
;; ignore any byte compiler warnings you might get here ;; ignore any byte compiler warnings you might get here
(when (boundp 'comment-indent-function) (when (boundp 'comment-indent-function)
(make-local-variable 'comment-indent-function) (set (make-local-variable 'comment-indent-function) 'vhdl-comment-indent))
(setq comment-indent-function 'vhdl-comment-indent))
;; initialize font locking ;; initialize font locking
(set (make-local-variable 'font-lock-defaults) (set (make-local-variable 'font-lock-defaults)
@ -4731,12 +4720,7 @@ Key bindings:
(vhdl-ps-print-init) (vhdl-ps-print-init)
(vhdl-write-file-hooks-init) (vhdl-write-file-hooks-init)
(message "VHDL Mode %s.%s" vhdl-version (message "VHDL Mode %s.%s" vhdl-version
(if noninteractive "" " See menu for documentation and release notes.")) (if noninteractive "" " See menu for documentation and release notes.")))
;; run hooks
(if vhdl-emacs-22
(run-mode-hooks 'vhdl-mode-hook)
(run-hooks 'vhdl-mode-hook)))
(defun vhdl-activate-customizations () (defun vhdl-activate-customizations ()
"Activate all customizations on local variables." "Activate all customizations on local variables."
@ -4754,10 +4738,10 @@ Key bindings:
(defun vhdl-write-file-hooks-init () (defun vhdl-write-file-hooks-init ()
"Add/remove hooks when buffer is saved." "Add/remove hooks when buffer is saved."
(if vhdl-modify-date-on-saving (if vhdl-modify-date-on-saving
(add-hook 'local-write-file-hooks 'vhdl-template-modify-noerror) (add-hook 'local-write-file-hooks 'vhdl-template-modify-noerror nil t)
(remove-hook 'local-write-file-hooks 'vhdl-template-modify-noerror)) (remove-hook 'local-write-file-hooks 'vhdl-template-modify-noerror t))
(make-local-variable 'after-save-hook) (if (featurep 'xemacs) (make-local-hook 'after-save-hook))
(add-hook 'after-save-hook 'vhdl-add-modified-file)) (add-hook 'after-save-hook 'vhdl-add-modified-file nil t))
(defun vhdl-process-command-line-option (option) (defun vhdl-process-command-line-option (option)
"Process command line options for VHDL Mode." "Process command line options for VHDL Mode."
@ -5271,13 +5255,12 @@ argument. The styles are chosen from the `vhdl-style-alist' variable."
(lambda (varentry) (lambda (varentry)
(let ((var (car varentry)) (let ((var (car varentry))
(val (cdr varentry))) (val (cdr varentry)))
(and local
(make-local-variable var))
;; special case for vhdl-offsets-alist ;; special case for vhdl-offsets-alist
(if (not (eq var 'vhdl-offsets-alist)) (if (not (eq var 'vhdl-offsets-alist))
(set var val) (set (if local (make-local-variable var) var) val)
;; reset vhdl-offsets-alist to the default value first ;; reset vhdl-offsets-alist to the default value first
(setq vhdl-offsets-alist (copy-alist vhdl-offsets-alist-default)) (set (if local (make-local-variable var) var)
(copy-alist vhdl-offsets-alist-default))
;; now set the langelems that are different ;; now set the langelems that are different
(mapcar (mapcar
(function (function
@ -12500,10 +12483,10 @@ File statistics: \"%s\"\n\
(cons (list 'vhdl-mode vhdl-hs-start-regexp nil "--\\( \\|$\\)" (cons (list 'vhdl-mode vhdl-hs-start-regexp nil "--\\( \\|$\\)"
'vhdl-hs-forward-sexp-func nil) 'vhdl-hs-forward-sexp-func nil)
hs-special-modes-alist))) hs-special-modes-alist)))
(make-local-variable 'hs-minor-mode-hook) (if (featurep 'xemacs) (make-local-hook 'hs-minor-mode-hook))
(if vhdl-hide-all-init (if vhdl-hide-all-init
(add-hook 'hs-minor-mode-hook 'hs-hide-all) (add-hook 'hs-minor-mode-hook 'hs-hide-all nil t)
(remove-hook 'hs-minor-mode-hook 'hs-hide-all)) (remove-hook 'hs-minor-mode-hook 'hs-hide-all t))
(hs-minor-mode arg) (hs-minor-mode arg)
(force-mode-line-update))) ; hack to update menu bar (force-mode-line-update))) ; hack to update menu bar
@ -12970,8 +12953,8 @@ This does background highlighting of translate-off regions.")
(if (featurep 'xemacs) (if (featurep 'xemacs)
(when (boundp 'ps-print-color-p) (when (boundp 'ps-print-color-p)
(vhdl-ps-print-settings)) (vhdl-ps-print-settings))
(make-local-variable 'ps-print-hook) (if (featurep 'xemacs) (make-local-hook 'ps-print-hook))
(add-hook 'ps-print-hook 'vhdl-ps-print-settings))) (add-hook 'ps-print-hook 'vhdl-ps-print-settings nil t)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

@ -283,8 +283,7 @@ If no function name is found, return nil."
(null which-function-imenu-failed)) (null which-function-imenu-failed))
(imenu--make-index-alist t) (imenu--make-index-alist t)
(unless imenu--index-alist (unless imenu--index-alist
(make-local-variable 'which-function-imenu-failed) (set (make-local-variable 'which-function-imenu-failed) t)))
(setq which-function-imenu-failed t)))
;; If we have an index alist, use it. ;; If we have an index alist, use it.
(when (and (null name) (when (and (null name)
(boundp 'imenu--index-alist) imenu--index-alist) (boundp 'imenu--index-alist) imenu--index-alist)

View file

@ -186,8 +186,7 @@ With argument, asks for a command line."
(setq-default xscheme-process-command-line command-line) (setq-default xscheme-process-command-line command-line)
(switch-to-buffer (switch-to-buffer
(xscheme-start-process command-line process-name buffer-name)) (xscheme-start-process command-line process-name buffer-name))
(make-local-variable 'xscheme-process-command-line) (set (make-local-variable 'xscheme-process-command-line) command-line))
(setq xscheme-process-command-line command-line))
(defun xscheme-read-command-line (arg) (defun xscheme-read-command-line (arg)
(let ((default (let ((default
@ -278,13 +277,11 @@ With argument, asks for a command line."
xscheme-buffer-name xscheme-buffer-name
t))) t)))
(let ((process-name (verify-xscheme-buffer buffer-name t))) (let ((process-name (verify-xscheme-buffer buffer-name t)))
(make-local-variable 'xscheme-buffer-name) (set (make-local-variable 'xscheme-buffer-name) buffer-name)
(setq xscheme-buffer-name buffer-name) (set (make-local-variable 'xscheme-process-name) process-name)
(make-local-variable 'xscheme-process-name) (set (make-local-variable 'xscheme-runlight)
(setq xscheme-process-name process-name) (with-current-buffer buffer-name
(make-local-variable 'xscheme-runlight) xscheme-runlight))))
(setq xscheme-runlight (with-current-buffer buffer-name
xscheme-runlight))))
(defun local-clear-scheme-interaction-buffer () (defun local-clear-scheme-interaction-buffer ()
"Make the current buffer use the default scheme interaction buffer." "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
with no args, if that value is non-nil. with no args, if that value is non-nil.
Likewise with the value of scheme-mode-hook. Likewise with the value of scheme-mode-hook.
scheme-interaction-mode-hook is called after scheme-mode-hook." scheme-interaction-mode-hook is called after scheme-mode-hook."
;; FIXME: Use define-derived-mode.
(interactive "P") (interactive "P")
(if (not preserve) (if (not preserve)
(let ((previous-mode major-mode)) (let ((previous-mode major-mode))
(kill-all-local-variables) (kill-all-local-variables)
(make-local-variable 'xscheme-previous-mode)
(make-local-variable 'xscheme-buffer-name)
(make-local-variable 'xscheme-process-name) (make-local-variable 'xscheme-process-name)
(make-local-variable 'xscheme-previous-process-state) (make-local-variable 'xscheme-previous-process-state)
(make-local-variable 'xscheme-runlight-string) (make-local-variable 'xscheme-runlight-string)
(make-local-variable 'xscheme-runlight) (make-local-variable 'xscheme-runlight)
(make-local-variable 'xscheme-last-input-end) (set (make-local-variable 'xscheme-previous-mode) previous-mode)
(setq xscheme-previous-mode previous-mode)
(let ((buffer (current-buffer))) (let ((buffer (current-buffer)))
(setq xscheme-buffer-name (buffer-name buffer)) (set (make-local-variable 'xscheme-buffer-name) (buffer-name buffer))
(setq xscheme-last-input-end (make-marker)) (set (make-local-variable 'xscheme-last-input-end) (make-marker))
(let ((process (get-buffer-process buffer))) (let ((process (get-buffer-process buffer)))
(if process (if process
(progn (progn
@ -420,7 +415,7 @@ with no args, if that value is non-nil.
(defun exit-scheme-interaction-mode () (defun exit-scheme-interaction-mode ()
"Take buffer out of scheme interaction mode" "Take buffer out of scheme interaction mode"
(interactive) (interactive)
(if (not (eq major-mode 'scheme-interaction-mode)) (if (not (derived-mode-p 'scheme-interaction-mode))
(error "Buffer not in scheme interaction mode")) (error "Buffer not in scheme interaction mode"))
(let ((previous-state xscheme-previous-process-state)) (let ((previous-state xscheme-previous-process-state))
(funcall xscheme-previous-mode) (funcall xscheme-previous-mode)
@ -437,7 +432,7 @@ with no args, if that value is non-nil.
(defun scheme-interaction-mode-initialize () (defun scheme-interaction-mode-initialize ()
(use-local-map scheme-interaction-mode-map) (use-local-map scheme-interaction-mode-map)
(setq major-mode 'scheme-interaction-mode) (setq major-mode 'scheme-interaction-mode) ;FIXME: Use define-derived-mode.
(setq mode-name "Scheme Interaction")) (setq mode-name "Scheme Interaction"))
(defun scheme-interaction-mode-commands (keymap) (defun scheme-interaction-mode-commands (keymap)
@ -469,8 +464,8 @@ with no args, if that value is non-nil.
(defun xscheme-enter-interaction-mode () (defun xscheme-enter-interaction-mode ()
(with-current-buffer (xscheme-process-buffer) (with-current-buffer (xscheme-process-buffer)
(if (not (eq major-mode 'scheme-interaction-mode)) (if (not (derived-mode-p 'scheme-interaction-mode))
(if (eq major-mode 'scheme-debugger-mode) (if (derived-mode-p 'scheme-debugger-mode)
(scheme-interaction-mode-initialize) (scheme-interaction-mode-initialize)
(scheme-interaction-mode t))))) (scheme-interaction-mode t)))))
@ -494,7 +489,7 @@ Commands:
(defun scheme-debugger-mode-initialize () (defun scheme-debugger-mode-initialize ()
(use-local-map scheme-debugger-mode-map) (use-local-map scheme-debugger-mode-map)
(setq major-mode 'scheme-debugger-mode) (setq major-mode 'scheme-debugger-mode) ;FIXME: Use define-derived-mode.
(setq mode-name "Scheme Debugger")) (setq mode-name "Scheme Debugger"))
(defun scheme-debugger-mode-commands (keymap) (defun scheme-debugger-mode-commands (keymap)
@ -518,9 +513,9 @@ Commands:
(defun xscheme-enter-debugger-mode (prompt-string) (defun xscheme-enter-debugger-mode (prompt-string)
(with-current-buffer (xscheme-process-buffer) (with-current-buffer (xscheme-process-buffer)
(if (not (eq major-mode 'scheme-debugger-mode)) (if (not (derived-mode-p 'scheme-debugger-mode))
(progn (progn
(if (not (eq major-mode 'scheme-interaction-mode)) (if (not (derived-mode-p 'scheme-interaction-mode))
(scheme-interaction-mode t)) (scheme-interaction-mode t))
(scheme-debugger-mode-initialize))))) (scheme-debugger-mode-initialize)))))
@ -528,7 +523,7 @@ Commands:
(let ((buffer (xscheme-process-buffer))) (let ((buffer (xscheme-process-buffer)))
(and buffer (and buffer
(with-current-buffer buffer (with-current-buffer buffer
(eq major-mode 'scheme-debugger-mode))))) (derived-mode-p 'scheme-debugger-mode)))))
;;;; Evaluation Commands ;;;; Evaluation Commands
@ -550,7 +545,7 @@ The strings are concatenated and terminated by a newline."
(defun xscheme-send-string-1 (strings) (defun xscheme-send-string-1 (strings)
(let ((string (apply 'concat strings))) (let ((string (apply 'concat strings)))
(xscheme-send-string-2 string) (xscheme-send-string-2 string)
(if (eq major-mode 'scheme-interaction-mode) (if (derived-mode-p 'scheme-interaction-mode)
(xscheme-insert-expression string)))) (xscheme-insert-expression string))))
(defun xscheme-send-string-2 (string) (defun xscheme-send-string-2 (string)