Clean up the `tempo' setup

This commit is contained in:
Gerard Vermeulen 2023-03-06 13:18:46 +01:00
parent d25d366530
commit bcfa2eba72

View File

@ -2054,6 +2054,7 @@ list detailing and motivating each listing:
(gnuplot . ,(fboundp 'gnuplot-mode))
(js . t)
(latex . t)
(lilypond . ,(fboundp 'lilypond-mode))
(lisp . t)
(lua . ,(fboundp 'lua-mode))
(maxima . ,(fboundp 'maxima-mode))
@ -2074,18 +2075,7 @@ list detailing and motivating each listing:
ol-info
org-id
org-protocol
org-tempo)
org-structure-template-alist '(("a" . "export ascii")
("c" . "center")
("C" . "comment")
("e" . "example")
("E" . "export")
("h" . "export html")
("l" . "export latex")
("q" . "quote")
("s" . "src")
("p" . "src python -n -i :session")
("v" . "verse"))))
org-tempo)))
#+end_src
#+caption[Setup =org-babel=]:
@ -5716,7 +5706,7 @@ Listing [[lst:configure-tempo-latex-completing-read]] shows how to combine =temp
#+caption: Configure =tempo= user-interface.
#+name: lst:configure-tempo-ui
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'tempo
(when (require 'tempo nil 'noerror)
(setopt tempo-interactive t)
(with-eval-after-load 'marginalia
@ -5750,9 +5740,6 @@ Allows `tempo' expansion by typing <SPC> after a complete `tempo' tag."
(unless (abbrev-symbol (car tag) abbrev-table)
(define-abbrev abbrev-table
(car tag) 1 'abbrev-tempo-expand-if-complete)))))
(with-eval-after-load 'org
(add-hook 'org-mode-hook 'setup-local-tempo-key-bindings))
#+end_src
#+caption[Configure =tempo= for =latex= with =completing-read=]:
@ -5764,12 +5751,11 @@ Allows `tempo' expansion by typing <SPC> after a complete `tempo' tag."
(require 'tempo))
(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 "}" >)))
(when (eq element 'latex-environment)
(let ((environment (completing-read "LaTeX environment: "
(LaTeX-environment-list)
#'always 'require-match)))
`(l "\\begin{" ,environment "}" > n > r n "\\end{" ,environment "}" >))))
(cl-pushnew 'tempo-latex-environment-handler tempo-user-elements)