Re: [O] [FEATURE] Make header argument :mkdirp yes work for other header arguments not just :tangle

2019-03-03 Thread stardiviner

Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> I hope ~:mkdirp~ header argument can also work for other related header 
>> arguments
>> like ~:dir~, ~:file~ etc not just ~:tangle~. Like following example.
>>
>> #+begin_src sh :mkdirp yes :dir "data/code/mkdirp/dir" :file "test" :results 
>> file link
>> echo "hello"
>> #+end_src
>>
>> So I added a simple patch to make it work.
>
> Thank you. Some comments follow.
>
>>  #+cindex: @samp{mkdirp}, header argument
>> -The =mkdirp= header argument creates parent directories for tangled
>> -files if the directory does not exist.  =yes= enables directory
>> -creation and =no= inhibits directory creation.
>> +The =mkdirp= header argument creates parent directories for =dir=
>> +header argument specified path and tangled files if the directory does
>> +not exist.  =yes= enables directory creation and =no= inhibits
>> +directory creation.
>
> Please also support "t" and "nil", or, more generally, make "no" and
> "nil" equivalent, and anything else would be "t".

I use ~cond~ to handle this. Don't know whether have better. I can use ~if~ to
exclusive on "no" and "nil". But it is not robust.

>
>> -   (or (and dir (file-name-as-directory (expand-file-name dir)))
>> +   (or (and dir
>> +;; Possibly create the parent directories for file.
>> +(let (fnd (file-name-as-directory (expand-file-name 
>> dir)))
>> +  (if (and (string= mkdirp "yes") fnd)
>> +  (make-directory fnd 'parents
>
>> +;;; test-ob-core.el --- tests for ob-core.el
>
> Tests are in "test-ob.el" file. You should add yours there instead of
> creating a new file.

I though it is "test-ob-core.el", but have not found it. So I created a new 
one. :)

>
>> +(ert-deftest test-ob-core/dir-mkdirp ()
>> +  (org-test-with-temp-text
>> +   "#+begin_src sh :mkdirp yes :dir \"data/code\"
>> +pwd
>> +#+end_src"
>> +   (org-babel-execute-src-block)
>> +   (should (file-directory-p "data/code"
>
> Nitpick: `should' is better outside `org-test-with-temp-text'?

Updated.

>
> Could you send an updated patch?

New patch in attachment.
  
>From aafdd41f7ae5f6218a2be890f58d45be443de4a9 Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Sat, 2 Mar 2019 12:11:47 +0800
Subject: [PATCH] ob-core.el: Make :mkdirp work for :dir too

* lisp/ob-core.el (org-babel-execute-src-block): make directory if :dir
  path does not exist when :mkdirp yes exist.

* doc/org-manualo.rg (mkdirp): declare new change in manual.

* etc/ORG-NEWS: declare changes in ORG-NEWS.

* testing/lisp/test-ob.el: Add a specific testing file for ob-core.el,
  and add a testing for :mkdir yes work with :dir header argument usage.
---
 doc/org-manual.org  | 7 ---
 etc/ORG-NEWS| 6 ++
 lisp/ob-core.el | 9 -
 testing/lisp/test-ob.el | 8 
 4 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 00e5e1072..30c797ad7 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -17476,9 +17476,10 @@ to source file(s).
   location.  Example: =:tangle FILENAME=.
 
 #+cindex: @samp{mkdirp}, header argument
-The =mkdirp= header argument creates parent directories for tangled
-files if the directory does not exist.  =yes= enables directory
-creation and =no= inhibits directory creation.
+The =mkdirp= header argument creates parent directories for =dir=
+header argument specified path and tangled files if the directory does
+not exist.  =yes= enables directory creation and =no= inhibits
+directory creation.
 
 #+cindex: @samp{comments}, header argument
 The =comments= header argument controls inserting comments into
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 057440a71..cd5e4d900 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -157,6 +157,12 @@ A call of ~org-set-tags-command~ with prefix argument C-u C-u avoids
 the fast tag selection interface and instead offers the plain
 interface.
 
+*** ~:mkdirp~ now supports create directory for ~:dir~ path
+
+The ~:mkdirp~ header argument used to only work for ~:tangle~ tangle
+files. Now ~:mkdirp~ works for ~:dir~ too. This is more convenient for
+specify default directory and with ~:file~ header argument.
+
 * Version 9.2
 ** Incompatible changes
 *** Removal of OrgStruct mode mode and radio lists
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index e6f0edba5..c2b629bab 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -677,8 +677,15 @@ block."
 		  (replace-regexp-in-string
 		   (org-src-coderef-regexp coderef) "" expand nil nil 1
 		 (dir (cdr (assq :dir params)))
+		 (mkdirp (cdr (assq :mkdirp params)))
 		 (default-directory
-		   (or (and dir (file-name-as-directory (expand-file-name dir)))
+		   (or (and dir
+			;; Possibly create the parent directories for file.
+			(let ((fnd (file-name-as-directory (expand-file-name dir
+			  (cond
+			   

Re: [O] Positioning of Tags on Header ?

2019-03-03 Thread Nicolas Goaziou
Hello,

David Masterson  writes:

> How does Org position the Tags on the Header line when it reads in an
> Org file with Tags?  It seems that the Tags move from time to time and
> that can actually cause the file to be viewed as "changed" by the change
> control system (CVS).  I would've thought that the Tags are positioned
> when inserted and then left alone.  Is something else happening?

This doesn't ring a bell. You might want to add debug information in
`org-align-tags', since it is susceptible to modify tags alignment.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: link to gnuplot [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/kiwibird/.emacs.d/elpa/org-9.1.14/)]

2019-03-03 Thread Nicolas Goaziou
Hello,

Kevin Brubeck Unhammer  writes:

> When I do
>
> C-c " g 
>
> or
>
> M-x org-plot/gnuplot
>
> I get
>
> org-plot/gnuplot: Cannot open load file: No such file or directory, 
> gnuplot
>
> It'd be nice if org-plot/gnuplot could instead `message' me a link to
> the package that needs installing (or at least if the docstring for that
> function could mention it).

Do you want to provide a patch for that?

> Also, the link from Worg is wrong,
> https://orgmode.org/worg/org-tutorials/org-plot.html points to
> http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html instead of
> http://xafs.org/BruceRavel/GnuplotMode or
> https://github.com/bruceravel/gnuplot-mode/

Same question.

Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] manual: stale bindings for org-clock-report and org-columns-insert-dblock

2019-03-03 Thread Kyle Meyer
Nikolay Kudryavtsev  writes:

> Am I reading it correctly that C-c C-x C-r is no longer a valid
> keybinding?

Yes, the binding was removed in 34b71a0ca (Add a dispatcher command for
inserting dynamic blocks, 2018-12-23).

> Is this the reason why it now behaves so stupidly, creating
> a block with :scope file and asking for that file?

[You could have phrased that less abrasively.]

I don't know.  I don't use org-clock-report, haven't looked closely at
34b71a0ca, and didn't follow the discussion around the change, but ...

> Can someone point me to a discussion of that change?

I think the relevant discussion started with 871s7lvn4n@gmail.com

  * https://lists.gnu.org/archive/html/emacs-orgmode/2018-11/msg00183.html
  * https://lists.gnu.org/archive/html/emacs-orgmode/2018-12/msg00026.html

-- 
Kyle



Re: [O] manual: stale bindings for org-clock-report and org-columns-insert-dblock

2019-03-03 Thread Nikolay Kudryavtsev
Am I reading it correctly that C-c C-x C-r is no longer a valid 
keybinding? Is this the reason why it now behaves so stupidly, creating 
a block with :scope file and asking for that file? Can someone point me 
to a discussion of that change? Manual is still not updated about it and 
nothing in ORG-NEWS.


Quickly using that key was quite useful to pop a clock report for a task 
and I really don't see why would anyone want to remove that.


--
Best Regards,
Nikolay Kudryavtsev




Re: [O] Supporting Exchange calendars in org-mac-iCal.el

2019-03-03 Thread Stelian Iancu

Hi Norman,

I would be interested in this functionality.

Thanks,
Stelian

On 22.02.19 16:10, Norman Walsh wrote:

Hi folks,

I don’t know if anyone else is using org-mac-iCal[*], but I find it
useful. (I find it convenient to have calendar appointments in my
agenda view.)

In the course of setting it up, I discovered that it didn’t support
Exchange calendars. And it had a regexp that didn’t match versions of
MacOS post 10.8.

I’ve fixed both of those issues, at least to the extent that they seem
to work for me. I sent email to the named author, Christopher
Suckling, but didn’t get a reply. (Hello Christopher, if you’re out
there!)

If anyone is interested, I can see about finding a place to put my
patch.

 Be seeing you,
   norm

[*] https://orgmode.org/worg/org-contrib/org-mac-iCal.html





Re: [O] Babel: how to get rid of the quotes wraping the result of a Sagemath code block ?

2019-03-03 Thread Emmanuel Charpentier
Ahem...

It turns out that this was (partly) a pilot error, bound to the
specifics of ob-sagemath.

I still do not understand the impact of the raw and verbatim options of
:results, but I'll come back later if the behaviou I got is indeed
*really* buggy.

Sorry for the noise...

--
Emmanuel Charpentier

Le samedi 02 mars 2019 à 22:11 +0100, Emmanuel Charpentier a écrit :
> Dear list,
> 
> I would like to use Sage to build the text of a Graphviz program to
> display some graph, then pass this program body to a dot code block.
> 
> The first step is easy. But I'm unable to accomplish the second one
> becausethe program text (which is correct !) is wrapped in a pair of
> quotes, on which Graphviz (dot) chokes. I-ve tried
>   * passing it as an argument (:var=myblock())
>   * calling the Sage code block in a noweb call (<>)
> to no avail.
> 
> I've tried the "verbatim" and "raw" options to :results of my Sage
> block. Again without success.
> 
> It [[
> https://emacs.stackexchange.com/questions/20652/org-babels-call-functionality-wraps-all-results-in-quotes
> ][seems]]
>  that a similar problem exists for Python code...
> 
> Any suggestions ?
> 
> --
> Emmanuel Charpentier




Re: [O] [RFC] Fixing link encoding once and for all

2019-03-03 Thread Nicolas Goaziou
Hello,

stardiviner  writes:

> Nicolas Goaziou  writes:

>> 3. There will be some backward compatibility issues. We can add
>>a checker in Org Lint to catch most of those. For example, we could
>>look at URI where every percent is followed only by 25, 5B, and 5D.
>
> About this, I'm curious, is it possible let this checker search and 
> interactive
> query replace with running recursively in a directory for all Org files. If 
> Org
> updated, I hope my Org documents are update too.

The linter is only effective on the current document, and does not offer
to change it.

Writing a function to replace such links would be great. It is not my
priority at the moment, tho. 

Regards,

-- 
Nicolas Goaziou



Re: [O] [FEATURE] Make header argument :mkdirp yes work for other header arguments not just :tangle

2019-03-03 Thread Nicolas Goaziou
Hello,

stardiviner  writes:

> I hope ~:mkdirp~ header argument can also work for other related header 
> arguments
> like ~:dir~, ~:file~ etc not just ~:tangle~. Like following example.
>
> #+begin_src sh :mkdirp yes :dir "data/code/mkdirp/dir" :file "test" :results 
> file link
> echo "hello"
> #+end_src
>
> So I added a simple patch to make it work.

Thank you. Some comments follow.

>  #+cindex: @samp{mkdirp}, header argument
> -The =mkdirp= header argument creates parent directories for tangled
> -files if the directory does not exist.  =yes= enables directory
> -creation and =no= inhibits directory creation.
> +The =mkdirp= header argument creates parent directories for =dir=
> +header argument specified path and tangled files if the directory does
> +not exist.  =yes= enables directory creation and =no= inhibits
> +directory creation.

Please also support "t" and "nil", or, more generally, make "no" and
"nil" equivalent, and anything else would be "t".

> -(or (and dir (file-name-as-directory (expand-file-name dir)))
> +(or (and dir
> + ;; Possibly create the parent directories for file.
> + (let (fnd (file-name-as-directory (expand-file-name 
> dir)))
> +   (if (and (string= mkdirp "yes") fnd)
> +   (make-directory fnd 'parents

> +;;; test-ob-core.el --- tests for ob-core.el

Tests are in "test-ob.el" file. You should add yours there instead of
creating a new file.

> +(ert-deftest test-ob-core/dir-mkdirp ()
> +  (org-test-with-temp-text
> +   "#+begin_src sh :mkdirp yes :dir \"data/code\"
> +pwd
> +#+end_src"
> +   (org-babel-execute-src-block)
> +   (should (file-directory-p "data/code"

Nitpick: `should' is better outside `org-test-with-temp-text'?

Could you send an updated patch?

Regards,

-- 
Nicolas Goaziou