Function: asm-mode

asm-mode is an autoloaded, interactive and byte-compiled function defined in asm-mode.el.gz.

Signature

(asm-mode)

Documentation

Major mode for editing typical assembler code.

Features a private abbrev table and the following bindings:

M-x asm-colon (asm-colon) outdent a preceding label, tab to next tab stop.
M-i (tab-to-tab-stop) tab to next tab stop.
M-x newline-and-indent (newline-and-indent) newline, then tab to next tab stop.
M-x asm-comment (asm-comment) smart placement of assembler comments.

The character used for making comments is set by the variable asm-comment-char (which defaults to ?\;). Alternatively, you may set this variable in asm-mode-hook.

Turning on Asm mode runs the hook asm-mode-hook at the end of initialization.

Special commands:
: asm-colon
C-c ; comment-region

Probably introduced at or before Emacs version 19.29.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/asm-mode.el.gz
;;;###autoload
(define-derived-mode asm-mode prog-mode "Assembler"
  "Major mode for editing typical assembler code.
Features a private abbrev table and the following bindings:

\\[asm-colon]\toutdent a preceding label, tab to next tab stop.
\\[tab-to-tab-stop]\ttab to next tab stop.
\\[newline-and-indent]\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
`asm-comment-char' (which defaults to `?\\;').
Alternatively, you may set this variable in `asm-mode-hook'.

Turning on Asm mode runs the hook `asm-mode-hook' at the end of initialization.

Special commands:
\\{asm-mode-map}"
  :after-hook
  (progn
    ;; Make our own local child of `asm-mode-map'
    ;; so we can define our own comment character.
    ;; FIXME: Use `post-self-insert-hook' instead and make it conditional
    ;; on some "electricity" config var.
    (unless (lookup-key asm-mode-map (vector asm-comment-char))
      (use-local-map (make-composed-keymap nil asm-mode-map))
      (local-set-key (vector asm-comment-char) #'asm-comment))
    (set-syntax-table (make-syntax-table asm-mode-syntax-table))
    (modify-syntax-entry	asm-comment-char "< b")

    (unless (local-variable-p 'comment-start)
      (setq-local comment-start (string asm-comment-char))))

  (setq local-abbrev-table asm-mode-abbrev-table)
  (setq-local font-lock-defaults '(asm-font-lock-keywords))
  (setq-local indent-line-function #'asm-indent-line)
  ;; Stay closer to the old TAB behavior (was tab-to-tab-stop).
  (setq-local tab-always-indent nil)

  (run-hooks 'asm-mode-set-comment-hook)

  (setq-local comment-add 1)
  (setq-local comment-start-skip "\\(?:\\s<+\\|/[/*]+\\)[ \t]*")
  (setq-local comment-end-skip "[ \t]*\\(\\s>\\|\\*+/\\)")
  (setq-local comment-end ""))