* org-babel: insert named source block
@ 2017-11-15 19:04 Deepak Cherian
2017-11-15 22:56 ` Berry, Charles
0 siblings, 1 reply; 4+ messages in thread
From: Deepak Cherian @ 2017-11-15 19:04 UTC (permalink / raw)
To: emacs-orgmode
Has anyone here managed to configure ivy or helm to show a list of named
source blocks that org knows about?
I am imagining this workflow:
1. M-x org-babel-insert-named-source-block (imaginary function)
2. List of named source blocks pops up
3. Hit enter and "#+call: name-of-source-block()" is inserted at point.
Thanks,
Deepak
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: org-babel: insert named source block
2017-11-15 19:04 org-babel: insert named source block Deepak Cherian
@ 2017-11-15 22:56 ` Berry, Charles
2017-11-16 0:12 ` Deepak Cherian
0 siblings, 1 reply; 4+ messages in thread
From: Berry, Charles @ 2017-11-15 22:56 UTC (permalink / raw)
To: Deepak Cherian; +Cc: emacs-orgmode@gnu.org
> On Nov 15, 2017, at 11:04 AM, Deepak Cherian <dpak.cherian@gmail.com> wrote:
>
> Has anyone here managed to configure ivy or helm to show a list of named source blocks that org knows about?
>
> I am imagining this workflow:
> 1. M-x org-babel-insert-named-source-block (imaginary function)
> 2. List of named source blocks pops up
> 3. Hit enter and "#+call: name-of-source-block()" is inserted at point.
>
org has its own function for listing named src-blocks.
#+BEGIN_SRC emacs-lisp
(defun my-insert-named-src-block
( &optional template )
(interactive)
(let ((template (or template "#+call: %s()\n"))
(src-block
(completing-read "Enter src block name[or TAB or ENTER]: " (org-babel-src-block-names))))
(unless (string-equal "" src-block)
(insert (format template src-block)))))
#+END_SRC
M-x my-insert-named-src-block TAB <click on name>
HTH,
Chuck
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: org-babel: insert named source block
2017-11-15 22:56 ` Berry, Charles
@ 2017-11-16 0:12 ` Deepak Cherian
2017-11-16 4:21 ` Berry, Charles
0 siblings, 1 reply; 4+ messages in thread
From: Deepak Cherian @ 2017-11-16 0:12 UTC (permalink / raw)
To: Berry, Charles; +Cc: emacs-orgmode@gnu.org
Thanks. That works well, but only shows named source blocks in the
particular file.
Is there a way to make it show library of babel blocks too?
Deepak
On 11/15/2017 02:56 PM, Berry, Charles wrote:
>> On Nov 15, 2017, at 11:04 AM, Deepak Cherian <dpak.cherian@gmail.com> wrote:
>>
>> Has anyone here managed to configure ivy or helm to show a list of named source blocks that org knows about?
>>
>> I am imagining this workflow:
>> 1. M-x org-babel-insert-named-source-block (imaginary function)
>> 2. List of named source blocks pops up
>> 3. Hit enter and "#+call: name-of-source-block()" is inserted at point.
>>
> org has its own function for listing named src-blocks.
>
> #+BEGIN_SRC emacs-lisp
> (defun my-insert-named-src-block
> ( &optional template )
> (interactive)
> (let ((template (or template "#+call: %s()\n"))
> (src-block
> (completing-read "Enter src block name[or TAB or ENTER]: " (org-babel-src-block-names))))
> (unless (string-equal "" src-block)
> (insert (format template src-block)))))
> #+END_SRC
>
> M-x my-insert-named-src-block TAB <click on name>
>
> HTH,
>
> Chuck
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-16 4:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-15 19:04 org-babel: insert named source block Deepak Cherian
2017-11-15 22:56 ` Berry, Charles
2017-11-16 0:12 ` Deepak Cherian
2017-11-16 4:21 ` Berry, Charles
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.