From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: meaningfull names for org-src buffers Date: Fri, 26 Sep 2014 08:33:49 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXP6X-0003hp-6I for emacs-orgmode@gnu.org; Fri, 26 Sep 2014 02:34:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXP6S-0005Al-EY for emacs-orgmode@gnu.org; Fri, 26 Sep 2014 02:34:09 -0400 Received: from mail-wg0-f51.google.com ([74.125.82.51]:39472) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXP6S-0005A2-9L for emacs-orgmode@gnu.org; Fri, 26 Sep 2014 02:34:04 -0400 Received: by mail-wg0-f51.google.com with SMTP id b13so628278wgh.34 for ; Thu, 25 Sep 2014 23:33:58 -0700 (PDT) In-Reply-To: (Andreas Leha's message of "Thu, 25 Sep 2014 21:22:07 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Andreas Leha Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Andreas Leha writes: > Hi Charles, > > Charles Berry writes: >> Andreas Leha med.uni-goettingen.de> writes: >> >>>=20 >>> Hi, >>>=20 >>> 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 buffe= r the >>> >> name they were give in their #+NAME tag? Now there are just called=20 >>> >> something like: >>> >> *Org Src test.org[ R ]* >>> >> >>> >> But if you have multiple org-src buffers opened at the same time, it= s=20 >>> >> 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? >>>=20 >>> I'd be interested in this as well. >>>=20 >>> Regards, >>> Andreas >>>=20 >>>=20 >> >> 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'. >> |=20 >> | (org-edit-src-code &optional CONTEXT CODE EDIT-BUFFER-NAME) >> |=20 >> | ... >> `---- >> >> 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 eo= p)) >> "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=20 >> '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 > > > =2D-=20 Rainer M. Krug email: Rainerkrugsde PGP: 0x0F52F982 --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iQEcBAEBAgAGBQJUJQjRAAoJENvXNx4PUvmCrgwH/0xFyNMv8Fio7nhgrej4qVFA nBZnN3IiHdlxwNMDnLBSLwVVu0yWUcOq5/9qYsTd+jll6ibPRsRh9hQj78vsVmoq sqQbSDyFVEaMz8/k0MKFS32FBjvFzDhHNB99MTgxsxvl4gYpjIZBPYRgJ5O85SyS nBTMbjA2IrUdJAU/R6VAMsmlXdJqMLZlcXSK38IqxkjJxE0FfYVmqoslDVLvZOrZ 4fAtshJWeKSg6yE5xgAribezt5AGRvAzReSKiTmrnrxzPGChXI0hBNuC0+qMTLk5 KLpKE6/2LWYr8a1hPxzSoxzX1rO/coFY+yhOFWqcathLjk1/FhKZfbak9k9TrOs= =RTKi -----END PGP SIGNATURE----- --=-=-=--