[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File local setting for export directory?

From: Loris Bennett
Subject: Re: File local setting for export directory?
Date: Tue, 4 Aug 2020 08:25:13 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

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.



This signature is currently under construction.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]