Add an appendix on call-with-* style macros for later investigation

This commit is contained in:
Gerard Vermeulen 2023-12-24 11:39:57 +01:00
parent 71a1ac3fb7
commit 1fa140fa79
1 changed files with 25 additions and 0 deletions

View File

@ -2175,6 +2175,31 @@ Item 5 is ?
(HOW DO YOU DO ?)
#+end_src
* [[http://random-state.net/log/3390120648.html][Why I like CALL-WITH-* style in macros]]
:PROPERTIES:
:CUSTOM_ID: sec:call-with-macros
:END:
Listing [[lst]] The post [[https://lists.gnu.org/archive/html/emacs-devel/2023-12/msg00683.html][João Távora: permanently fix org breakage during builds]]
links to the origin of the code in listing [[lst:call-with-macros]].
BUG: make a concrete ~CALL-WITH-*~ macro example.
#+caption[Abstract "CALL-WITH-*" macro example]:
#+caption: Abstract ~CALL-WITH-*~ macro example.
#+caption: with variable clauses, exit clauses, and a body.
#+name: lst:call-with-macros
#+begin_src emacs-lisp -n :eval never
(defmacro with-foo ((foo) &body body)
`(call-with-foo (lambda (,foo) ,@body)))
(defun call-with-foo (function)
(let (foo)
(unwind-protect
(funcall function (setf foo (get-foo)))
(when foo (release-foo foo)))))
#+end_src
* Local variables :noexport:
# Emacs looks for "Local variables:" after the last "newline-formfeed".