emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Bernard Hurley <bernard@marcade.biz>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] Better handling labels in source code blocks + A suggestion
Date: Mon, 08 Aug 2016 14:23:22 +0200	[thread overview]
Message-ID: <87fuqfa1qd.fsf@saiph.selenimh> (raw)
In-Reply-To: <87h9b4a9km.fsf@marcade.biz> (Bernard Hurley's message of "Mon, 01 Aug 2016 14:43:37 +0100")

Hello,

Bernard Hurley <bernard@marcade.biz> 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

      parent reply	other threads:[~2016-08-08 12:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-01 13:43 [PATCH] Better handling labels in source code blocks + A suggestion Bernard Hurley
2016-08-01 13:53 ` Bernard Hurley
2016-08-08 12:23 ` Nicolas Goaziou [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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fuqfa1qd.fsf@saiph.selenimh \
    --to=mail@nicolasgoaziou.fr \
    --cc=bernard@marcade.biz \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).