Andreas Leha writes: > Hi Charles, > > Charles Berry writes: >> Andreas Leha med.uni-goettingen.de> writes: >> >>> >>> Hi, >>> >>> Grant Rettke wisdomandwonder.com> writes: >>> > On Thu, Sep 11, 2014 at 5:05 PM, Adriaan Sticker >>> > 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: Rainerkrugsde PGP: 0x0F52F982