]> git.eshelyaron.com Git - emacs.git/commitdiff
(asm-mode): Make a per-buffer child keymap here.
authorRichard M. Stallman <rms@gnu.org>
Thu, 23 Mar 1995 20:57:04 +0000 (20:57 +0000)
committerRichard M. Stallman <rms@gnu.org>
Thu, 23 Mar 1995 20:57:04 +0000 (20:57 +0000)
Use asm-comment-char to specify which character to define.
(asm-mode-map): Don't bind `;' at load time.

lisp/progmodes/asm-mode.el

index b4b83d898487378436638223e9066a1e7da75b26..8b0b26a9bf0d0184dfd518ab645be0e45d185c05 100644 (file)
 ;;
 ;;     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))
 \f
 (defun asm-colon ()
   "Insert a colon; if it follows a label, delete the label's indentation."