Re: [O] [Discuss] make :tangle header argument respect :dir could save info typing

2019-03-19 Thread stardiviner


Sean O'Halpin  writes:

> 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?

I know currently it specify directory for code execution. I'm saying whether
consider extend =:dir= semantic for tangling too.

Because the header arguments could becoming very long if I repeat the
sub-directory information in executing directory =:dir= and for =:tangle=. Like
this:

#+begin_src sh :mkdirp yes :dir "data/code/project-name-1" :tangle 
"data/code/project-name-1/src/project-name/main/App.java"

#+end_src

You see, The "=data/code/project-name-1=" path part is duplicate. And the header
arguments is very long. Even though I can put header arguments in ~#+HEADERS:~
line of source block. But still duplicate info inputting, isn't it?

>
> =:mkdirp= forces creation of the directory for tangle output, i.e. when you 
> =org-babel-tangle= where do you put the output source code?

=:mkdirp= already support for auto force create of directory =:dir= now.

>
> 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


-- 
[ 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
  



Re: [O] [Discuss] make :tangle header argument respect :dir could save info typing

2019-03-19 Thread Sean O'Halpin
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
>
>
>


[O] [Discuss] make :tangle header argument respect :dir could save info typing

2019-03-04 Thread stardiviner


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