In asm-mode
, C-hk; reports that ; is bound to asm-comment
.
The Commentary for asm-mode.el
(M-x find-library
RET asm-mode
RET) says:
This minor mode is based on text mode. It defines a private abbrev table
that can be used to save abbrevs for assembler mnemonics. It binds just
five keys:
TAB tab to next tab stop
: outdent preceding label, tab to tab stop
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.
This mode runs two hooks:
1) An asm-mode-set-comment-hook before the part of the initialization
depending on asm-comment-char, and
2) an asm-mode-hook at the end of initialization.
So the variable asm-comment-char
defines the comment character, and the mode uses this value to bind the associated key to the asm-comment
command (i.e. "place or move comment").
You can configure this value globally via M-x customize-option
RET asm-comment-char
RET
Exactly how this feature works is entirely up to how the mode is written. In this case I can see that when the asm-mode
function is called it generates a new local keymap for the buffer which inherits from asm-mode-map
, and it defines the comment key in there.
Immediately before it does that it runs asm-mode-set-comment-hook
, so one could also set a value for asm-comment-char
(potentially a buffer-local value) using that hook, instead of customizing the option globally.
All of this commenting configuration happens when the asm-mode
function runs, so changing the global value doesn't affect existing asm-mode
buffers; but you could just run M-x asm-mode
in a buffer to get it to pick on on a change to asm-comment-char
, or you could revert the buffer(s), or re-visit them.
e.g.:
- M-x
revert-buffer
- or kill the buffer and re-visit it
- or use something like M-x
ibuffer
to mark and revert buffers en-masse
In ibuffer
that would be *M asm-mode
RET to mark, and V to revert.
Note that the way the keymap is generated means that each asm-mode
buffer has its own independent comment key binding, so reverting a single buffer will not affect the pre-existing comment bindings in other asm-mode
buffers, so reverting them all after a change to the global comment char option would make sense.
asm-mode
?asm-mode
I see thatC-h k ;
reports that;
is bound toasm-comment
. Presumably;
is not a comment in the language being used here.M-x customize-option RET asm-comment-char
would deal to that. (That might well not be the only misconfiguration for this language, however.)asm-comment-char
tells the mode which key to bind to theasm-comment
command, so typing/
should now do the commenting action, and typing;
should insert a semicolon. You might need to revert your existing asm-mode buffers for that change to be picked up?