From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Rettke Subject: Re: Issues with org-babel-detangle and :comments noweb Date: Fri, 15 Jun 2018 12:14:14 -0500 Message-ID: References: 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]:52874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTsIk-0004tT-QR for emacs-orgmode@gnu.org; Fri, 15 Jun 2018 13:14:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fTsIj-0005sv-IL for emacs-orgmode@gnu.org; Fri, 15 Jun 2018 13:14:18 -0400 Received: from mail-lf0-x230.google.com ([2a00:1450:4010:c07::230]:46756) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fTsIj-0005s8-Al for emacs-orgmode@gnu.org; Fri, 15 Jun 2018 13:14:17 -0400 Received: by mail-lf0-x230.google.com with SMTP id j13-v6so15636252lfb.13 for ; Fri, 15 Jun 2018 10:14:17 -0700 (PDT) In-Reply-To: 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: Frederick Giasson Cc: Org-mode On Mon, May 28, 2018 at 12:32 PM, Frederick Giasson wro= te: > Hi Everybody, > > I am trying to have noweb references working with org-babel-detangle. Let= 's > use this example: > > ``` > #+NAME: a > #+BEGIN_SRC clojure > > (def a "a") > > #+END_SRC > > #+NAME: b > #+BEGIN_SRC clojure > > (def a "b") > > #+END_SRC > > #+NAME: c > #+BEGIN_SRC clojure > > (def a "c") > > #+END_SRC > > #+NAME: a > #+BEGIN_SRC clojure > > (def a "a") > > #+END_SRC > > > #+NAME: test > #+BEGIN_SRC clojure :tangle test.clj :mkdirp yes :noweb yes :padline yes > :results silent :comments noweb > > <> > <> > <> > > #+END_SRC > > ``` > > > Once tangled, the test.clj file looks like: > > ``` > ;; [[file:test.org::test][test]] > ;; [[file:test.org::a][a]] > > (def a "a") > > ;; a ends here > ;; [[file:test.org::a][a]] > > (def a "a") > > ;; a ends here > ;; [[file:test.org::b][b]] > > (def a "b") > > ;; b ends here > ;; [[file:test.org::c][c]] > > (def a "c") > > ;; c ends here > ;; test ends here > ``` > > If I perform org-babel-tangle-jump-to-org everything works fine, I jump = to > the block codes. > > However if I perform org-babel-detangle, when I get the message "Not in > tangle code". The problem appears to be that the references are "embedded= " > in the tangled block code. If I move the "test ends here" above, then it > works, but then when the tangled block code get detangled, I loose the no= web > references. > > Any idea if there is a work around for that? I would like to use > org-babel-tangle-jump-to-org and org-babel-detangle while being about to > change the order of the code within the block codes in the tangled file. Hi Fred, I took your example and changed the language but that doesn't affect the example. All of the examples include what is the minimum amount necessary. Here is my version of the org file =3D=3D=3D=3D=3D #+NAME: a #+BEGIN_SRC clojure (def a "a") #+END_SRC #+NAME: b #+BEGIN_SRC clojure (def b "b") #+END_SRC #+NAME: c #+BEGIN_SRC clojure (def c "c") #+END_SRC #+NAME: test #+BEGIN_SRC emacs-lisp :tangle test.el =E2=9F=AAa=E2=9F=AB =E2=9F=AAb=E2=9F=AB =E2=9F=AAc=E2=9F=AB #+END_SRC =3D=3D=3D=3D=3D Here is the generated code ;; [[file:~/tmp/frederick.org::test][test]] ;; [[file:~/tmp/frederick.org::a][a]] (def a "a") ;; a ends here ;; [[file:~/tmp/frederick.org::b][b]] (def b "b") ;; b ends here ;; [[file:~/tmp/frederick.org::c][c]] (def c "c") ;; c ends here ;; test ends here =3D=3D=3D=3D=3D If I go the the tangled code ;; [[file:~/tmp/frederick.org::c][c]] (def c "c") <--- and put the cursor here ;; c ends here ;; test ends here And call org-babel-tangle-jump-to-org #+NAME: c #+BEGIN_SRC clojure (def c "c") <--- then the cursor jumps here #+END_SRC =3D=3D=3D=3D=3D If I go the the tangled code ;; [[file:~/tmp/frederick.org::test][test]] <--- and put the cursor here ;; [[file:~/tmp/frederick.org::a][a]] (def a "a") ;; a ends here And call org-babel-tangle-jump-to-org #+NAME: test #+BEGIN_SRC emacs-lisp :tangle test.el <--- then the cursor jumps here <> <> <> #+END_SRC =3D=3D=3D=3D=3D It seems like Org "knows what to do here". Here is my question: If I take the tangled code and change the source block so the order is reverse and the content of c has changed ;; [[file:~/tmp/frederick.org::test][test]] ;; [[file:~/tmp/frederick.org::c][c]] (def c "CADILLAC") ;; c ends here ;; [[file:~/tmp/frederick.org::b][b]] (def b "b") ;; b ends here ;; [[file:~/tmp/frederick.org::a][a]] (def a "a") ;; a ends here ;; test ends here And I detangle that file: Then do you want the code in the source file to look like this? #+NAME: c #+BEGIN_SRC clojure (def c "Cadillac") #+END_SRC #+NAME: test #+BEGIN_SRC emacs-lisp :tangle test.el =E2=9F=AAc=E2=9F=AB =E2=9F=AAb=E2=9F=AB =E2=9F=AAa=E2=9F=AB #+END_SRC =3D=3D=3D=3D=3D Does the jumping to org working the same here for you as for me? Is the detangling behavior example I wrote what you are thinking of? I am asking because I want to know if I understand correctly or not.