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

2019-03-31 Thread Eric S Fraga
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



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

2019-03-31 Thread Lawrence Bottorff
Sure, but how should it be implemented?

On Sun, Mar 31, 2019 at 9:33 PM Berry, Charles  wrote:

> Will `org-babel-load-file' suffice?
>
> HTH,
>
> Chuck
>
> > On Mar 31, 2019, at 7:05 PM, 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. 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
>
>
>


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

2019-03-31 Thread Berry, Charles
Will `org-babel-load-file' suffice?

HTH,

Chuck

> On Mar 31, 2019, at 7:05 PM, 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. 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





[O] local variables to initialize org buffer?

2019-03-31 Thread Lawrence Bottorff
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


[O] Error when running publishing Org example :(void-variable org-publish-attachment)

2019-03-31 Thread Matthew Kenworthy
Hello all,

I'm running the example for publishing an org site to html at:

https://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html

...but when I try to execute the "org-static" block, I get the error:

(void-variable org-publish-attachment)

...any ideas as to what I'm missing here?

Many thanks,

Matt


Re: [O] org-eldoc error on shell src blocks

2019-03-31 Thread 甲斐常伸
Hello,

I encounted the same error and I found it happens because "org-eldoc.el"
doesn't reflect a value of "org-src-lang-modes". When I redefine
"org-eldoc-get-mode-local-documentation-function" to reflect a value of
"org-src-lang-modes" as below, the error disappeared.

(defun org-eldoc-get-mode-local-documentation-function (lang)
  "Check if LANG-mode sets eldoc-documentation-function and return its
value."
  (let ((cached-func (gethash lang org-eldoc-local-functions-cache
'empty))
(mode-func (org-src--get-lang-mode lang))
doc-func)
(if (eq 'empty cached-func)
(when (fboundp mode-func)
  (with-temp-buffer
(funcall mode-func)
(setq doc-func (and eldoc-documentation-function
(symbol-value
'eldoc-documentation-function)))
(puthash lang doc-func org-eldoc-local-functions-cache))
  doc-func)
  cached-func)))

The practical change is a one line.

diff --git a/contrib/lisp/org-eldoc.el b/contrib/lisp/org-eldoc.el
index 556b945..fca13c3 100644
--- a/contrib/lisp/org-eldoc.el
+++ b/contrib/lisp/org-eldoc.el
@@ -110,7 +110,7 @@
 (defun org-eldoc-get-mode-local-documentation-function (lang)
   "Check if LANG-mode sets eldoc-documentation-function and return its
value."
   (let ((cached-func (gethash lang org-eldoc-local-functions-cache
'empty))
-(mode-func (intern-soft (format "%s-mode" lang)))
+(mode-func (org-src--get-lang-mode lang))
 doc-func)
 (if (eq 'empty cached-func)
 (when (fboundp mode-func)


I confirmed this change works good on the following two environments.

- Emacs 26.1 on Windows 10
  - (emacs-version) ; GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+
Version 3.22.30) of 2018-05-29
  - (org-version) ; Org mode version 9.2.2 (9.2.2-13-g0007df-elpaplus @
/home/kai2nenobu/.emacs.d/elpa/org-plus-contrib-20190318/)

- Emacs 26.1 on Ubuntu 18.04 on WSL (on above Windows 10)
  - (emacs-version) ; GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of
2018-05-31
  - (org-version) ; Org mode version 9.2.1 (9.2.1-8-g1b1797-elpaplus @
c:/Users/kai2nenobu/.emacs.d/elpa/org-plus-contrib-20190211/)


I'm ready to contribute this patch, but I don't know how to contribute to
"org-eldoc.el". Please tell me how to do it.


Best Regards,


2018年2月4日(日) 16:56 Nicolas Goaziou :

> Hello,
>
> "numbch...@gmail.com"  writes:
>
> > After some dive in deeper
> >
> > - [X] emacs minimal init test, confirmed issue in org-mode.
> > - [X] from the error log, seems `org-eldoc` try to call `(progn (funcall
> > mode-func) ...`. This caused `shell-mode()`.
> > - [ ] check out `org-eldoc.el` source code, have not found any solution
> or
> > options.
>
> > Hope some org-mode hacker can help to fix this issue?
>
> I'm Cc'ing Org Eldoc author about it.
>
> > And this might be a unit test in Org-mode testing?
>
> We don't test contrib packages. However, they can provide their own
> tests.
>
> Regards,
>
> --
> Nicolas Goaziou
>
>