summaryrefslogtreecommitdiff
path: root/lisp/progmodes/asm-mode.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-03-23 20:57:04 +0000
committerRichard M. Stallman <rms@gnu.org>1995-03-23 20:57:04 +0000
commitf45a220ab3d935ff660af355c2830ea503c09d22 (patch)
treef6fadfb38bd01a2f0c42ad10ee5aacec7dff1de1 /lisp/progmodes/asm-mode.el
parente7d795eba3ecce4aeab7df63d67f399cc319d389 (diff)
downloademacs-f45a220ab3d935ff660af355c2830ea503c09d22.tar.gz
emacs-f45a220ab3d935ff660af355c2830ea503c09d22.tar.bz2
emacs-f45a220ab3d935ff660af355c2830ea503c09d22.zip
(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.
Diffstat (limited to 'lisp/progmodes/asm-mode.el')
-rw-r--r--lisp/progmodes/asm-mode.el20
1 files changed, 12 insertions, 8 deletions
diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el
index b4b83d89848..8b0b26a9bf0 100644
--- a/lisp/progmodes/asm-mode.el
+++ b/lisp/progmodes/asm-mode.el
@@ -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."