1992-07-17 07:10:46 +00:00
|
|
|
;;; asm-mode.el --- mode for editing assembler code
|
|
|
|
|
2014-01-01 07:43:34 +00:00
|
|
|
;; Copyright (C) 1991, 2001-2014 Free Software Foundation, Inc.
|
1992-07-24 21:00:38 +00:00
|
|
|
|
1992-07-17 07:10:46 +00:00
|
|
|
;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
|
2014-02-10 01:34:22 +00:00
|
|
|
;; Maintainer: emacs-devel@gnu.org
|
1992-07-17 07:10:46 +00:00
|
|
|
;; Keywords: tools, languages
|
|
|
|
|
1991-12-21 08:23:15 +00:00
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 07:25:26 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1991-12-21 08:23:15 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 07:25:26 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
1991-12-21 08:23:15 +00:00
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 07:25:26 +00:00
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
1991-12-21 08:23:15 +00:00
|
|
|
|
1992-07-17 07:10:46 +00:00
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; This mode was written by Eric S. Raymond <esr@snark.thyrsus.com>,
|
1991-12-21 08:23:15 +00:00
|
|
|
;; inspired by an earlier asm-mode by Martin Neitzel.
|
|
|
|
|
|
|
|
;; This minor mode is based on text mode. It defines a private abbrev table
|
|
|
|
;; that can be used to save abbrevs for assembler mnemonics. It binds just
|
|
|
|
;; five keys:
|
|
|
|
;;
|
|
|
|
;; TAB tab to next tab stop
|
|
|
|
;; : outdent preceding label, tab to tab stop
|
1995-03-23 20:57:04 +00:00
|
|
|
;; comment char place or move comment
|
|
|
|
;; asm-comment-char specifies which character this is;
|
|
|
|
;; you can use a different character in different
|
|
|
|
;; Asm mode buffers.
|
1991-12-21 08:23:15 +00:00
|
|
|
;; C-j, C-m newline and tab to tab stop
|
|
|
|
;;
|
|
|
|
;; Code is indented to the first tab stop level.
|
1992-07-17 07:10:46 +00:00
|
|
|
|
1991-12-21 08:23:15 +00:00
|
|
|
;; This mode runs two hooks:
|
1995-03-22 21:31:08 +00:00
|
|
|
;; 1) An asm-mode-set-comment-hook before the part of the initialization
|
1991-12-21 08:23:15 +00:00
|
|
|
;; depending on asm-comment-char, and
|
|
|
|
;; 2) an asm-mode-hook at the end of initialization.
|
|
|
|
|
1992-07-17 07:10:46 +00:00
|
|
|
;;; Code:
|
|
|
|
|
1998-01-26 11:29:46 +00:00
|
|
|
(defgroup asm nil
|
|
|
|
"Mode for editing assembler code."
|
2005-11-17 07:40:11 +00:00
|
|
|
:link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
|
1998-01-26 11:29:46 +00:00
|
|
|
:group 'languages)
|
|
|
|
|
1998-09-23 23:38:11 +00:00
|
|
|
(defcustom asm-comment-char ?\;
|
2012-04-09 13:05:48 +00:00
|
|
|
"The comment-start character assumed by Asm mode."
|
1998-01-26 11:29:46 +00:00
|
|
|
:type 'character
|
|
|
|
:group 'asm)
|
1991-12-21 08:23:15 +00:00
|
|
|
|
2003-04-01 23:09:13 +00:00
|
|
|
(defvar asm-mode-syntax-table
|
|
|
|
(let ((st (make-syntax-table)))
|
2006-04-26 07:03:20 +00:00
|
|
|
(modify-syntax-entry ?\n "> b" st)
|
|
|
|
(modify-syntax-entry ?/ ". 124b" st)
|
|
|
|
(modify-syntax-entry ?* ". 23" st)
|
2003-04-01 23:09:13 +00:00
|
|
|
st)
|
1993-05-05 22:47:54 +00:00
|
|
|
"Syntax table used while in Asm mode.")
|
1991-12-21 08:23:15 +00:00
|
|
|
|
|
|
|
(defvar asm-mode-abbrev-table nil
|
1993-05-05 22:47:54 +00:00
|
|
|
"Abbrev table used while in Asm mode.")
|
1991-12-21 08:23:15 +00:00
|
|
|
(define-abbrev-table 'asm-mode-abbrev-table ())
|
|
|
|
|
2003-04-01 23:09:13 +00:00
|
|
|
(defvar asm-mode-map
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
;; Note that the comment character isn't set up until asm-mode is called.
|
|
|
|
(define-key map ":" 'asm-colon)
|
|
|
|
(define-key map "\C-c;" 'comment-region)
|
2003-04-02 16:48:11 +00:00
|
|
|
(define-key map "\C-j" 'newline-and-indent)
|
|
|
|
(define-key map "\C-m" 'newline-and-indent)
|
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.
2010-12-10 20:00:25 +00:00
|
|
|
(define-key map [menu-bar asm-mode] (cons "Asm" (make-sparse-keymap)))
|
|
|
|
(define-key map [menu-bar asm-mode comment-region]
|
2008-04-21 05:02:06 +00:00
|
|
|
'(menu-item "Comment Region" comment-region
|
|
|
|
:help "Comment or uncomment each line in the region"))
|
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.
2010-12-10 20:00:25 +00:00
|
|
|
(define-key map [menu-bar asm-mode newline-and-indent]
|
2008-04-21 05:02:06 +00:00
|
|
|
'(menu-item "Insert Newline and Indent" newline-and-indent
|
|
|
|
:help "Insert a newline, then indent according to major mode"))
|
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.
2010-12-10 20:00:25 +00:00
|
|
|
(define-key map [menu-bar asm-mode asm-colon]
|
2008-04-21 05:02:06 +00:00
|
|
|
'(menu-item "Insert Colon" asm-colon
|
|
|
|
:help "Insert a colon; if it follows a label, delete the label's indentation"))
|
2003-04-01 23:09:13 +00:00
|
|
|
map)
|
1993-05-05 22:47:54 +00:00
|
|
|
"Keymap for Asm mode.")
|
1991-12-21 08:23:15 +00:00
|
|
|
|
1994-10-07 10:07:02 +00:00
|
|
|
(defconst asm-font-lock-keywords
|
2011-04-22 18:44:26 +00:00
|
|
|
(append
|
2006-01-11 14:29:44 +00:00
|
|
|
'(("^\\(\\(\\sw\\|\\s_\\)+\\)\\>:?[ \t]*\\(\\sw+\\(\\.\\sw+\\)*\\)?"
|
|
|
|
(1 font-lock-function-name-face) (3 font-lock-keyword-face nil t))
|
|
|
|
;; label started from ".".
|
|
|
|
("^\\(\\.\\(\\sw\\|\\s_\\)+\\)\\>:"
|
|
|
|
1 font-lock-function-name-face)
|
|
|
|
("^\\((\\sw+)\\)?\\s +\\(\\(\\.?\\sw\\|\\s_\\)+\\(\\.\\sw+\\)*\\)"
|
|
|
|
2 font-lock-keyword-face)
|
|
|
|
;; directive started from ".".
|
|
|
|
("^\\(\\.\\(\\sw\\|\\s_\\)+\\)\\>[^:]?"
|
|
|
|
1 font-lock-keyword-face)
|
|
|
|
;; %register
|
|
|
|
("%\\sw+" . font-lock-variable-name-face))
|
|
|
|
cpp-font-lock-keywords)
|
|
|
|
"Additional expressions to highlight in Assembler mode.")
|
1994-10-07 10:07:02 +00:00
|
|
|
|
1991-12-21 08:23:15 +00:00
|
|
|
;;;###autoload
|
2010-05-15 04:10:22 +00:00
|
|
|
(define-derived-mode asm-mode prog-mode "Assembler"
|
1991-12-21 08:23:15 +00:00
|
|
|
"Major mode for editing typical assembler code.
|
1993-05-05 22:47:54 +00:00
|
|
|
Features a private abbrev table and the following bindings:
|
1991-12-21 08:23:15 +00:00
|
|
|
|
|
|
|
\\[asm-colon]\toutdent a preceding label, tab to next tab stop.
|
|
|
|
\\[tab-to-tab-stop]\ttab to next tab stop.
|
|
|
|
\\[asm-newline]\tnewline, then tab to next tab stop.
|
|
|
|
\\[asm-comment]\tsmart placement of assembler comments.
|
|
|
|
|
|
|
|
The character used for making comments is set by the variable
|
1998-09-23 23:38:11 +00:00
|
|
|
`asm-comment-char' (which defaults to `?\\;').
|
1991-12-21 08:23:15 +00:00
|
|
|
|
1995-03-22 21:31:08 +00:00
|
|
|
Alternatively, you may set this variable in `asm-mode-set-comment-hook',
|
|
|
|
which is called near the beginning of mode initialization.
|
1991-12-21 08:23:15 +00:00
|
|
|
|
1993-05-05 22:47:54 +00:00
|
|
|
Turning on Asm mode runs the hook `asm-mode-hook' at the end of initialization.
|
1991-12-21 08:23:15 +00:00
|
|
|
|
1994-03-22 20:48:30 +00:00
|
|
|
Special commands:
|
2003-04-01 23:09:13 +00:00
|
|
|
\\{asm-mode-map}"
|
1991-12-21 08:23:15 +00:00
|
|
|
(setq local-abbrev-table asm-mode-abbrev-table)
|
2010-05-15 04:10:22 +00:00
|
|
|
(set (make-local-variable 'font-lock-defaults) '(asm-font-lock-keywords))
|
2003-04-02 16:48:11 +00:00
|
|
|
(set (make-local-variable 'indent-line-function) 'asm-indent-line)
|
|
|
|
;; Stay closer to the old TAB behavior (was tab-to-tab-stop).
|
|
|
|
(set (make-local-variable 'tab-always-indent) nil)
|
1995-03-23 20:57:04 +00:00
|
|
|
|
1991-12-21 08:23:15 +00:00
|
|
|
(run-hooks 'asm-mode-set-comment-hook)
|
1995-03-23 20:57:04 +00:00
|
|
|
;; Make our own local child of asm-mode-map
|
|
|
|
;; so we can define our own comment character.
|
|
|
|
(use-local-map (nconc (make-sparse-keymap) asm-mode-map))
|
|
|
|
(local-set-key (vector asm-comment-char) 'asm-comment)
|
2003-04-01 23:09:13 +00:00
|
|
|
(set-syntax-table (make-syntax-table asm-mode-syntax-table))
|
2006-04-26 07:03:20 +00:00
|
|
|
(modify-syntax-entry asm-comment-char "< b")
|
2003-04-01 23:09:13 +00: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.
2010-12-10 20:00:25 +00:00
|
|
|
(set (make-local-variable 'comment-start) (string asm-comment-char))
|
|
|
|
(set (make-local-variable 'comment-add) 1)
|
|
|
|
(set (make-local-variable 'comment-start-skip)
|
|
|
|
"\\(?:\\s<+\\|/[/*]+\\)[ \t]*")
|
|
|
|
(set (make-local-variable 'comment-end-skip) "[ \t]*\\(\\s>\\|\\*+/\\)")
|
|
|
|
(set (make-local-variable 'comment-end) "")
|
2010-05-15 04:10:22 +00:00
|
|
|
(setq fill-prefix "\t"))
|
2003-04-02 16:48:11 +00:00
|
|
|
|
|
|
|
(defun asm-indent-line ()
|
|
|
|
"Auto-indent the current line."
|
|
|
|
(interactive)
|
|
|
|
(let* ((savep (point))
|
|
|
|
(indent (condition-case nil
|
|
|
|
(save-excursion
|
|
|
|
(forward-line 0)
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
(if (>= (point) savep) (setq savep nil))
|
|
|
|
(max (asm-calculate-indentation) 0))
|
|
|
|
(error 0))))
|
|
|
|
(if savep
|
|
|
|
(save-excursion (indent-line-to indent))
|
|
|
|
(indent-line-to indent))))
|
|
|
|
|
|
|
|
(defun asm-calculate-indentation ()
|
|
|
|
(or
|
|
|
|
;; Flush labels to the left margin.
|
|
|
|
(and (looking-at "\\(\\sw\\|\\s_\\)+:") 0)
|
|
|
|
;; Same thing for `;;;' comments.
|
|
|
|
(and (looking-at "\\s<\\s<\\s<") 0)
|
|
|
|
;; Simple `;' comments go to the comment-column.
|
|
|
|
(and (looking-at "\\s<\\(\\S<\\|\\'\\)") comment-column)
|
|
|
|
;; The rest goes at the first tab stop.
|
2014-06-25 23:53:37 +00:00
|
|
|
(or (indent-next-tab-stop 0))))
|
2003-04-02 16:48:11 +00:00
|
|
|
|
1991-12-21 08:23:15 +00:00
|
|
|
(defun asm-colon ()
|
|
|
|
"Insert a colon; if it follows a label, delete the label's indentation."
|
|
|
|
(interactive)
|
2003-04-02 16:48:11 +00:00
|
|
|
(let ((labelp nil))
|
|
|
|
(save-excursion
|
|
|
|
(skip-syntax-backward "w_")
|
|
|
|
(skip-syntax-backward " ")
|
|
|
|
(if (setq labelp (bolp)) (delete-horizontal-space)))
|
|
|
|
(call-interactively 'self-insert-command)
|
|
|
|
(when labelp
|
|
|
|
(delete-horizontal-space)
|
|
|
|
(tab-to-tab-stop))))
|
|
|
|
|
2005-02-09 15:50:47 +00:00
|
|
|
;; Obsolete since Emacs-22.1.
|
2003-04-02 16:48:11 +00:00
|
|
|
(defalias 'asm-newline 'newline-and-indent)
|
1991-12-21 08:23:15 +00:00
|
|
|
|
|
|
|
(defun asm-comment ()
|
|
|
|
"Convert an empty comment to a `larger' kind, or start a new one.
|
|
|
|
These are the known comment classes:
|
|
|
|
|
|
|
|
1 -- comment to the right of the code (at the comment-column)
|
|
|
|
2 -- comment on its own line, indented like code
|
|
|
|
3 -- comment on its own line, beginning at the left-most column.
|
|
|
|
|
|
|
|
Suggested usage: while writing your code, trigger asm-comment
|
|
|
|
repeatedly until you are satisfied with the kind of comment."
|
|
|
|
(interactive)
|
2003-04-02 16:48:11 +00:00
|
|
|
(comment-normalize-vars)
|
|
|
|
(let (comempty comment)
|
|
|
|
(save-excursion
|
|
|
|
(beginning-of-line)
|
2005-07-16 18:41:15 +00:00
|
|
|
(with-no-warnings
|
|
|
|
(setq comment (comment-search-forward (line-end-position) t)))
|
2003-04-02 16:48:11 +00:00
|
|
|
(setq comempty (looking-at "[ \t]*$")))
|
|
|
|
|
1991-12-21 08:23:15 +00:00
|
|
|
(cond
|
|
|
|
|
|
|
|
;; Blank line? Then start comment at code indent level.
|
2003-04-02 16:48:11 +00:00
|
|
|
;; Just like `comment-dwim'. -stef
|
|
|
|
((save-excursion (beginning-of-line) (looking-at "^[ \t]*$"))
|
|
|
|
(indent-according-to-mode)
|
|
|
|
(insert asm-comment-char asm-comment-char ?\ ))
|
|
|
|
|
|
|
|
;; Nonblank line w/o comment => start a comment at comment-column.
|
|
|
|
;; Also: point before the comment => jump inside.
|
|
|
|
((or (null comment) (< (point) comment))
|
1991-12-21 08:23:15 +00:00
|
|
|
(indent-for-comment))
|
|
|
|
|
2003-04-02 16:48:11 +00:00
|
|
|
;; Flush-left or non-empty comment present => just insert character.
|
|
|
|
((or (not comempty) (save-excursion (goto-char comment) (bolp)))
|
1991-12-21 08:23:15 +00:00
|
|
|
(insert asm-comment-char))
|
|
|
|
|
2003-04-02 16:48:11 +00:00
|
|
|
;; Empty code-level comment => upgrade to next comment level.
|
|
|
|
((save-excursion (goto-char comment) (skip-chars-backward " \t") (bolp))
|
|
|
|
(goto-char comment)
|
|
|
|
(insert asm-comment-char)
|
|
|
|
(indent-for-comment))
|
1991-12-21 08:23:15 +00:00
|
|
|
|
2003-04-02 16:48:11 +00:00
|
|
|
;; Empty comment ends non-empty code line => new comment above.
|
1991-12-21 08:23:15 +00:00
|
|
|
(t
|
2003-04-02 16:48:11 +00:00
|
|
|
(goto-char comment)
|
|
|
|
(skip-chars-backward " \t")
|
|
|
|
(delete-region (point) (line-end-position))
|
|
|
|
(beginning-of-line) (insert "\n") (backward-char)
|
|
|
|
(asm-comment)))))
|
1991-12-21 08:23:15 +00:00
|
|
|
|
1997-06-22 18:57:55 +00:00
|
|
|
(provide 'asm-mode)
|
|
|
|
|
1991-12-21 08:23:15 +00:00
|
|
|
;;; asm-mode.el ends here
|