From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sean O'Halpin" Subject: Re: [Discuss] make :tangle header argument respect :dir could save info typing Date: Tue, 19 Mar 2019 13:08:29 +0000 Message-ID: References: <87ftsk9w03.fsf@gmail.com> <87a7id3mf0.fsf@gmail.com> <8736o4h15m.fsf@gmail.com> <87k1hge652.fsf@nicolasgoaziou.fr> <871s3ogfbe.fsf@gmail.com> <87imwy2sd6.fsf@nicolasgoaziou.fr> <87d0n55063.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000740f16058472344f" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:45583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6EUo-0008MD-Pb for emacs-orgmode@gnu.org; Tue, 19 Mar 2019 09:09:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6EUc-0001rU-Rk for emacs-orgmode@gnu.org; Tue, 19 Mar 2019 09:09:25 -0400 Received: from mail-yw1-xc36.google.com ([2607:f8b0:4864:20::c36]:45094) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6EUa-0000xY-3y for emacs-orgmode@gnu.org; Tue, 19 Mar 2019 09:09:20 -0400 Received: by mail-yw1-xc36.google.com with SMTP id j128so8908441ywg.12 for ; Tue, 19 Mar 2019 06:08:45 -0700 (PDT) In-Reply-To: <87d0n55063.fsf@gmail.com> 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: numbchild@gmail.com Cc: Org Mode --000000000000740f16058472344f Content-Type: text/plain; charset="UTF-8" Hi, =:dir= specifies the directory for code execution, i.e. when you hit =C-c C-c= what is the environment in which the code is run? =:mkdirp= forces creation of the directory for tangle output, i.e. when you =org-babel-tangle= where do you put the output source code? They are quite separate concerns. Regards, Sean On Tue, 5 Mar 2019 at 06:03, stardiviner wrote: > > I realized one thing, the combination of ~:mkdir~, ~:dir~, and ~:tangle~ > does not work > good enough. Can make ~:tangle~ respect ~:dir~ too. WDYT? > > Here is an example: > > #+begin_src clojure :mkdirp yes :dir "data/code/clj-crawler-demo" :tangle > "src/clj_crawler_demo/core.clj" > (ns clj-crawler-demo.core > (:require [clj-http.client :as http]) > (:require [net.cgrand.enlive-html :as html])) > > (html/select > (-> (http/get "https://www.baidu.com") > :body > html/html-snippet) > [:div]) > #+end_src > > Why need this? If ~:tangle~ respect ~:dir~, it will don't need the > complete path to > tangled file. And when the source block has other header argument need dir > like > ~:file~, this will make ~:tangle~ and other related header arguments > shorter. > > If ~:tangle~ does not respect ~:dir~, user need to repeat the path: > > #+begin_src clojure :mkdirp yes :dir "data/code/clj-crawler-demo" :tangle > "data/code/clj-crawler-demo/src/clj_crawler_demo/core.clj" > (ns clj-crawler-demo.core > (:require [clj-http.client :as http]) > (:require [net.cgrand.enlive-html :as html])) > > (html/select > (-> (http/get "https://www.baidu.com") > :body > html/html-snippet) > [:div]) > #+end_src > > This is long, I know there is ~#+headers:~ for source block. But reduce > info would > be better. I also consider the disadvantage of this change. Some user's > existing > source block might be broken. > > Let's level this change for discussion. > > -- > [ stardiviner ] > I try to make every word tell the meaning what I want to express. > > Blog: https://stardiviner.github.io/ > IRC(freenode): stardiviner, Matrix: stardiviner > GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 > > > --000000000000740f16058472344f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

=3D:dir=3D specifies the= directory for code execution, i.e. when you hit =3DC-c C-c=3D what is the = environment in which the code is run?

=3D:mkdirp= =3D forces creation of the directory for tangle output, i.e. when you =3Dor= g-babel-tangle=3D where do you put the output source code?
They are quite separate concerns.

Reg= ards,
Sean

On Tue, 5 Mar 2019 at 06:03, stardiviner <= numbchild@gmail.com> wrote:

I realized one thing, the combination of ~:mkdir~, ~:dir~, and ~:tangle~ do= es not work
good enough. Can make ~:tangle~ respect ~:dir~ too. WDYT?

Here is an example:

#+begin_src clojure :mkdirp yes :dir "data/code/clj-crawler-demo"= :tangle "src/clj_crawler_demo/core.clj"
(ns clj-crawler-demo.core
=C2=A0 (:require [clj-http.client :as http])
=C2=A0 (:require [net.cgrand.enlive-html :as html]))

(html/select
=C2=A0(-> (http/get "https://www.baidu.com")
=C2=A0 =C2=A0 =C2=A0:body
=C2=A0 =C2=A0 =C2=A0html/html-snippet)
=C2=A0[:div])
#+end_src

Why need this? If ~:tangle~ respect ~:dir~, it will don't need the comp= lete path to
tangled file. And when the source block has other header argument need dir = like
~:file~, this will make ~:tangle~ and other related header arguments shorte= r.

If ~:tangle~ does not respect ~:dir~, user need to repeat the path:

#+begin_src clojure :mkdirp yes :dir "data/code/clj-crawler-demo"= :tangle "data/code/clj-crawler-demo/src/clj_crawler_demo/core.clj&quo= t;
(ns clj-crawler-demo.core
=C2=A0 (:require [clj-http.client :as http])
=C2=A0 (:require [net.cgrand.enlive-html :as html]))

(html/select
=C2=A0(-> (http/get "https://www.baidu.com")
=C2=A0 =C2=A0 =C2=A0:body
=C2=A0 =C2=A0 =C2=A0html/html-snippet)
=C2=A0[:div])
#+end_src

This is long, I know there is ~#+headers:~ for source block. But reduce inf= o would
be better. I also consider the disadvantage of this change. Some user's= existing
source block might be broken.

Let's level this change for discussion.

--
[ stardiviner ]
=C2=A0 =C2=A0 =C2=A0 =C2=A0I try to make every word tell the meaning what I= want to express.

=C2=A0 =C2=A0 =C2=A0 =C2=A0Blog: https://stardiviner.github.io/ =C2=A0 =C2=A0 =C2=A0 =C2=A0IRC(freenode): stardiviner, Matrix: stardiviner<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

--000000000000740f16058472344f--