From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id cEtaNQGWKV/7aQAA0tVLHw (envelope-from ) for ; Tue, 04 Aug 2020 17:08:17 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id MK4JMQGWKV9wMQAAbx9fmQ (envelope-from ) for ; Tue, 04 Aug 2020 17:08:17 +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 3C41E9404D3 for ; Tue, 4 Aug 2020 17:08:17 +0000 (UTC) Received: from localhost ([::1]:56508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k30QB-0008A2-0G for larch@yhetil.org; Tue, 04 Aug 2020 13:08:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k30MQ-0002j0-1R for emacs-orgmode@gnu.org; Tue, 04 Aug 2020 13:04:22 -0400 Received: from ericabrahamsen.net ([52.70.2.18]:58340 helo=mail.ericabrahamsen.net) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k30MN-0005tB-Pp for emacs-orgmode@gnu.org; Tue, 04 Aug 2020 13:04:21 -0400 Received: from localhost (c-73-254-86-141.hsd1.wa.comcast.net [73.254.86.141]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 4849EFA097; Tue, 4 Aug 2020 17:04:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericabrahamsen.net; s=mail; t=1596560657; bh=nqRhKbmHpMlsY8VC+vX61RxtmUVdrLfvk0iRyBdlfvM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=v0rMKMR4O577JI+p/sGr6jNQQr+T1Fp8M550WKNh6b/l/rlVFFI+GIoIX0XOiw0i1 6PS43l4kFWqIc5b4blK/hPGzdDsPpZTuzH3pdzGzWo6lTX++VLjW0d3l2kdzJhhlpZ 2e1N3aVuHF/UMs6Ki56HPsI2CG9mIoFNZNZrG0vE= From: Eric Abrahamsen To: Loris Bennett Subject: Re: File local setting for export directory? References: <871rkn7r45.fsf@hornfels.zedat.fu-berlin.de> <874kpj1fte.fsf@ericabrahamsen.net> <87pn873p1e.fsf@hornfels.zedat.fu-berlin.de> Date: Tue, 04 Aug 2020 10:04:15 -0700 In-Reply-To: <87pn873p1e.fsf@hornfels.zedat.fu-berlin.de> (Loris Bennett's message of "Tue, 4 Aug 2020 08:25:13 +0200") Message-ID: <87zh7az6k0.fsf@ericabrahamsen.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=52.70.2.18; envelope-from=eric@ericabrahamsen.net; helo=mail.ericabrahamsen.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/04 13:04:18 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=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: , Cc: Org Mode Mailing List Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=ericabrahamsen.net header.s=mail header.b=v0rMKMR4; dmarc=pass (policy=none) header.from=ericabrahamsen.net; 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.71 X-TUID: 6qtK/Eh9vkSp Loris Bennett writes: > 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 :-) 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