| git.druid.rocks | index | druid520 | radium | radium-lang-asm.el |
radium-lang-asm.el
;;; radium-lang-asm.el, at&t syntax assembly -*- lexical-binding: t; -*-
(require 'asm-mode)
(setq asm-comment-char ?\#)
(add-hook 'asm-mode-hook
(lambda ()
(setq indent-tabs-mode t
tab-width 8)
(setq-local imenu-generic-expression
'((nil "^\\([A-Za-z_.][A-Za-z0-9_.]*\\):" 1)))
;; asm-mode's own body (which runs on every activation,
;; after this hook variable is even consulted for a
;; plain add-hook - so this has to be a `local-set-key'
;; here, not a `define-key' on the shared asm-mode-map at
;; load time, or asm-mode's own local-set-key for the same
;; key just overrides it again) binds the comment char
;; itself to asm-comment, not plain self-insertion - it
;; pads out to comment-column, but that column slides to
;; match wherever the *nearest* existing comment already
;; sits (an earlier long code line, or one manually placed
;; far right), not a fixed value. at tab-width 8, catching
;; up to a distant column from a short line means many tab
;; characters - reproduced directly: a 57-column code line
;; followed by a 4-column "hlt " line, and the second "#"
;; alone inserted 7 tabs. my style is a plain single-tab
;; gap per line, not cross-line alignment, so # just
;; self-inserts.
(local-set-key (vector asm-comment-char) #'self-insert-command)))
(add-to-list 'auto-mode-alist '("\\.s\\'" . asm-mode))
(provide 'radium-lang-asm)