Mercurial > emacs
comparison lisp/progmodes/dcl-mode.el @ 111870:b47e85affa59
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.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 10 Dec 2010 15:00:25 -0500 |
parents | 249a1455856a |
children | 417b1e4d63cd |
comparison
equal
deleted
inserted
replaced
111869:2b8673bc05c8 | 111870:b47e85affa59 |
---|---|
294 (modify-syntax-entry ?> ")<" dcl-mode-syntax-table) ; > is a matching pair | 294 (modify-syntax-entry ?> ")<" dcl-mode-syntax-table) ; > is a matching pair |
295 (modify-syntax-entry ?\\ "_" dcl-mode-syntax-table) ; not an escape | 295 (modify-syntax-entry ?\\ "_" dcl-mode-syntax-table) ; not an escape |
296 ) | 296 ) |
297 | 297 |
298 | 298 |
299 (defvar dcl-mode-map () | 299 (defvar dcl-mode-map |
300 (let ((map (make-sparse-keymap))) | |
301 (define-key map "\e\n" 'dcl-split-line) | |
302 (define-key map "\e\t" 'tempo-complete-tag) | |
303 (define-key map "\e^" 'dcl-delete-indentation) | |
304 (define-key map "\em" 'dcl-back-to-indentation) | |
305 (define-key map "\ee" 'dcl-forward-command) | |
306 (define-key map "\ea" 'dcl-backward-command) | |
307 (define-key map "\e\C-q" 'dcl-indent-command) | |
308 (define-key map "\t" 'dcl-tab) | |
309 (define-key map ":" 'dcl-electric-character) | |
310 (define-key map "F" 'dcl-electric-character) | |
311 (define-key map "f" 'dcl-electric-character) | |
312 (define-key map "E" 'dcl-electric-character) | |
313 (define-key map "e" 'dcl-electric-character) | |
314 (define-key map "\C-c\C-o" 'dcl-set-option) | |
315 (define-key map "\C-c\C-f" 'tempo-forward-mark) | |
316 (define-key map "\C-c\C-b" 'tempo-backward-mark) | |
317 | |
318 (define-key map [menu-bar] (make-sparse-keymap)) | |
319 (define-key map [menu-bar dcl] | |
320 (cons "DCL" (make-sparse-keymap "DCL"))) | |
321 | |
322 ;; Define these in bottom-up order | |
323 (define-key map [menu-bar dcl tempo-backward-mark] | |
324 '("Previous template mark" . tempo-backward-mark)) | |
325 (define-key map [menu-bar dcl tempo-forward-mark] | |
326 '("Next template mark" . tempo-forward-mark)) | |
327 (define-key map [menu-bar dcl tempo-complete-tag] | |
328 '("Complete template tag" . tempo-complete-tag)) | |
329 (define-key map [menu-bar dcl dcl-separator-tempo] | |
330 '("--")) | |
331 (define-key map [menu-bar dcl dcl-save-all-options] | |
332 '("Save all options" . dcl-save-all-options)) | |
333 (define-key map [menu-bar dcl dcl-save-nondefault-options] | |
334 '("Save changed options" . dcl-save-nondefault-options)) | |
335 (define-key map [menu-bar dcl dcl-set-option] | |
336 '("Set option" . dcl-set-option)) | |
337 (define-key map [menu-bar dcl dcl-separator-option] | |
338 '("--")) | |
339 (define-key map [menu-bar dcl dcl-delete-indentation] | |
340 '("Delete indentation" . dcl-delete-indentation)) | |
341 (define-key map [menu-bar dcl dcl-split-line] | |
342 '("Split line" . dcl-split-line)) | |
343 (define-key map [menu-bar dcl dcl-indent-command] | |
344 '("Indent command" . dcl-indent-command)) | |
345 (define-key map [menu-bar dcl dcl-tab] | |
346 '("Indent line/insert tab" . dcl-tab)) | |
347 (define-key map [menu-bar dcl dcl-back-to-indentation] | |
348 '("Back to indentation" . dcl-back-to-indentation)) | |
349 (define-key map [menu-bar dcl dcl-forward-command] | |
350 '("End of statement" . dcl-forward-command)) | |
351 (define-key map [menu-bar dcl dcl-backward-command] | |
352 '("Beginning of statement" . dcl-backward-command)) | |
353 ;; imenu is only supported for versions with imenu-generic-expression | |
354 (if (boundp 'imenu-generic-expression) | |
355 (progn | |
356 (define-key map [menu-bar dcl dcl-separator-movement] | |
357 '("--")) | |
358 (define-key map [menu-bar dcl imenu] | |
359 '("Buffer index menu" . imenu)))) | |
360 map) | |
300 "Keymap used in DCL-mode buffers.") | 361 "Keymap used in DCL-mode buffers.") |
301 (if dcl-mode-map | |
302 () | |
303 (setq dcl-mode-map (make-sparse-keymap)) | |
304 (define-key dcl-mode-map "\e\n" 'dcl-split-line) | |
305 (define-key dcl-mode-map "\e\t" 'tempo-complete-tag) | |
306 (define-key dcl-mode-map "\e^" 'dcl-delete-indentation) | |
307 (define-key dcl-mode-map "\em" 'dcl-back-to-indentation) | |
308 (define-key dcl-mode-map "\ee" 'dcl-forward-command) | |
309 (define-key dcl-mode-map "\ea" 'dcl-backward-command) | |
310 (define-key dcl-mode-map "\e\C-q" 'dcl-indent-command) | |
311 (define-key dcl-mode-map "\t" 'dcl-tab) | |
312 (define-key dcl-mode-map ":" 'dcl-electric-character) | |
313 (define-key dcl-mode-map "F" 'dcl-electric-character) | |
314 (define-key dcl-mode-map "f" 'dcl-electric-character) | |
315 (define-key dcl-mode-map "E" 'dcl-electric-character) | |
316 (define-key dcl-mode-map "e" 'dcl-electric-character) | |
317 (define-key dcl-mode-map "\C-c\C-o" 'dcl-set-option) | |
318 (define-key dcl-mode-map "\C-c\C-f" 'tempo-forward-mark) | |
319 (define-key dcl-mode-map "\C-c\C-b" 'tempo-backward-mark) | |
320 | |
321 (define-key dcl-mode-map [menu-bar] (make-sparse-keymap)) | |
322 (define-key dcl-mode-map [menu-bar dcl] | |
323 (cons "DCL" (make-sparse-keymap "DCL"))) | |
324 | |
325 ;; Define these in bottom-up order | |
326 (define-key dcl-mode-map [menu-bar dcl tempo-backward-mark] | |
327 '("Previous template mark" . tempo-backward-mark)) | |
328 (define-key dcl-mode-map [menu-bar dcl tempo-forward-mark] | |
329 '("Next template mark" . tempo-forward-mark)) | |
330 (define-key dcl-mode-map [menu-bar dcl tempo-complete-tag] | |
331 '("Complete template tag" . tempo-complete-tag)) | |
332 (define-key dcl-mode-map [menu-bar dcl dcl-separator-tempo] | |
333 '("--")) | |
334 (define-key dcl-mode-map [menu-bar dcl dcl-save-all-options] | |
335 '("Save all options" . dcl-save-all-options)) | |
336 (define-key dcl-mode-map [menu-bar dcl dcl-save-nondefault-options] | |
337 '("Save changed options" . dcl-save-nondefault-options)) | |
338 (define-key dcl-mode-map [menu-bar dcl dcl-set-option] | |
339 '("Set option" . dcl-set-option)) | |
340 (define-key dcl-mode-map [menu-bar dcl dcl-separator-option] | |
341 '("--")) | |
342 (define-key dcl-mode-map [menu-bar dcl dcl-delete-indentation] | |
343 '("Delete indentation" . dcl-delete-indentation)) | |
344 (define-key dcl-mode-map [menu-bar dcl dcl-split-line] | |
345 '("Split line" . dcl-split-line)) | |
346 (define-key dcl-mode-map [menu-bar dcl dcl-indent-command] | |
347 '("Indent command" . dcl-indent-command)) | |
348 (define-key dcl-mode-map [menu-bar dcl dcl-tab] | |
349 '("Indent line/insert tab" . dcl-tab)) | |
350 (define-key dcl-mode-map [menu-bar dcl dcl-back-to-indentation] | |
351 '("Back to indentation" . dcl-back-to-indentation)) | |
352 (define-key dcl-mode-map [menu-bar dcl dcl-forward-command] | |
353 '("End of statement" . dcl-forward-command)) | |
354 (define-key dcl-mode-map [menu-bar dcl dcl-backward-command] | |
355 '("Beginning of statement" . dcl-backward-command)) | |
356 ;; imenu is only supported for versions with imenu-generic-expression | |
357 (if (boundp 'imenu-generic-expression) | |
358 (progn | |
359 (define-key dcl-mode-map [menu-bar dcl dcl-separator-movement] | |
360 '("--")) | |
361 (define-key dcl-mode-map [menu-bar dcl imenu] | |
362 '("Buffer index menu" . imenu)))) | |
363 ) | |
364 | |
365 | 362 |
366 (defcustom dcl-ws-r | 363 (defcustom dcl-ws-r |
367 "\\([ \t]*-[ \t]*\\(!.*\\)*\n\\)*[ \t]*" | 364 "\\([ \t]*-[ \t]*\\(!.*\\)*\n\\)*[ \t]*" |
368 "Regular expression describing white space in a DCL command line. | 365 "Regular expression describing white space in a DCL command line. |
369 White space is any number of continued lines with only space,tab,endcomment | 366 White space is any number of continued lines with only space,tab,endcomment |
473 | 470 |
474 ;;; *** Mode initialization ************************************************* | 471 ;;; *** Mode initialization ************************************************* |
475 | 472 |
476 | 473 |
477 ;;;###autoload | 474 ;;;###autoload |
478 (defun dcl-mode () | 475 (define-derived-mode dcl-mode prog-mode "DCL" |
479 "Major mode for editing DCL-files. | 476 "Major mode for editing DCL-files. |
480 | 477 |
481 This mode indents command lines in blocks. (A block is commands between | 478 This mode indents command lines in blocks. (A block is commands between |
482 THEN-ELSE-ENDIF and between lines matching dcl-block-begin-regexp and | 479 THEN-ELSE-ENDIF and between lines matching dcl-block-begin-regexp and |
483 dcl-block-end-regexp.) | 480 dcl-block-end-regexp.) |
591 $ | 588 $ |
592 | 589 |
593 | 590 |
594 There is some minimal font-lock support (see vars | 591 There is some minimal font-lock support (see vars |
595 `dcl-font-lock-defaults' and `dcl-font-lock-keywords')." | 592 `dcl-font-lock-defaults' and `dcl-font-lock-keywords')." |
596 (interactive) | 593 (set (make-local-variable 'indent-line-function) 'dcl-indent-line) |
597 (kill-all-local-variables) | 594 (set (make-local-variable 'comment-start) "!") |
598 (set-syntax-table dcl-mode-syntax-table) | 595 (set (make-local-variable 'comment-end) "") |
599 | 596 (set (make-local-variable 'comment-multi-line) nil) |
600 (make-local-variable 'indent-line-function) | |
601 (setq indent-line-function 'dcl-indent-line) | |
602 | |
603 (make-local-variable 'comment-start) | |
604 (setq comment-start "!") | |
605 | |
606 (make-local-variable 'comment-end) | |
607 (setq comment-end "") | |
608 | |
609 (make-local-variable 'comment-multi-line) | |
610 (setq comment-multi-line nil) | |
611 | 597 |
612 ;; This used to be "^\\$[ \t]*![ \t]*" which looks more correct. | 598 ;; This used to be "^\\$[ \t]*![ \t]*" which looks more correct. |
613 ;; The drawback was that you couldn't make empty comment lines by pressing | 599 ;; The drawback was that you couldn't make empty comment lines by pressing |
614 ;; C-M-j repeatedly - only the first line became a comment line. | 600 ;; C-M-j repeatedly - only the first line became a comment line. |
615 ;; This version has the drawback that the "$" can be anywhere in the line, | 601 ;; This version has the drawback that the "$" can be anywhere in the line, |
616 ;; and something inappropriate might be interpreted as a comment. | 602 ;; and something inappropriate might be interpreted as a comment. |
617 (make-local-variable 'comment-start-skip) | 603 (set (make-local-variable 'comment-start-skip) "\\$[ \t]*![ \t]*") |
618 (setq comment-start-skip "\\$[ \t]*![ \t]*") | |
619 | 604 |
620 (if (boundp 'imenu-generic-expression) | 605 (if (boundp 'imenu-generic-expression) |
621 (progn (setq imenu-generic-expression dcl-imenu-generic-expression) | 606 (progn (setq imenu-generic-expression dcl-imenu-generic-expression) |
622 (setq imenu-case-fold-search t))) | 607 (setq imenu-case-fold-search t))) |
623 (setq imenu-create-index-function 'dcl-imenu-create-index-function) | 608 (setq imenu-create-index-function 'dcl-imenu-create-index-function) |
634 (make-local-variable 'dcl-calc-command-indent-function) | 619 (make-local-variable 'dcl-calc-command-indent-function) |
635 (make-local-variable 'dcl-calc-cont-indent-function) | 620 (make-local-variable 'dcl-calc-cont-indent-function) |
636 (make-local-variable 'dcl-electric-reindent-regexps) | 621 (make-local-variable 'dcl-electric-reindent-regexps) |
637 | 622 |
638 ;; font lock | 623 ;; font lock |
639 (make-local-variable 'font-lock-defaults) | 624 (set (make-local-variable 'font-lock-defaults) dcl-font-lock-defaults) |
640 (setq font-lock-defaults dcl-font-lock-defaults) | 625 |
641 | 626 (tempo-use-tag-list 'dcl-tempo-tags)) |
642 (setq major-mode 'dcl-mode) | |
643 (setq mode-name "DCL") | |
644 (use-local-map dcl-mode-map) | |
645 (tempo-use-tag-list 'dcl-tempo-tags) | |
646 (run-mode-hooks 'dcl-mode-hook)) | |
647 | 627 |
648 | 628 |
649 ;;; *** Movement commands *************************************************** | 629 ;;; *** Movement commands *************************************************** |
650 | 630 |
651 | 631 |