emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] local variables to initialize org buffer?


From: Lawrence Bottorff
Subject: Re: [O] local variables to initialize org buffer?
Date: Mon, 1 Apr 2019 11:33:50 -0500

I've got this in my config.org , which is called by my init.el:

#+begin_src emacs-lisp
  (defun borgauf/execute-startup-block ()
    (interactive)
    (progn (org-babel-goto-named-src-block "startup")
   (org-babel-execute-src-block)))
#+end_src

then in my org-mode file I have this at the bottom:

* Comments

#+name: startup
#+BEGIN_SRC emacs-lisp :results silent
;(progn (slime) (org-babel-execute-buffer))
(slime)
(org-babel-execute-buffer)
#+END_SRC

# Local Variables:
# eval: (borgauf/execute-startup-block)
# End:

This is starting the slime repl just fine, but not doing the (org-babel-execute-buffer). I can then manually run C-c C-v b and it indeed runs all the code blocks. So, I'm guessing that after the (slime) is performed, it doesn't return focus to my calling org-mode buffer and the (org-babel-execute-buffer) is running to no avail in the slime repl buffer?



On Mon, Apr 1, 2019 at 1:37 AM Eric S Fraga <address@hidden> wrote:
On Sunday, 31 Mar 2019 at 21:05, Lawrence Bottorff wrote:
> I'm trying to figure out how to start up slime and do
> org-babel-execute-buffer when I open a certain org-mode file full of Lisp
> source code blocks. I guess
>
> Local Variables:
>  eval: (elisp-function)
>  End:
>
> is discouraged.

It is discouraged but not disallowed.  I use this:

# eval: (esf/execute-startup-block)

where

#+begin_src emacs-lisp
  (defun esf/execute-startup-block ()
    (interactive)
    (org-babel-goto-named-src-block "startup")
    (org-babel-execute-src-block))
#+end_src

which will execute any org src block named startup whenever I visit the
file (but with confirmation required).  It is incumbent on me knowing
that the src block is safe to execute and I only say yes for files that
are mine.

--
Eric S Fraga via Emacs 27.0.50, Org release_9.2.2-324-gd58827

reply via email to

[Prev in Thread] Current Thread [Next in Thread]