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 CNmYF92aKF/QCgAA0tVLHw (envelope-from ) for ; Mon, 03 Aug 2020 23:16:45 +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 oO1jE92aKF+EagAA1q6Kng (envelope-from ) for ; Mon, 03 Aug 2020 23:16:45 +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 B00E6940415 for ; Mon, 3 Aug 2020 23:16:44 +0000 (UTC) Received: from localhost ([::1]:57996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k2jhD-0007Es-DH for larch@yhetil.org; Mon, 03 Aug 2020 19:16:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k2jgg-0007Ek-2F for emacs-orgmode@gnu.org; Mon, 03 Aug 2020 19:16:10 -0400 Received: from ericabrahamsen.net ([52.70.2.18]:36734 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 1k2jgd-0006ho-La for emacs-orgmode@gnu.org; Mon, 03 Aug 2020 19:16:09 -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 21A9AFA097; Mon, 3 Aug 2020 23:15:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericabrahamsen.net; s=mail; t=1596496559; bh=Nj+fg/PuObRMOG6uf9gSf3nkoHIw1oioKt0y6jnKKCM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=RtkORpWDKOPScMp2Niby8zbrZhq2Qcf1yt/idj9L393mKvUd8x6bqmE1N1+oAVSsx D8uRTzFWZkNlYvbKmSGWAEmdH9w5y6WtMhDDbJPjVWcJesD/vU8tAKCa0/J3hjlkP8 HW7klBG14M04SS1RtJjfkPTVGzonhFR7+pXoiqc0= From: Eric Abrahamsen To: "Loris Bennett" Subject: Re: File local setting for export directory? References: <871rkn7r45.fsf@hornfels.zedat.fu-berlin.de> Date: Mon, 03 Aug 2020 16:15:57 -0700 In-Reply-To: <871rkn7r45.fsf@hornfels.zedat.fu-berlin.de> (Loris Bennett's message of "Mon, 03 Aug 2020 16:15:22 +0200") Message-ID: <874kpj1fte.fsf@ericabrahamsen.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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/03 19:15:59 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: emacs-orgmode@gnu.org 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=RtkORpWD; 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: tGW+4y7jtBPQ --=-=-= Content-Type: text/plain "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. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=export-pub-dir-option.diff 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 --=-=-=--