Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tempo-template functions accept optional arg but fail when one is passed #26

Open
pierre-rouleau opened this issue Feb 6, 2023 · 2 comments

Comments

@pierre-rouleau
Copy link

Most interactive functions are tempo-template functions. Help on these functions report that they support the optional arg but if one uses the optional arg (by typing C-u, for example) the function reports:

Wrong type argument: number-or-market-p nil

For example, I bound <f12> b to tempo-template-adoc-strong. The help shows:

<f12> b runs the command tempo-template-adoc-strong (found in adoc-mode-map),
which is an interactive Lisp function.

It is bound to <f12> b, <menu-bar> <AsciiDoc> <Templates / cheat
sheet> <Text formatting - constrained quotes> <*Strong*>.

(tempo-template-adoc-strong &optional ARG)

Usually rendered bold

This is not really a big deal, but it'd be interesting to see a solution given that the code uses tempo templates.

@bbatsov
Copy link
Owner

bbatsov commented Feb 7, 2023

I never got to playing with tempo, as I wasn't sure if that's still relevant today given there are a few newer alternatives around (e.g. #19)

@pierre-rouleau
Copy link
Author

pierre-rouleau commented Feb 7, 2023

As I said, the issue is not a priority. There's no need to use arguments for these simple templates anyway. And I did not look at the code more than to see what was available.

tempo templates, if someone knows elisp, are quite nice once you need to be able to provide templates that 'auto-adjust' to various situations and have logic in them. For simple text insertion it's overkill IMO. But that's the way it was written. I'm using tempo templates in various ways to create programmable file headers for several languages. It could probably be done with the more popular templating system, but doing it with tempo allows writing them in elisp.

I wrote some for C, C++, Erlang. In Erlang it's quite useful to create the boiler plate code while leaving control via some user-options. I provide these in the PEL project I wrote (mainly as a way to learn Emacs and to keep my environment free from corporate swallowing):
See:

For the code:

I normally bind the templates I use often to key bindings so I can create the boiler plate code quickly. Once a template is created and there's several areas to fill, there are key bindings to navigate through the locations that must be filled.

For the Erlang tempo templates, you can take a look at the PDF-based documentation for the key bidings in my ststem at: https://raw.githubusercontent.com/pierre-rouleau/pel/master/doc/pdf/pl-erlang.pdf#page=13 . It's best to look at it on a browser that renders the PDF.

BTW, thanks for mentioning tempel, it does look good.

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

No branches or pull requests

2 participants