emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* File local setting for export directory?
@ 2020-08-03 14:15 Loris Bennett
  2020-08-03 15:12 ` Russell Adams
  2020-08-03 23:15 ` Eric Abrahamsen
  0 siblings, 2 replies; 13+ messages in thread
From: Loris Bennett @ 2020-08-03 14:15 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I want to export an org file to a pdf and have the pdf created in
subdirectory relative to the org file.

What's the simplest way to set the export directory in a file local way?

Cheers,

Loris

-- 
This signature is currently under construction.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: File local setting for export directory?
  2020-08-03 14:15 File local setting for export directory? Loris Bennett
@ 2020-08-03 15:12 ` Russell Adams
  2020-08-04  1:29   ` Nick Dokos
  2020-08-03 23:15 ` Eric Abrahamsen
  1 sibling, 1 reply; 13+ messages in thread
From: Russell Adams @ 2020-08-03 15:12 UTC (permalink / raw)
  To: emacs-orgmode

On Mon, Aug 03, 2020 at 04:15:22PM +0200, Loris Bennett wrote:
> I want to export an org file to a pdf and have the pdf created in
> subdirectory relative to the org file.
>
> What's the simplest way to set the export directory in a file local way?

Can you just set your EXPORT_FILE_NAME  to include that directory?

#+EXPORT_FILE_NAME: subdir/Thing.html

You might need a FQPN. You'll have to test.

------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: File local setting for export directory?
  2020-08-03 14:15 File local setting for export directory? Loris Bennett
  2020-08-03 15:12 ` Russell Adams
@ 2020-08-03 23:15 ` Eric Abrahamsen
  2020-08-04  6:25   ` Loris Bennett
  1 sibling, 1 reply; 13+ messages in thread
From: Eric Abrahamsen @ 2020-08-03 23:15 UTC (permalink / raw)
  To: Loris Bennett; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 372 bytes --]

"Loris Bennett" <loris.bennett@fu-berlin.de> writes:

> Hi,
>
> I want to export an org file to a pdf and have the pdf created in
> subdirectory relative to the org file.
>
> What's the simplest way to set the export directory in a file local way?

I suggested the attached diff a while ago, but no one seemed very
interested. I think it might already do what you want.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: export-pub-dir-option.diff --]
[-- Type: text/x-patch, Size: 912 bytes --]

diff --git a/lisp/ox.el b/lisp/ox.el
index 9cf62078a..77cafb20d 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -6417,6 +6417,20 @@ Return file name as a string."
 	      "Output file: " pub-dir nil nil nil
 	      (lambda (n) (string= extension (file-name-extension n t))))))
 	   extension))
+	 (pub-dir (or pub-dir
+		      (and subtreep (org-entry-get
+				     nil "EXPORT_PUB_DIR" 'selective))
+		      (org-with-point-at (point-min)
+			(catch :found
+			  (let ((case-fold-search t))
+			    (while (re-search-forward
+				    "^[ \t]*#\\+EXPORT_PUB_DIR:[ \t]+\\S-"
+				    nil t)
+			      (let ((element (org-element-at-point)))
+				(when (eq 'keyword (org-element-type element))
+				  (throw :found
+					 (org-element-property
+					  :value element))))))))))
 	 (output-file
 	  ;; Build file name.  Enforce EXTENSION over whatever user
 	  ;; may have come up with.  PUB-DIR, if defined, always has

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: File local setting for export directory?
  2020-08-03 15:12 ` Russell Adams
@ 2020-08-04  1:29   ` Nick Dokos
  0 siblings, 0 replies; 13+ messages in thread
From: Nick Dokos @ 2020-08-04  1:29 UTC (permalink / raw)
  To: emacs-orgmode

Russell Adams <RLAdams@AdamsInfoServ.Com> writes:

> On Mon, Aug 03, 2020 at 04:15:22PM +0200, Loris Bennett wrote:
>> I want to export an org file to a pdf and have the pdf created in
>> subdirectory relative to the org file.
>>
>> What's the simplest way to set the export directory in a file local way?
>
> Can you just set your EXPORT_FILE_NAME  to include that directory?
>
> #+EXPORT_FILE_NAME: subdir/Thing.html
>
> You might need a FQPN. You'll have to test.
>

Unfortunately, this produces the tex file in the subdir, but the
xelatex/pdflatex process is still run in the current directory, with
`subdir/file.tex' as input file, so it produces the PDF in the current
directory.

I was wondering why Eric A. suggested a patch, but I guess this
is the reason (N.B. I haven't tried his patch).

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: File local setting for export directory?
  2020-08-03 23:15 ` Eric Abrahamsen
@ 2020-08-04  6:25   ` Loris Bennett
  2020-08-04 10:54     ` Russell Adams
                       ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Loris Bennett @ 2020-08-04  6:25 UTC (permalink / raw)
  To: Org Mode Mailing List

Hi Eric,

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> "Loris Bennett" <loris.bennett@fu-berlin.de> writes:
>
>> Hi,
>>
>> I want to export an org file to a pdf and have the pdf created in
>> subdirectory relative to the org file.
>>
>> What's the simplest way to set the export directory in a file local way?
>
> I suggested the attached diff a while ago, but no one seemed very
> interested. I think it might already do what you want.
>
>
> diff --git a/lisp/ox.el b/lisp/ox.el
> index 9cf62078a..77cafb20d 100644
> --- a/lisp/ox.el
> +++ b/lisp/ox.el
> @@ -6417,6 +6417,20 @@ Return file name as a string."
>  	      "Output file: " pub-dir nil nil nil
>  	      (lambda (n) (string= extension (file-name-extension n t))))))
>  	   extension))
> +	 (pub-dir (or pub-dir
> +		      (and subtreep (org-entry-get
> +				     nil "EXPORT_PUB_DIR" 'selective))
> +		      (org-with-point-at (point-min)
> +			(catch :found
> +			  (let ((case-fold-search t))
> +			    (while (re-search-forward
> +				    "^[ \t]*#\\+EXPORT_PUB_DIR:[ \t]+\\S-"
> +				    nil t)
> +			      (let ((element (org-element-at-point)))
> +				(when (eq 'keyword (org-element-type element))
> +				  (throw :found
> +					 (org-element-property
> +					  :value element))))))))))
>  	 (output-file
>  	  ;; Build file name.  Enforce EXTENSION over whatever user
>  	  ;; may have come up with.  PUB-DIR, if defined, always has
>

Thanks for the patch - it is exactly what I needed.

I'm surprised no-one was interested, although I suppose back then I was
probably also one of the uninterested :-)

I only have one org file from which I generate a number of graphics as
well a PDF which contains the graphics.  Don't many people do a lot more
of that kind of stuff and don't they want to exclude a directory with
generated files from, say, Git?

Any way, +1 for the patch, which I would like to see in Org.

Cheers,

Loris

-- 
This signature is currently under construction.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: File local setting for export directory?
  2020-08-04  6:25   ` Loris Bennett
@ 2020-08-04 10:54     ` Russell Adams
  2020-08-04 11:42       ` Loris Bennett
  2020-08-04 12:15     ` Russell Adams
  2020-08-04 17:04     ` Eric Abrahamsen
  2 siblings, 1 reply; 13+ messages in thread
From: Russell Adams @ 2020-08-04 10:54 UTC (permalink / raw)
  To: emacs-orgmode

On Tue, Aug 04, 2020 at 08:25:13AM +0200, Loris Bennett wrote:
> I'm surprised no-one was interested, although I suppose back then I was
> probably also one of the uninterested :-)

Please remember maintainer time is limited. There are often edge cases for one
user as well for a software as flexible as Org.

> I only have one org file from which I generate a number of graphics as
> well a PDF which contains the graphics.  Don't many people do a lot more
> of that kind of stuff and don't they want to exclude a directory with
> generated files from, say, Git?

I produce all of my professional documentation for customers in Org to Latex and
PDF. I create a directory for each document where all the files go, and so I
expect my .org, .tex, and .pdf files to be in the root of that directory. I will
sometimes add subdirectories for small files (images, source code, etc) that I
include in the final document. Which sounds like opposite the scheme you are
using.

This may also come from my history of code management, makefiles, etc.

------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: File local setting for export directory?
  2020-08-04 10:54     ` Russell Adams
@ 2020-08-04 11:42       ` Loris Bennett
  2020-08-04 11:58         ` Russell Adams
  0 siblings, 1 reply; 13+ messages in thread
From: Loris Bennett @ 2020-08-04 11:42 UTC (permalink / raw)
  To: emacs-orgmode

Russell Adams <RLAdams@AdamsInfoServ.Com> writes:

> On Tue, Aug 04, 2020 at 08:25:13AM +0200, Loris Bennett wrote:
>> I'm surprised no-one was interested, although I suppose back then I was
>> probably also one of the uninterested :-)
>
> Please remember maintainer time is limited. There are often edge cases
> for one user as well for a software as flexible as Org.

I appreciate that, although some form of control of where things are
exported to seems to me to be fairly generic functionality and something
which might be of interest to a number of people.

>> I only have one org file from which I generate a number of graphics as
>> well a PDF which contains the graphics.  Don't many people do a lot more
>> of that kind of stuff and don't they want to exclude a directory with
>> generated files from, say, Git?
>
> I produce all of my professional documentation for customers in Org to
> Latex and PDF. I create a directory for each document where all the
> files go, and so I expect my .org, .tex, and .pdf files to be in the
> root of that directory. I will sometimes add subdirectories for small
> files (images, source code, etc) that I include in the final
> document. Which sounds like opposite the scheme you are using.
>
> This may also come from my history of code management, makefiles, etc.

In actual fact I do also have something similar for, say, presentations.
The .org file and all generated files are in one directory, with some
other files such as logos and photographs included from another directory.

It was mainly just the idea of being able to add a entire subdirectory
to .gitignore which made me think it would be nice to have a way of
changing export directory.

Cheers,

Loris

-- 
This signature is currently under construction.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: File local setting for export directory?
  2020-08-04 11:42       ` Loris Bennett
@ 2020-08-04 11:58         ` Russell Adams
  0 siblings, 0 replies; 13+ messages in thread
From: Russell Adams @ 2020-08-04 11:58 UTC (permalink / raw)
  To: emacs-orgmode

On Tue, Aug 04, 2020 at 01:42:56PM +0200, Loris Bennett wrote:
> > Please remember maintainer time is limited. There are often edge cases
> > for one user as well for a software as flexible as Org.
>
> I appreciate that, although some form of control of where things are
> exported to seems to me to be fairly generic functionality and something
> which might be of interest to a number of people.

Of course. Be patient and let them process the incoming patches in their time. ;]

> It was mainly just the idea of being able to add a entire subdirectory
> to .gitignore which made me think it would be nice to have a way of
> changing export directory.

That's an interesting idea, and one supported by existing conventions. It's
common for Makefiles to write all executables to a subdir, and it's common to
have .hgignore (or git) ignore that directory.

I think here this issue is that while Org has that ability to specify the output
file, the third party tool (latex) which is being called is using the full name
and so the output may end up in the current directory. I think that would
qualify as an unintended side effect.

I think you're correct that Org should try to honor that when calling out, so I
hope that patch gets picked up into core.



------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: File local setting for export directory?
  2020-08-04  6:25   ` Loris Bennett
  2020-08-04 10:54     ` Russell Adams
@ 2020-08-04 12:15     ` Russell Adams
  2020-08-04 14:06       ` Loris Bennett
  2020-08-04 17:04     ` Eric Abrahamsen
  2 siblings, 1 reply; 13+ messages in thread
From: Russell Adams @ 2020-08-04 12:15 UTC (permalink / raw)
  To: emacs-orgmode

On Tue, Aug 04, 2020 at 08:25:13AM +0200, Loris Bennett wrote:
> > diff --git a/lisp/ox.el b/lisp/ox.el
> > index 9cf62078a..77cafb20d 100644
> > --- a/lisp/ox.el
> > +++ b/lisp/ox.el
> > @@ -6417,6 +6417,20 @@ Return file name as a string."
> >  	      "Output file: " pub-dir nil nil nil
> >  	      (lambda (n) (string= extension (file-name-extension n t))))))
> >  	   extension))
> > +	 (pub-dir (or pub-dir
> > +		      (and subtreep (org-entry-get
> > +				     nil "EXPORT_PUB_DIR" 'selective))
> > +		      (org-with-point-at (point-min)
> > +			(catch :found
> > +			  (let ((case-fold-search t))
> > +			    (while (re-search-forward
> > +				    "^[ \t]*#\\+EXPORT_PUB_DIR:[ \t]+\\S-"
> > +				    nil t)
> > +			      (let ((element (org-element-at-point)))
> > +				(when (eq 'keyword (org-element-type element))
> > +				  (throw :found
> > +					 (org-element-property
> > +					  :value element))))))))))
> >  	 (output-file
> >  	  ;; Build file name.  Enforce EXTENSION over whatever user
> >  	  ;; may have come up with.  PUB-DIR, if defined, always has

Regarding this patch, have you looked at setting up Org's Publish functions in a
local variable? That has a "publish destination" which I believe is the pub-dir
in that export function.

https://orgmode.org/manual/Sources-and-destinations.html#Sources-and-destinations

Perhaps this is fixed by another means?

------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: File local setting for export directory?
  2020-08-04 12:15     ` Russell Adams
@ 2020-08-04 14:06       ` Loris Bennett
  0 siblings, 0 replies; 13+ messages in thread
From: Loris Bennett @ 2020-08-04 14:06 UTC (permalink / raw)
  To: emacs-orgmode

Russell Adams <RLAdams@AdamsInfoServ.Com> writes:

> On Tue, Aug 04, 2020 at 08:25:13AM +0200, Loris Bennett wrote:
>> > diff --git a/lisp/ox.el b/lisp/ox.el
>> > index 9cf62078a..77cafb20d 100644
>> > --- a/lisp/ox.el
>> > +++ b/lisp/ox.el
>> > @@ -6417,6 +6417,20 @@ Return file name as a string."
>> >  	      "Output file: " pub-dir nil nil nil
>> >  	      (lambda (n) (string= extension (file-name-extension n t))))))
>> >  	   extension))
>> > +	 (pub-dir (or pub-dir
>> > +		      (and subtreep (org-entry-get
>> > +				     nil "EXPORT_PUB_DIR" 'selective))
>> > +		      (org-with-point-at (point-min)
>> > +			(catch :found
>> > +			  (let ((case-fold-search t))
>> > +			    (while (re-search-forward
>> > +				    "^[ \t]*#\\+EXPORT_PUB_DIR:[ \t]+\\S-"
>> > +				    nil t)
>> > +			      (let ((element (org-element-at-point)))
>> > +				(when (eq 'keyword (org-element-type element))
>> > +				  (throw :found
>> > +					 (org-element-property
>> > +					  :value element))))))))))
>> >  	 (output-file
>> >  	  ;; Build file name.  Enforce EXTENSION over whatever user
>> >  	  ;; may have come up with.  PUB-DIR, if defined, always has
>
> Regarding this patch, have you looked at setting up Org's Publish functions in a
> local variable? That has a "publish destination" which I believe is the pub-dir
> in that export function.
>
> https://orgmode.org/manual/Sources-and-destinations.html#Sources-and-destinations
>
> Perhaps this is fixed by another means?

Maybe.  I did look at "publish destination" but I couldn't get it to
work, possibly because (a) I am not quite clear on difference between
"exporting" and "publishing" and (b) I was feeling lazy and it seemed
like an overly complex way of achieving what I wanted (not that patching
the source can really be considered much less complex :-/ ).

Cheers,

Loris

-- 
This signature is currently under construction.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: File local setting for export directory?
  2020-08-04  6:25   ` Loris Bennett
  2020-08-04 10:54     ` Russell Adams
  2020-08-04 12:15     ` Russell Adams
@ 2020-08-04 17:04     ` Eric Abrahamsen
  2020-09-01  7:15       ` Loris Bennett
  2 siblings, 1 reply; 13+ messages in thread
From: Eric Abrahamsen @ 2020-08-04 17:04 UTC (permalink / raw)
  To: Loris Bennett; +Cc: Org Mode Mailing List

Loris Bennett <loris.bennett@fu-berlin.de> writes:

> Hi Eric,
>
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> "Loris Bennett" <loris.bennett@fu-berlin.de> writes:
>>
>>> Hi,
>>>
>>> I want to export an org file to a pdf and have the pdf created in
>>> subdirectory relative to the org file.
>>>
>>> What's the simplest way to set the export directory in a file local way?
>>
>> I suggested the attached diff a while ago, but no one seemed very
>> interested. I think it might already do what you want.
>>
>>
>> diff --git a/lisp/ox.el b/lisp/ox.el
>> index 9cf62078a..77cafb20d 100644
>> --- a/lisp/ox.el
>> +++ b/lisp/ox.el
>> @@ -6417,6 +6417,20 @@ Return file name as a string."
>>  	      "Output file: " pub-dir nil nil nil
>>  	      (lambda (n) (string= extension (file-name-extension n t))))))
>>  	   extension))
>> +	 (pub-dir (or pub-dir
>> +		      (and subtreep (org-entry-get
>> +				     nil "EXPORT_PUB_DIR" 'selective))
>> +		      (org-with-point-at (point-min)
>> +			(catch :found
>> +			  (let ((case-fold-search t))
>> +			    (while (re-search-forward
>> +				    "^[ \t]*#\\+EXPORT_PUB_DIR:[ \t]+\\S-"
>> +				    nil t)
>> +			      (let ((element (org-element-at-point)))
>> +				(when (eq 'keyword (org-element-type element))
>> +				  (throw :found
>> +					 (org-element-property
>> +					  :value element))))))))))
>>  	 (output-file
>>  	  ;; Build file name.  Enforce EXTENSION over whatever user
>>  	  ;; may have come up with.  PUB-DIR, if defined, always has
>>
>
> Thanks for the patch - it is exactly what I needed.
>
> I'm surprised no-one was interested, although I suppose back then I was
> probably also one of the uninterested :-)

Oh I'm not blaming anyone! There are a lot of patches coming down here,
and a lot of ideas for Org, and it's hard to keep up. I don't think I
did a very good job of stating my case, either.

I actually hadn't thought of how the latex process might go haywire with
an absolute export file name. My motivation was simply that "next to my
*.org" files is pretty much never where I want exported files to end up.
I want to send them to ~/tmp, or to a directory that's shared with
colleagues via syncthing. In fact what I really want is to export to the
value of ATTACH_DIR, because then I can immediately use all the attach
tools on the exported files.

Latex compilation is a nice additional argument, though!

Eric


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: File local setting for export directory?
  2020-08-04 17:04     ` Eric Abrahamsen
@ 2020-09-01  7:15       ` Loris Bennett
  2021-07-09 14:12         ` Loris Bennett
  0 siblings, 1 reply; 13+ messages in thread
From: Loris Bennett @ 2020-09-01  7:15 UTC (permalink / raw)
  To: emacs-orgmode

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Loris Bennett <loris.bennett@fu-berlin.de> writes:
>
>> Hi Eric,
>>
>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>
>>> "Loris Bennett" <loris.bennett@fu-berlin.de> writes:
>>>
>>>> Hi,
>>>>
>>>> I want to export an org file to a pdf and have the pdf created in
>>>> subdirectory relative to the org file.
>>>>
>>>> What's the simplest way to set the export directory in a file local way?
>>>
>>> I suggested the attached diff a while ago, but no one seemed very
>>> interested. I think it might already do what you want.
>>>
>>>
>>> diff --git a/lisp/ox.el b/lisp/ox.el
>>> index 9cf62078a..77cafb20d 100644
>>> --- a/lisp/ox.el
>>> +++ b/lisp/ox.el
>>> @@ -6417,6 +6417,20 @@ Return file name as a string."
>>>  	      "Output file: " pub-dir nil nil nil
>>>  	      (lambda (n) (string= extension (file-name-extension n t))))))
>>>  	   extension))
>>> +	 (pub-dir (or pub-dir
>>> +		      (and subtreep (org-entry-get
>>> +				     nil "EXPORT_PUB_DIR" 'selective))
>>> +		      (org-with-point-at (point-min)
>>> +			(catch :found
>>> +			  (let ((case-fold-search t))
>>> +			    (while (re-search-forward
>>> +				    "^[ \t]*#\\+EXPORT_PUB_DIR:[ \t]+\\S-"
>>> +				    nil t)
>>> +			      (let ((element (org-element-at-point)))
>>> +				(when (eq 'keyword (org-element-type element))
>>> +				  (throw :found
>>> +					 (org-element-property
>>> +					  :value element))))))))))
>>>  	 (output-file
>>>  	  ;; Build file name.  Enforce EXTENSION over whatever user
>>>  	  ;; may have come up with.  PUB-DIR, if defined, always has
>>>
>>
>> Thanks for the patch - it is exactly what I needed.
>>
>> I'm surprised no-one was interested, although I suppose back then I was
>> probably also one of the uninterested :-)
>
> Oh I'm not blaming anyone! There are a lot of patches coming down here,
> and a lot of ideas for Org, and it's hard to keep up. I don't think I
> did a very good job of stating my case, either.
>
> I actually hadn't thought of how the latex process might go haywire with
> an absolute export file name. My motivation was simply that "next to my
> *.org" files is pretty much never where I want exported files to end up.
> I want to send them to ~/tmp, or to a directory that's shared with
> colleagues via syncthing. In fact what I really want is to export to the
> value of ATTACH_DIR, because then I can immediately use all the attach
> tools on the exported files.
>
> Latex compilation is a nice additional argument, though!

It's a month later and, having updated Org in the meantime, I'm having
to patch again.  

What would be the way forward in terms of getting the patch into Org?

Cheers,

Loris
-- 
This signature is currently under construction.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: File local setting for export directory?
  2020-09-01  7:15       ` Loris Bennett
@ 2021-07-09 14:12         ` Loris Bennett
  0 siblings, 0 replies; 13+ messages in thread
From: Loris Bennett @ 2021-07-09 14:12 UTC (permalink / raw)
  To: emacs-orgmode

"Loris Bennett" <loris.bennett@fu-berlin.de> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Loris Bennett <loris.bennett@fu-berlin.de> writes:
>>
>>> Hi Eric,
>>>
>>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>>
>>>> "Loris Bennett" <loris.bennett@fu-berlin.de> writes:
>>>>
>>>>> Hi,
>>>>>
>>>>> I want to export an org file to a pdf and have the pdf created in
>>>>> subdirectory relative to the org file.
>>>>>
>>>>> What's the simplest way to set the export directory in a file local way?
>>>>
>>>> I suggested the attached diff a while ago, but no one seemed very
>>>> interested. I think it might already do what you want.
>>>>
>>>>
>>>> diff --git a/lisp/ox.el b/lisp/ox.el
>>>> index 9cf62078a..77cafb20d 100644
>>>> --- a/lisp/ox.el
>>>> +++ b/lisp/ox.el
>>>> @@ -6417,6 +6417,20 @@ Return file name as a string."
>>>>  	      "Output file: " pub-dir nil nil nil
>>>>  	      (lambda (n) (string= extension (file-name-extension n t))))))
>>>>  	   extension))
>>>> +	 (pub-dir (or pub-dir
>>>> +		      (and subtreep (org-entry-get
>>>> +				     nil "EXPORT_PUB_DIR" 'selective))
>>>> +		      (org-with-point-at (point-min)
>>>> +			(catch :found
>>>> +			  (let ((case-fold-search t))
>>>> +			    (while (re-search-forward
>>>> +				    "^[ \t]*#\\+EXPORT_PUB_DIR:[ \t]+\\S-"
>>>> +				    nil t)
>>>> +			      (let ((element (org-element-at-point)))
>>>> +				(when (eq 'keyword (org-element-type element))
>>>> +				  (throw :found
>>>> +					 (org-element-property
>>>> +					  :value element))))))))))
>>>>  	 (output-file
>>>>  	  ;; Build file name.  Enforce EXTENSION over whatever user
>>>>  	  ;; may have come up with.  PUB-DIR, if defined, always has
>>>>
>>>
>>> Thanks for the patch - it is exactly what I needed.
>>>
>>> I'm surprised no-one was interested, although I suppose back then I was
>>> probably also one of the uninterested :-)
>>
>> Oh I'm not blaming anyone! There are a lot of patches coming down here,
>> and a lot of ideas for Org, and it's hard to keep up. I don't think I
>> did a very good job of stating my case, either.
>>
>> I actually hadn't thought of how the latex process might go haywire with
>> an absolute export file name. My motivation was simply that "next to my
>> *.org" files is pretty much never where I want exported files to end up.
>> I want to send them to ~/tmp, or to a directory that's shared with
>> colleagues via syncthing. In fact what I really want is to export to the
>> value of ATTACH_DIR, because then I can immediately use all the attach
>> tools on the exported files.
>>
>> Latex compilation is a nice additional argument, though!
>
> It's a month later and, having updated Org in the meantime, I'm having
> to patch again.  
>
> What would be the way forward in terms of getting the patch into Org?

I can't find any response to this question from 1st September 2020.  I
am still interested in having this in Org and would be willing to offer
my extremely modest Elisp skills and moderately modest Git skills to
help move this along, assuming it gets enough thumbs up.

To recap:

Eric's patch allows one to define a subdirectory into which a file
generated by exporting will be written, e.g.

  #+EXPORT_PUB_DIR: ./export

This has worked well for me for exporting to PDF

Cheers,

Loris

-- 
This signature is currently under construction.



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-07-09 14:13 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-03 14:15 File local setting for export directory? Loris Bennett
2020-08-03 15:12 ` Russell Adams
2020-08-04  1:29   ` Nick Dokos
2020-08-03 23:15 ` Eric Abrahamsen
2020-08-04  6:25   ` Loris Bennett
2020-08-04 10:54     ` Russell Adams
2020-08-04 11:42       ` Loris Bennett
2020-08-04 11:58         ` Russell Adams
2020-08-04 12:15     ` Russell Adams
2020-08-04 14:06       ` Loris Bennett
2020-08-04 17:04     ` Eric Abrahamsen
2020-09-01  7:15       ` Loris Bennett
2021-07-09 14:12         ` Loris Bennett

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).