emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] Better handling labels in source code blocks + A suggest


From: Nicolas Goaziou
Subject: Re: [O] [PATCH] Better handling labels in source code blocks + A suggestion
Date: Mon, 08 Aug 2016 14:23:22 +0200

Hello,

Bernard Hurley <address@hidden> 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’t 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:
> ============
>
> 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’m 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,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]