diff options
| author | Richard M. Stallman | 1995-03-23 20:57:04 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-03-23 20:57:04 +0000 |
| commit | f45a220ab3d935ff660af355c2830ea503c09d22 (patch) | |
| tree | f6fadfb38bd01a2f0c42ad10ee5aacec7dff1de1 | |
| parent | e7d795eba3ecce4aeab7df63d67f399cc319d389 (diff) | |
| download | emacs-f45a220ab3d935ff660af355c2830ea503c09d22.tar.gz 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.
| -rw-r--r-- | lisp/progmodes/asm-mode.el | 20 |
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 @@ | |||
| 33 | ;; | 33 | ;; |
| 34 | ;; TAB tab to next tab stop | 34 | ;; TAB tab to next tab stop |
| 35 | ;; : outdent preceding label, tab to tab stop | 35 | ;; : outdent preceding label, tab to tab stop |
| 36 | ;; ; place or move comment | 36 | ;; comment char place or move comment |
| 37 | ;; asm-comment-char specifies which character this is; | ||
| 38 | ;; you can use a different character in different | ||
| 39 | ;; Asm mode buffers. | ||
| 37 | ;; C-j, C-m newline and tab to tab stop | 40 | ;; C-j, C-m newline and tab to tab stop |
| 38 | ;; | 41 | ;; |
| 39 | ;; Code is indented to the first tab stop level. | 42 | ;; Code is indented to the first tab stop level. |
| 40 | ;; The ; key inserts copies of the value of asm-comment-char at an | ||
| 41 | ;; appropriate spot. | ||
| 42 | 43 | ||
| 43 | ;; This mode runs two hooks: | 44 | ;; This mode runs two hooks: |
| 44 | ;; 1) An asm-mode-set-comment-hook before the part of the initialization | 45 | ;; 1) An asm-mode-set-comment-hook before the part of the initialization |
| @@ -63,7 +64,7 @@ | |||
| 63 | (if asm-mode-map | 64 | (if asm-mode-map |
| 64 | nil | 65 | nil |
| 65 | (setq asm-mode-map (make-sparse-keymap)) | 66 | (setq asm-mode-map (make-sparse-keymap)) |
| 66 | (define-key asm-mode-map ";" 'asm-comment) | 67 | ;; Note that the comment character isn't set up until asm-mode is called. |
| 67 | (define-key asm-mode-map ":" 'asm-colon) | 68 | (define-key asm-mode-map ":" 'asm-colon) |
| 68 | (define-key asm-mode-map "\C-i" 'tab-to-tab-stop) | 69 | (define-key asm-mode-map "\C-i" 'tab-to-tab-stop) |
| 69 | (define-key asm-mode-map "\C-j" 'asm-newline) | 70 | (define-key asm-mode-map "\C-j" 'asm-newline) |
| @@ -103,7 +104,6 @@ Special commands: | |||
| 103 | " | 104 | " |
| 104 | (interactive) | 105 | (interactive) |
| 105 | (kill-all-local-variables) | 106 | (kill-all-local-variables) |
| 106 | (use-local-map asm-mode-map) | ||
| 107 | (setq mode-name "Assembler") | 107 | (setq mode-name "Assembler") |
| 108 | (setq major-mode 'asm-mode) | 108 | (setq major-mode 'asm-mode) |
| 109 | (setq local-abbrev-table asm-mode-abbrev-table) | 109 | (setq local-abbrev-table asm-mode-abbrev-table) |
| @@ -112,7 +112,13 @@ Special commands: | |||
| 112 | (make-local-variable 'asm-mode-syntax-table) | 112 | (make-local-variable 'asm-mode-syntax-table) |
| 113 | (setq asm-mode-syntax-table (make-syntax-table)) | 113 | (setq asm-mode-syntax-table (make-syntax-table)) |
| 114 | (set-syntax-table asm-mode-syntax-table) | 114 | (set-syntax-table asm-mode-syntax-table) |
| 115 | |||
| 115 | (run-hooks 'asm-mode-set-comment-hook) | 116 | (run-hooks 'asm-mode-set-comment-hook) |
| 117 | ;; Make our own local child of asm-mode-map | ||
| 118 | ;; so we can define our own comment character. | ||
| 119 | (use-local-map (nconc (make-sparse-keymap) asm-mode-map)) | ||
| 120 | (local-set-key (vector asm-comment-char) 'asm-comment) | ||
| 121 | |||
| 116 | (modify-syntax-entry asm-comment-char | 122 | (modify-syntax-entry asm-comment-char |
| 117 | "<" asm-mode-syntax-table) | 123 | "<" asm-mode-syntax-table) |
| 118 | (modify-syntax-entry ?\n | 124 | (modify-syntax-entry ?\n |
| @@ -131,9 +137,7 @@ Special commands: | |||
| 131 | (make-local-variable 'comment-column) | 137 | (make-local-variable 'comment-column) |
| 132 | (setq comment-column 32) | 138 | (setq comment-column 32) |
| 133 | (setq fill-prefix "\t") | 139 | (setq fill-prefix "\t") |
| 134 | (run-hooks 'asm-mode-hook) | 140 | (run-hooks 'asm-mode-hook)) |
| 135 | ) | ||
| 136 | |||
| 137 | 141 | ||
| 138 | (defun asm-colon () | 142 | (defun asm-colon () |
| 139 | "Insert a colon; if it follows a label, delete the label's indentation." | 143 | "Insert a colon; if it follows a label, delete the label's indentation." |