emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Headline generation as in diary?


From: Ihor Radchenko
Subject: Re: Headline generation as in diary?
Date: Fri, 04 Sep 2020 02:04:45 +0800

> I didn't know that eval specs support multi-line sexps, but seems that
> works, so I can indeed use this.  Thanks for the suggestion.

Hmm. According to manual, it should support multi-line string. Not sure
about sexps.

In the worst case when you absolutely want multi-line sexp to be really
multi-line and that is also not possible in file-local eval, you can
define your sexp in a named src block. Then, you can execute the named
block using file-local eval statement calling the following function:

(defun org-link-babel-follow (name &optional return-info)
  "Run src block NAME.
The NAME is parsed as in #+CALL: specification.
The src block should be in the same org file."
  (let* ((call (with-temp-buffer
                 (interactive)
                 (org-mode)
                 (insert "#+CALL: " (format "%s" (org-link-unescape name)) "\n")
                 (beginning-of-buffer)
                 (org-element-babel-call-parser (point-max) (list (point-min)))
                 ))
         (info (org-babel-lob-get-info call)))
    (if return-info
        info
      (flet ((org-babel-insert-result (result &optional result-params info hash 
lang) nil))
        (org-babel-execute-src-block nil info)))))

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Ihor Radchenko <yantar92@gmail.com> writes:
>
>> I do not think there is support of multi-line planning everywhere.
>
> I see.
>
>> You can always use file-local definition at the beginning or end of your
>> org file. Below is an example of local definition at the end of an org
>> file.
>>
>> # Local Variables:
>> # eval: (defun your-function () (sexp))
>
> I didn't know that eval specs support multi-line sexps, but seems that
> works, so I can indeed use this.  Thanks for the suggestion.
>
> Michael.



reply via email to

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