Start to explore `tempo'

This commit is contained in:
Gerard Vermeulen 2022-09-18 21:59:11 +02:00
parent d2142c435e
commit 06651fd2b2

View File

@ -4322,6 +4322,47 @@ code formatter for Python]].
(yas-global-mode +1)))
#+end_src
** [[info:autotype#Tempo][Tempo (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:tempo
:END:
The official [[info:autotype#Tempo][tempo (info)]] documentation is very short and the following links
are obsolete or do not reveal the full power of [[info:autotype#Tempo][tempo (info)]] after its
adaptation to =lexical-binding=:
1. [[https://www.emacswiki.org/emacs/TempoMode][Tempo (Emacs Wiki)]]
2. [[https://www.lysator.liu.se/~davidk/elisp/][David Kågedals elisp]]
3. [[https://github.com/yilkalargaw/emacs-native-snippets][Emacs's Native Snippets]], [[https://www.reddit.com/r/emacs/comments/wdbk34/emacss_native_templating_and_snippet_fuctionality/][Emacs's native templating and snippet functionality]]
Listing [[lst:configure-completing-read-tempo]] shows how to combine =tempo= and
=completing-read= for the builtin =tempo= package that is part of Emacs-28.1 and
later.
#+caption[Configure =tempo= with =completing-read=]:
#+caption: Configure =tempo= with =completing-read=.
#+name: lst:configure-completing-read-tempo
#+begin_src emacs-lisp
(with-eval-after-load 'tempo
(custom-set-variables
'(tempo-interactive t))
(defun tempo-latex-environment-handler (element)
(when-let ((ok (eq element 'latex-environment))
(environment
(completing-read "LaTeX environment: "
(LaTeX-environment-list)
#'always 'require-match)))
`(l "\\begin{" ,environment "}" > n > r n "\\end{" ,environment "}" >)))
(setq tempo-user-elements 'nil)
(cl-pushnew 'tempo-latex-environment-handler tempo-user-elements)
(tempo-define-template
"LaTeX-environment"
'('latex-environment)
"latex-environment"
"Insert a LaTeX environment"))
#+end_src
* [[info:emacs#Display][Display (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:display