emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* local variables to initialize org buffer?
@ 2019-04-01  2:05 Lawrence Bottorff
  2019-04-01  2:33 ` Berry, Charles
  2019-04-01  6:37 ` Eric S Fraga
  0 siblings, 2 replies; 6+ messages in thread
From: Lawrence Bottorff @ 2019-04-01  2:05 UTC (permalink / raw)
  To: emacs-orgmode Mailinglist

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

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. So I looked at in buffer settings
<https://orgmode.org/manual/In_002dbuffer-settings.html>, but I don't see
anything specific to actually running elisp functions -- unless I'm missing
something. Advice?

LB

[-- Attachment #2: Type: text/html, Size: 601 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: local variables to initialize org buffer?
  2019-04-01  2:05 local variables to initialize org buffer? Lawrence Bottorff
@ 2019-04-01  2:33 ` Berry, Charles
  2019-04-01  3:59   ` Lawrence Bottorff
  2019-04-01  6:37 ` Eric S Fraga
  1 sibling, 1 reply; 6+ messages in thread
From: Berry, Charles @ 2019-04-01  2:33 UTC (permalink / raw)
  To: Lawrence Bottorff; +Cc: emacs-orgmode Mailinglist

Will `org-babel-load-file' suffice?

HTH,

Chuck

> On Mar 31, 2019, at 7:05 PM, Lawrence Bottorff <borgauf@gmail.com> 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. So I looked at in buffer settings, but I don't see anything specific to actually running elisp functions -- unless I'm missing something. Advice?
> 
> LB

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: local variables to initialize org buffer?
  2019-04-01  2:33 ` Berry, Charles
@ 2019-04-01  3:59   ` Lawrence Bottorff
  2019-04-01 16:13     ` Berry, Charles
  0 siblings, 1 reply; 6+ messages in thread
From: Lawrence Bottorff @ 2019-04-01  3:59 UTC (permalink / raw)
  To: Berry, Charles; +Cc: emacs-orgmode Mailinglist

[-- Attachment #1: Type: text/plain, Size: 676 bytes --]

Sure, but how should it be implemented?

On Sun, Mar 31, 2019 at 9:33 PM Berry, Charles <ccberry@ucsd.edu> wrote:

> Will `org-babel-load-file' suffice?
>
> HTH,
>
> Chuck
>
> > On Mar 31, 2019, at 7:05 PM, Lawrence Bottorff <borgauf@gmail.com>
> 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. So I looked at in buffer settings, but I don't see
> anything specific to actually running elisp functions -- unless I'm missing
> something. Advice?
> >
> > LB
>
>
>

[-- Attachment #2: Type: text/html, Size: 1118 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: local variables to initialize org buffer?
  2019-04-01  2:05 local variables to initialize org buffer? Lawrence Bottorff
  2019-04-01  2:33 ` Berry, Charles
@ 2019-04-01  6:37 ` Eric S Fraga
  2019-04-01 16:33   ` Lawrence Bottorff
  1 sibling, 1 reply; 6+ messages in thread
From: Eric S Fraga @ 2019-04-01  6:37 UTC (permalink / raw)
  To: Lawrence Bottorff; +Cc: emacs-orgmode Mailinglist

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: local variables to initialize org buffer?
  2019-04-01  3:59   ` Lawrence Bottorff
@ 2019-04-01 16:13     ` Berry, Charles
  0 siblings, 0 replies; 6+ messages in thread
From: Berry, Charles @ 2019-04-01 16:13 UTC (permalink / raw)
  To: Lawrence Bottorff; +Cc: emacs-orgmode Mailinglist



> On Mar 31, 2019, at 8:59 PM, Lawrence Bottorff <borgauf@gmail.com> wrote:
> 
> Sure, but how should it be implemented?



# Local Variables:
#   eval: (org-babel-load-file (buffer-file-name))
#   End:

or if you want to follow Eric's suggestion, something like:

#+name: startup
#+begin_src emacs-lisp :tangle no
(org-babel-load-file (buffer-file-name))
#+end_src

HTH,

Chuck

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: local variables to initialize org buffer?
  2019-04-01  6:37 ` Eric S Fraga
@ 2019-04-01 16:33   ` Lawrence Bottorff
  0 siblings, 0 replies; 6+ messages in thread
From: Lawrence Bottorff @ 2019-04-01 16:33 UTC (permalink / raw)
  To: Lawrence Bottorff, emacs-orgmode Mailinglist

[-- Attachment #1: Type: text/plain, Size: 1868 bytes --]

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 <esflists@gmail.com> 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
>

[-- Attachment #2: Type: text/html, Size: 2796 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-04-01 16:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-01  2:05 local variables to initialize org buffer? Lawrence Bottorff
2019-04-01  2:33 ` Berry, Charles
2019-04-01  3:59   ` Lawrence Bottorff
2019-04-01 16:13     ` Berry, Charles
2019-04-01  6:37 ` Eric S Fraga
2019-04-01 16:33   ` Lawrence Bottorff

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).