Re: [O] :mkdirp without path specifier
On Sat, May 3, 2014 at 4:19 AM, Achim Gratz wrote: > R. Michael Weylandt writes: >> ;; Possibly create the parent directories for file. >> (when (let ((m (funcall get-spec :mkdirp))) >>(and m (not (string= m "no" >> - (make-directory (file-name-directory file-name) >> 'parents)) >> + (if (file-name-directory file-name) >> + (make-directory (file-name-directory file-name) >> 'parents))) > > If the else clause is intentionally missing, some folks prefer to use > "when" instead of "if" to advertise that fact (see some surrounding code > for example). In this case the additional "if" should be rolled into > the condition check of the former "when" anyway (and let-bind the result > to avoid the duplicate "file-name-directory" call). The conditional is > actually superfluous since we can short-circuit from the "and". > > A patch to that effect has been installed in 063c8b03b7. > Thanks for the feedback and applying a fix.
Re: [O] :mkdirp without path specifier
R. Michael Weylandt writes: > ;; Possibly create the parent directories for file. > (when (let ((m (funcall get-spec :mkdirp))) >(and m (not (string= m "no" > - (make-directory (file-name-directory file-name) > 'parents)) > + (if (file-name-directory file-name) > + (make-directory (file-name-directory file-name) > 'parents))) If the else clause is intentionally missing, some folks prefer to use "when" instead of "if" to advertise that fact (see some surrounding code for example). In this case the additional "if" should be rolled into the condition check of the former "when" anyway (and let-bind the result to avoid the duplicate "file-name-directory" call). The conditional is actually superfluous since we can short-circuit from the "and". A patch to that effect has been installed in 063c8b03b7. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Wavetables for the Waldorf Blofeld: http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables
Re: [O] :mkdirp without path specifier
On Fri, May 2, 2014 at 11:43 PM, R. Michael Weylandt wrote: > Patch attached. Should apply cleanly against master and maint. Bah, botched the formatting. Attached should be fixed. 0001-Fix-tangle-with-mkdirp-yes-tangle-FILE.patch Description: Binary data
Re: [O] :mkdirp without path specifier
On Thu, May 1, 2014 at 3:47 PM, Michael Weylandt wrote: > If it intended that setting :mkdirp yes should break tangling with > 'directory-free' file names? > > I.e., should > # > #+TITLE: test > #+BEGIN_SRC python :mkdirp yes :tangle test.py > print 1+2 > #+END_SRC > ### > > tangle without error? > > It currently doesn't because (file-name-directory "test.py"), which is nil, > gets passed to make-directory, which throws an error. > > The manual is ambiguous, stating only that the arg to :tangle is interpreted > as a path. A strict reading says this shouldn't work, regardless of :mkdirp, > since we're not giving a path, but I think the "understood ./" of :mkdirp no > is reasonable. > Patch attached. Should apply cleanly against master and maint. Michael 0001-Fix-tangle-with-mkdirp-yes-tangle-FILE.patch Description: Binary data
[O] :mkdirp without path specifier
If it intended that setting :mkdirp yes should break tangling with 'directory-free' file names? I.e., should # #+TITLE: test #+BEGIN_SRC python :mkdirp yes :tangle test.py print 1+2 #+END_SRC ### tangle without error? It currently doesn't because (file-name-directory "test.py"), which is nil, gets passed to make-directory, which throws an error. The manual is ambiguous, stating only that the arg to :tangle is interpreted as a path. A strict reading says this shouldn't work, regardless of :mkdirp, since we're not giving a path, but I think the "understood ./" of :mkdirp no is reasonable. I'm not in a position to do so now, but can send a one-line patch to fix tonight if wanted. Michael