changeset 11105:8963d6de6f07

(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.
author Richard M. Stallman <rms@gnu.org>
date Thu, 23 Mar 1995 20:57:04 +0000
parents ef10b4684bb5
children 30ec7c9dcdb9
files lisp/progmodes/asm-mode.el
diffstat 1 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/asm-mode.el	Thu Mar 23 20:40:48 1995 +0000
+++ b/lisp/progmodes/asm-mode.el	Thu Mar 23 20:57:04 1995 +0000
@@ -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 @@
 "
   (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 @@
   (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 @@
   (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."