markdown-mode has been included (bug #435631) in the emacs-goodies-el package, in the 27.0-1 revision.
debootstrap is written in shell, and the principal points of
interest, debootstrap, functions, and scripts/debian/sid are several
hundreds lines each, the last ones being sourced by the first one.
Emacs is supposed to be great, let's look at etags, the Emacs flavour of
exuberant ctags. It generates a TAGS file
which is then used by Emacs when M-. is pressed, to search for the current
word (at the point). etags supports many languages, but I first thought shell
was missing. Hopefully, it is possible to add
support for new languages, which
can be done using two methods: either pass some regexps to etags, or implement
a new parser and recompile etags after having added it to the Makefile.
The first method was sufficient here, since debootstrap's code is quite well
indented, and at first glance, every function is declared using the following:
left-aligned, possibly followed by whitespaces, followed by (possibly spaced)
parentheses, possibly followed by whitespaces, possibly followed by an opening
brace. That is:
'/^([a-zA-Z0-9_]+)[ \t]*[(][ \t]*[)][ \t]*[{]*[ \t]*/\1/'
One could have used two regexps (using --regex-$LANG twice) to accept only
the following, which would have been sufficient, given the current source
files:
'/^([a-zA-Z0-9_]+) [(][)] [{]/\1/'
'/^([a-zA-Z0-9_]+)[(][)]/\1/'
Now, it is sufficient to add a tags: target to the Makefile, running etags
on the interesting files, defining a new language kibishell (so as to void
possible clash with future well-featured shell modes), forcing it for the
specified files (since they have no extension, it is not possible to use
--langmap=kibishell:.sh).
Added Makefile fragment:
tags:
etags \
--totals \
--langdef=kibishell \
--regex-kibishell='/^([a-zA-Z0-9_]+)[ \t]*[(][ \t]*[)][ \t]*[{]*[ \t]*/\1/' \
--language-force=kibishell \
debootstrap functions scripts/debian/sid
Usage within Emacs:
M-.: search for a definition;M-O M-.: next definition;M-*: go back to the starting point;M-x visit-tags-table: change the reference file.
Now that I can read that sh is supported, it is sufficient to drop --langdef
and --regex-kibishell, and to adjust --language-force. Here it is: not that
bad after all, only 6 symbols were missing, on a total of 63.
A last word on etags: it accepts -x so that a cross reference is written to
the standard output, in the cxref
format.
Hopefully there is a markdown-mode for Emacs, but it isn't packaged (yet). After a quick ITP (bug #435485), and having having asked around, it turned out that pushing it into the emacs-goodies-el package would be the right thing.
It was sufficient to follow the instructions in 00AddingFiles to get
an updated package, with a functional and documented (README.Debian,
debian/control, Texinfo manual) markdown-mode for at least both
emacs21 and emacs22, hence the wishlist bug (bug #435631).
Having a look at the other wishlist bugs, some might be of some interest, and a patch could be forged to make them available and ease the packagers' workload:
showspace.el (bug #422876): highlight various spaces, tabs, etc.
graphviz-dot-mode.el (bug #428601): major mode for the graphviz dot format. Yay!
Other wishlist bugs, which have to be inspected a bit: bug #336398, bug #314664, bug #228550. (They might have seen no answer in 2 years, or be waiting for an answer from upstream, etc.)
Nice modes already included in emacs-goodies-el:
color-select: nice colors include Arjen, Billw, Calm Forest, Cheap Goldenrod, Clarity and Beauty, Comidia, Dark Laptop, TTY Dark, White on Black.
Emacs is said to do The Right Thing, but it looks like that is not the case for
Perl. It defaults to perl-mode, which can be hopefully replaced by
cperl-mode, with some additional lines in the ~/.emacs configuration file.
;; We always prefer CPerl mode to Perl mode.
(fset 'perl-mode 'cperl-mode)
;; When starting load my hooks
(add-hook 'cperl-mode-hook 'my-cperl-mode-hook t)
;; Ensure we use PerlStyle
(defun my-cperl-mode-hook ()
(cperl-set-style "PerlStyle")