[emacs-berlin] org-babel evaluate elisp for “window changing” functions
gary.phillips at rolmo.com
Thu Jun 27 00:32:40 UTC 2019
Thanks everyone for a great Emacs night which I found very inspiring.
Tonight we looked at a problem I had hit with running Emacs Lisp code
“interactively” inside an org-mode buffer.
This is the best solution I’ve found so far (not yet tried for my example
but it looks good).
We evaluate the following code block and only see the buffer name which
ediff-files creates and not the interactive ediff session we expect.
(ediff-files “foo.s” “bar.s”)
Causing the problem is the Emacs macro ’save-excursion’ which saves and
restores all window settings after executing the code given as its
’save-excursion’ is used by org-babel whenever it evaluates code.
In the case of ediff-files, all the correct buffers and windows are created
but when the setup is finished it returns to save-excursion and everything
is put back as before. [I’ve omitted stuff about the Emacs event loop which
may or may not be recursive.]
Lisp macros are executed and expanded at compile-time and so we can’t just
replace save-excursion with a new temporary function of the same name.
The solution shown on stackexchange is quite complicated because it must
rewrite the ’save-excursion’ macro inside ‘org-babel-execute:emacs-lisp’.
There may be a better solution if we can modify the source code of
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the emacs-berlin