From mboxrd@z Thu Jan 1 00:00:00 1970 From: "numbchild@gmail.com" Subject: Re: [feature] prepend comment char before org-babel-ref Date: Thu, 25 Jan 2018 21:12:34 +0800 Message-ID: References: <87mv13cr2w.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="f4030435d12c447bdd0563998a59" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eehL4-0008K7-GT for emacs-orgmode@gnu.org; Thu, 25 Jan 2018 08:13:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eehKz-0005zJ-SU for emacs-orgmode@gnu.org; Thu, 25 Jan 2018 08:13:10 -0500 Received: from mail-ot0-x235.google.com ([2607:f8b0:4003:c0f::235]:43319) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eehKz-0005yn-Le for emacs-orgmode@gnu.org; Thu, 25 Jan 2018 08:13:05 -0500 Received: by mail-ot0-x235.google.com with SMTP id p36so6651078otd.10 for ; Thu, 25 Jan 2018 05:13:05 -0800 (PST) In-Reply-To: <87mv13cr2w.fsf@nicolasgoaziou.fr> 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: Nicolas Goaziou Cc: Org-mode --f4030435d12c447bdd0563998a59 Content-Type: text/plain; charset="UTF-8" I see. Seems current ob-core.el can filter out the `src-coderef`. Like the following: #+begin_src emacs-lisp (prin1 "hello, world!") (ref:hello) #+end_src #+RESULTS[<2018-01-25 20:28:40> 16eccfedcc87d3ca0c7024b2637c646d4708ec42]: : hello, world! #+begin_src ruby :results output puts "hello, world!" (ref:hello) #+end_src #+RESULTS[<2018-01-25 20:46:21> e1e8632ccedf7cc3c676be0c89841a885bbcc7d9]: : hello, world! But about your questions: > What it the comment syntax is not properly defined? I think almost all programming language has comments. About some other babels which don't have comment. I think `org-babel` can check whether babel language has comment. > What if the coderef format already contains comment syntax? `org-babel` already use current coderef format. Keep current coderef format is fine. If coderef format is like `#ref:label`. and Ruby language use comment `#` too. Then after prepending comment char, it becomes `# #ref:label`. It is fine. Right? > What if the language does not support inline comments and you're in the middle of a line? It is fine too. Current coderef already support insert coderef format at right align even I'm in the middle of a line. I tested. All your questions solved. My wanted feature is simple, just `(insert (concat comment-char coderef-format))` [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://stardiviner.github.io/ On Wed, Jan 24, 2018 at 9:40 PM, Nicolas Goaziou wrote: > Hello, > > "numbchild@gmail.com" writes: > > > I think this function should be in Org-mode itself. > > Because when you're editing the source code, will not want this > src-coderef > > like `(ref:example)` be editable. It should be in comment. > > Thank you for the suggestion. However I have some doubts about this. > > What it the comment syntax is not properly defined? What if the coderef > format already contains comment syntax? What if the language does not > support inline comments and you're in the middle of a line (e.g., > FORTRAN)? > > I'm wondering if this is really a panacea. The current situation, albeit > imperfect, is simple and easy to understand. > > WDYT? > > Regards, > > -- > Nicolas Goaziou > --f4030435d12c447bdd0563998a59 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I see. Seems current ob-core.el can filter out the `sr= c-coderef`.
Like the following:

#+begin_src emacs-lisp<= br>(prin1 "hello, world!") (ref:hello)
#+end_src

#+RESU= LTS[<2018-01-25 20:28:40> 16eccfedcc87d3ca0c7024b2637c646d4708ec42]:<= br>: hello, world!

#+begin_src ruby :results output
puts "he= llo, world!" (ref:hello)
#+end_src

#+RESULTS[<2018-01-25 = 20:46:21> e1e8632ccedf7cc3c676be0c89841a885bbcc7d9]:
: hello, world!<= br>
But about your questions:
> What it the comment synt= ax is not properly defined?
I think almost all programming lan= guage has comments. About some other babels which don't have comment. I= think `org-babel` can check whether babel language has comment.
> Wh= at if the coderef format already contains comment syntax?
`org= -babel` already use current coderef format. Keep current coderef format is = fine. If coderef format is like `#ref:label`. and Ruby language use comment= `#` too. Then after prepending comment char, it becomes `# #ref:label`. It= is fine. Right?
> What if the language does not support inline comme= nts and you're in the middle of a line?
It is fine too. Cu= rrent coderef already support insert coderef format at right align even I&#= 39;m in the middle of a line. I tested.

All your questions= solved.

My wanted feature is simple, just `(ins= ert (concat comment-char coderef-format))`

[stardiviner= ]=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Hack this= world!>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 GPG key ID: 47C32433
IRC(freee= node): stardiviner =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Twitter:=C2=A0= @numbchild
Key fingerprint =3D 9BAA 92BC CDDD B9EF 3B36=C2=A0 CB99 B8C4= B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Wed, Jan 24, 2018 at 9:40 PM, Nicolas Goa= ziou <mail@nicolasgoaziou.fr> wrote:
Hello,

"numbchild@gmail.com" = <numbchild@gmail.com> writ= es:

> I think this function should be in Org-mode itself.
> Because when you're editing the source code, will not want this sr= c-coderef
> like `(ref:example)` be editable. It should be in comment.

Thank you for the suggestion. However I have some doubts about this.=

What it the comment syntax is not properly defined? What if the coderef
format already contains comment syntax? What if the language does not
support inline comments and you're in the middle of a line (e.g.,
FORTRAN)?

I'm wondering if this is really a panacea. The current situation, albei= t
imperfect, is simple and easy to understand.

WDYT?

Regards,

--
Nicolas Goaziou

--f4030435d12c447bdd0563998a59--