Skip to content

Fix the AsciiDoc menu and tempo templates - #94

Merged
bbatsov merged 4 commits into
masterfrom
fix-menu-and-templates
Oct 7, 2026
Merged

bbatsov merged 4 commits into
masterfrom
fix-menu-and-templates

Conversation

@bbatsov

@bbatsov bbatsov commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Four menu entries pointed at commands that don't exist, the templates' docstrings never picked up the AsciiDoc help text, the trademark and dash templates inserted text Asciidoctor doesn't replace, and a lambda this-command broke the templates and even loading the mode.

The comment menu entry is now backed by a small adoc-insert-comment command rather than a plain template: a // comment has to start in the first column, which neither a tempo template wrapping the region nor comment-region does for every line.

The Macros submenu bound `adoc-xref', `adoc-xref-default-syntax' and
`adoc-image', none of which exist (the commands are the
tempo-template-adoc-* ones), and `tempo-template-adoc-comment', which
was never defined. The 0.9.0 cleanup of the menu missed them.

The comment entry now runs adoc-insert-comment: with a region it puts
`// ' at the start of each of its lines (an AsciiDoc comment has to
start in the first column, which comment-region doesn't guarantee),
and without one it inserts a comment line through a new adoc-comment
template. Also add the comma the "Passthrough macros" :help was
missing, so it shows the help text instead of a symbol name.
Each template passed (bound-and-true-p adoc-help-*) as its docstring,
evaluated when the template was defined. adoc-mode required
adoc-mode-tempo before defining those constants, and byte-compiling
adoc-mode.el (which package.el does in the running Emacs on install)
loads the templates without evaluating them either, so every template
ended up with tempo's generic "Insert a adoc-..." docstring.

Pass the variable instead and read it when the docstring is asked for,
through the function-documentation property, so the load order no
longer matters.
Their menu entries read "(TM) -> ™" and "-- -> —", but the templates
inserted `(T)' and `---', neither of which Asciidoctor replaces.
adoc-tempo-on-region called (symbol-name this-command), which signals
when the command is a lambda: a key bound to a lambda, a hydra head or
a transient suffix. Every template using `bol', `tr' or `r-or-n' broke
then, and so did loading adoc-mode, as building the menu runs the title
templates.
@bbatsov
bbatsov force-pushed the fix-menu-and-templates branch from 8e69e3d to 9ab42a6 Compare October 7, 2026 17:16
@bbatsov
bbatsov merged commit 3ea0430 into master Oct 7, 2026
8 checks passed
@bbatsov
bbatsov deleted the fix-menu-and-templates branch October 7, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant