1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

(asm-mode): Make a per-buffer child keymap here.

Use asm-comment-char to specify which character to define.
(asm-mode-map): Don't bind `;' at load time.
This commit is contained in:
Richard M. Stallman 1995-03-23 20:57:04 +00:00
parent e7d795eba3
commit f45a220ab3

View file

@ -33,12 +33,13 @@
;;
;; TAB tab to next tab stop
;; : outdent preceding label, tab to tab stop
;; ; place or move comment
;; 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.
;; C-j, C-m newline and tab to tab stop
;;
;; Code is indented to the first tab stop level.
;; The ; key inserts copies of the value of asm-comment-char at an
;; appropriate spot.
;; This mode runs two hooks:
;; 1) An asm-mode-set-comment-hook before the part of the initialization
@ -63,7 +64,7 @@
(if asm-mode-map
nil
(setq asm-mode-map (make-sparse-keymap))
(define-key asm-mode-map ";" 'asm-comment)
;; Note that the comment character isn't set up until asm-mode is called.
(define-key asm-mode-map ":" 'asm-colon)
(define-key asm-mode-map "\C-i" 'tab-to-tab-stop)
(define-key asm-mode-map "\C-j" 'asm-newline)
@ -103,7 +104,6 @@ Special commands:
"
(interactive)
(kill-all-local-variables)
(use-local-map asm-mode-map)
(setq mode-name "Assembler")
(setq major-mode 'asm-mode)
(setq local-abbrev-table asm-mode-abbrev-table)
@ -112,7 +112,13 @@ Special commands:
(make-local-variable 'asm-mode-syntax-table)
(setq asm-mode-syntax-table (make-syntax-table))
(set-syntax-table asm-mode-syntax-table)
(run-hooks 'asm-mode-set-comment-hook)
;; 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)
(modify-syntax-entry asm-comment-char
"<" asm-mode-syntax-table)
(modify-syntax-entry ?\n
@ -131,9 +137,7 @@ Special commands:
(make-local-variable 'comment-column)
(setq comment-column 32)
(setq fill-prefix "\t")
(run-hooks 'asm-mode-hook)
)
(run-hooks 'asm-mode-hook))
(defun asm-colon ()
"Insert a colon; if it follows a label, delete the label's indentation."