A major mode for GNU Emacs to handle assembly language source files
gas-mode.el is a major mode
for GNU Emacs, currently being tested.
- I'll publish from time to time updated versions here.
- Assembler programmers seem to be a rather endangered species
these days, not many of them being left, so - at least for now - I'm
taking gnu.emacs.sources and emacs-devel off the list which used to
be here describing where you are notified about new versions. Just
step by here from time to time.
The plan of making gas-mode a part of GNU Emacs (as
suggested by its creator, RMS), replacing the current asm-mode, is
still there. However, it is far from being on top of my ToDo list,
and unless it turns out to be a real user demand, I'm not planning
to actively force it.
- The name `gas-mode' is somewhat misleading; gas-mode is not more
specific to the GNU gas assembler as is the current asm-mode,
i.e. not at all. For users of asm-mode, a switch to gas-mode
should be rather painless, at least if your comment character is
at its standard value, the semicolon (;). I'm still lacking
reports about how it works for other comment lead-in characters.
There are so many assembler syntaxes around, I can't test them all
under real world conditions.
- Any input about gas-mode is welcome. Please understand that
I cannot answer questions like why that special assembler mnemonic
in your application doesn't work out as expected. This is far
outside the scope of an editing mode. Apart from that, I'll try to
provide you with a timely response.
- gas-mode is a new mode, written from scratch, since asm-mode
turned out to be not too useful for my needs. It handles the usual
features like highlighting and proper comment handling as you'd
expect. Some of its special features include:
- code rearrangement ("beautifying"): The fill-paragraph
command, when issued on a code line, will rearrange all fields
(columns) in the code block around point which are out of
position, adjusting their locations to fit the (customizable)
predefined field start columns best.
- comment filling: fill-paragraph, when issued within a comment,
will recognize the current paragraph and adopt to the comment style
when the result needs comment lines to be inserted or removed.
- symbol highlighting: when point rests on a symbol which is
also defined or referenced elsewhere in the same buffer, it
gets highlighted and you can move forward and backward between
its definitions and the references with forward-sexp and
backward-sexp. This is different from a simple string search
in that only those places are considered where the symbol gets
actually used by your code. For local labels, gas-mode
resolves which references are associated with which location
and only highlights and jumps between those that fit, even if
they're overlapping. Highlight colors differ for different
types of references. Foreground color changes if none or more
than one definition is available in the current buffer as long
as point is on such a symbol.
- If you'd like to move C style declarations of assembly
language functions from a .h file which has to be maintained
separately into the .S file near the function and let make do
the rest, have a look at the start of gas-mode.el (look for
C pass-through'). If you're targeting a mixed
C/Assembler language environment where you get disastrous
results when your assembler file isn't in sync with its .h
definitions, or maybe you're already using some kind of
embedding C definitions into your asm files for later
extraction - it's just about proper syntax
and symbol highlighting, but chances are you'll like it.
- Mail your bug reports, comments, suggestions etc. to
(most recent version first):
need to right-click the link and select "Save as". Gunzip the
downloaded file, rename it to gas-mode.el and put it into one of
the directories in your load path. Have a look at the comments
at the start of the file for more.
Current versions can expected to be pretty stable, but be prepared
for some occasional bug showing up.