From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id UNq9DbP/KF8kTQAA0tVLHw (envelope-from ) for ; Tue, 04 Aug 2020 06:26:59 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id MO2wCbP/KF9AJwAA1q6Kng (envelope-from ) for ; Tue, 04 Aug 2020 06:26:59 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7701C9403AB for ; Tue, 4 Aug 2020 06:26:58 +0000 (UTC) Received: from localhost ([::1]:55860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k2qPX-0002QT-UG for larch@yhetil.org; Tue, 04 Aug 2020 02:26:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k2qOr-0002QH-DC for emacs-orgmode@gnu.org; Tue, 04 Aug 2020 02:26:13 -0400 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]:38709) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k2qOp-0002Od-72 for emacs-orgmode@gnu.org; Tue, 04 Aug 2020 02:26:13 -0400 Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost.zedat.fu-berlin.de (Exim 4.93) for emacs-orgmode@gnu.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (envelope-from ) id 1k2qOj-0008iD-VW; Tue, 04 Aug 2020 08:26:05 +0200 Received: from [130.133.144.203] (helo=hornfels) by inpost2.zedat.fu-berlin.de (Exim 4.93) for emacs-orgmode@gnu.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (envelope-from ) id 1k2qOj-000jrY-Nl; Tue, 04 Aug 2020 08:26:05 +0200 From: Loris Bennett To: Org Mode Mailing List Subject: Re: File local setting for export directory? In-Reply-To: <874kpj1fte.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Mon, 3 Aug 2020 16:15:57 -0700") Date: Tue, 4 Aug 2020 08:25:13 +0200 References: <871rkn7r45.fsf@hornfels.zedat.fu-berlin.de> <874kpj1fte.fsf@ericabrahamsen.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Message-ID: <87pn873p1e.fsf@hornfels.zedat.fu-berlin.de> MIME-Version: 1.0 Content-Type: text/plain X-Original-Sender: loris.bennett@fu-berlin.de X-Originating-IP: 130.133.144.203 Received-SPF: pass client-ip=130.133.4.66; envelope-from=loris@zedat.fu-berlin.de; helo=outpost1.zedat.fu-berlin.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/04 02:26:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -0.01 X-TUID: Xj1gmA8MnOB0 Hi Eric, Eric Abrahamsen writes: > "Loris Bennett" 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.