From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATCH] Better handling labels in source code blocks + A suggestion Date: Mon, 08 Aug 2016 14:23:22 +0200 Message-ID: <87fuqfa1qd.fsf@saiph.selenimh> References: <87h9b4a9km.fsf@marcade.biz> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWjaY-0002Yb-I3 for emacs-orgmode@gnu.org; Mon, 08 Aug 2016 08:23:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWjaU-0001qN-Fv for emacs-orgmode@gnu.org; Mon, 08 Aug 2016 08:23:26 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:55387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWjaU-0001q7-8N for emacs-orgmode@gnu.org; Mon, 08 Aug 2016 08:23:22 -0400 In-Reply-To: <87h9b4a9km.fsf@marcade.biz> (Bernard Hurley's message of "Mon, 01 Aug 2016 14:43:37 +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" To: Bernard Hurley Cc: emacs-orgmode Hello, Bernard Hurley writes: > At present the value of org-coderef-label-format in a source code > editing buffer does not inherit its value from the value in the > corresponding org-mode buffer but instead, if it is not specified by a > -l option, defaults to the global value. Note that it is the value in the > org mode buffer and not the global value that is used for such things as > exporting so this can lead to inconsistent behaviour. > > The following patch on org-src.el will fix this, and, as far as I can > tell, it doesn=E2=80=99t break anything else: [...] > After this you can do things like the following in an org-mode buffer, > so that the labels are embedded in comments and the code block will > still execute: > > # Local Variables: > # org-coderef-label-format: "#(ref:%s)" > # End: > > and you could write something like: > > #+BEGIN_SRC ruby -r > > instead of: > > #+BEGIN_SRC ruby -f -l "#(ref:%s)" > > which is quite convenient if you have lots of blocks It is already possible to do that with the current implementation, so I'm not sure to understand the bug you're reporting. Besides, I added support for evaluating code blocks containing coderefs. It might be related to your post. > A Suggestion: > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > In addition it would be nice if there were some way of giving a default > value for org-coderef-label-format that depends on the language of the > code block it is associated with, but I=E2=80=99m not sure what the best = way to > implement this would be. `org-coderef-label-format' could become `org-coderef-label-alist' where key is the language, as a string, and value the format string. You would also need to implement a getter e.g., (defun org-src-get-coderef-fmt element) that would return the appropriate format-string. Would you want to provide a patch for that? Regards, --=20 Nicolas Goaziou