From: Rainer M Krug <Rainer@krugs.de>
To: Andreas Leha <andreas.leha@med.uni-goettingen.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: meaningfull names for org-src buffers
Date: Fri, 26 Sep 2014 08:33:49 +0200 [thread overview]
Message-ID: <m2a95mdh6a.fsf@krugs.de> (raw)
In-Reply-To: <olu8ul7v4b4.fsf@med.uni-goettingen.de> (Andreas Leha's message of "Thu, 25 Sep 2014 21:22:07 +0100")
[-- Attachment #1: Type: text/plain, Size: 2719 bytes --]
Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
> Hi Charles,
>
> Charles Berry <ccberry@ucsd.edu> writes:
>> Andreas Leha <andreas.leha <at> med.uni-goettingen.de> writes:
>>
>>>
>>> Hi,
>>>
>>> Grant Rettke <gcr <at> wisdomandwonder.com> writes:
>>> > On Thu, Sep 11, 2014 at 5:05 PM, Adriaan Sticker
>>> > <adriaan.sticker <at> gmail.com> wrote:
>>> >> I was wondering if it's somehow possible to give named org src buffer the
>>> >> name they were give in their #+NAME tag? Now there are just called
>>> >> something like:
>>> >> *Org Src test.org[ R ]*
>>> >>
>>> >> But if you have multiple org-src buffers opened at the same time, its
>>> >> hard to find the correct one back.
>>> >
>>> > Excellent idea. I've got so many small source blocks that it is too
>>> > difficult to make sense of
>>> > keeping multiple source block edit buffers open and limit them to one
>>> > at a time eg
>>> >
>>> > ,----
>>> > | (setq org-src-window-setup 'current-window)
>>> > `----
>>> >
>>> > How have you come upon your workflow of keeping multiple open and what
>>> > are some of the pros and
>>> > cons that you've found with it?
>>>
>>> I'd be interested in this as well.
>>>
>>> Regards,
>>> Andreas
>>>
>>>
>>
>> Maybe I am answering the wrong question, but org-edit-src-code allows
>> you to specify the buffer name:
>>
>
> You are answering my exact question.
>
>>
>> ,----[ C-h f org-edit-src-code RET ]
>> | org-edit-src-code is an interactive compiled Lisp function in
>> | `org-src.el'.
>> |
>> | (org-edit-src-code &optional CONTEXT CODE EDIT-BUFFER-NAME)
>> |
>> | ...
>> `----
>>
>> So you can do something like this:
>>
>> #+BEGIN_SRC emacs-lisp
>> (defun org-edit-src-code-plus-name ()
>> (interactive)
>> (let* ((eop (org-element-at-point))
>> (name (or (org-element-property :name (org-element-context eop))
>> "unnamed"))
>> (lang (org-element-property :language eop))
>> (buff-name (concat "*Org Src " name "[ " lang " ] *")))
>> (org-edit-src-code nil nil buff-name)))
>> #+END_SRC
>>
>> which leads to a buffer named like "*Org Src My-block[ R ] *", where
>> 'My-block' is the name of the src block.
>>
>
> Thanks! On my first quick tests that works great! It is in my
> initialization and I'll use that regularly.
>
> Is there any drawback to this? Otherwise I'd advocate for
> org-edit-src-code doing that by default.
Haven't tried it out yet, but I second that statement.
Rainer
>
>> HTH,
>
> It sure does.
>
> Thanks,
> Andreas
>
>
>
--
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982
[-- Attachment #2: Type: application/pgp-signature, Size: 494 bytes --]
prev parent reply other threads:[~2014-09-26 6:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-11 22:05 meaningfull names for org-src buffers Adriaan Sticker
2014-09-21 13:49 ` Grant Rettke
2014-09-21 15:07 ` Adriaan Sticker
2014-09-21 15:51 ` Grant Rettke
2014-09-25 10:54 ` Andreas Leha
2014-09-25 10:55 ` Andreas Leha
2014-09-25 19:55 ` Charles Berry
2014-09-25 20:22 ` Andreas Leha
2014-09-26 6:33 ` Rainer M Krug [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2a95mdh6a.fsf@krugs.de \
--to=rainer@krugs.de \
--cc=andreas.leha@med.uni-goettingen.de \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.