From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lawrence Bottorff Subject: Re: local variables to initialize org buffer? Date: Mon, 1 Apr 2019 11:33:50 -0500 Message-ID: References: <87h8bi9qp0.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000008ee94005857a9605" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:48391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAzsr-0000Vn-Q1 for emacs-orgmode@gnu.org; Mon, 01 Apr 2019 12:34:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hAzsq-0003YU-HZ for emacs-orgmode@gnu.org; Mon, 01 Apr 2019 12:34:05 -0400 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]:36319) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hAzsq-0003Xy-0K for emacs-orgmode@gnu.org; Mon, 01 Apr 2019 12:34:04 -0400 Received: by mail-lf1-x12f.google.com with SMTP id d18so6781264lfn.3 for ; Mon, 01 Apr 2019 09:34:03 -0700 (PDT) In-Reply-To: <87h8bi9qp0.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Lawrence Bottorff , emacs-orgmode Mailinglist --0000000000008ee94005857a9605 Content-Type: text/plain; charset="UTF-8" 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 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 > --0000000000008ee94005857a9605 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable




On Sunday, 31 Mar 2019 at 21:0= 5, 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 L= isp
> source code blocks. I guess
>
> Local Variables:
>=C2=A0 eval: (elisp-function)
>=C2=A0 End:
>
> is discouraged.

It is discouraged but not disallowed.=C2=A0 I use this:

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

where

#+begin_src emacs-lisp
=C2=A0 (defun esf/execute-startup-block ()
=C2=A0 =C2=A0 (interactive)
=C2=A0 =C2=A0 (org-babel-goto-named-src-block "startup")
=C2=A0 =C2=A0 (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).=C2=A0 It is incumbent on me knowing<= br> 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
--0000000000008ee94005857a9605--