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 IOwUGy31TV/odwAA0tVLHw (envelope-from ) for ; Tue, 01 Sep 2020 07:15:57 +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 QE4AFy31TV/9CgAA1q6Kng (envelope-from ) for ; Tue, 01 Sep 2020 07:15:57 +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 D71E5940B9F for ; Tue, 1 Sep 2020 07:15:56 +0000 (UTC) Received: from localhost ([::1]:48888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kD0WJ-0000TS-6G for larch@yhetil.org; Tue, 01 Sep 2020 03:15:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kD0Vl-0000Sm-Oi for emacs-orgmode@gnu.org; Tue, 01 Sep 2020 03:15:21 -0400 Received: from static.214.254.202.116.clients.your-server.de ([116.202.254.214]:44858 helo=ciao.gmane.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kD0Vj-0007GK-On for emacs-orgmode@gnu.org; Tue, 01 Sep 2020 03:15:21 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1kD0Vg-000ANY-RV for emacs-orgmode@gnu.org; Tue, 01 Sep 2020 09:15:16 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: "Loris Bennett" Subject: Re: File local setting for export directory? Date: Tue, 01 Sep 2020 09:15:11 +0200 Message-ID: <878sduynls.fsf@hornfels.zedat.fu-berlin.de> References: <871rkn7r45.fsf@hornfels.zedat.fu-berlin.de> <874kpj1fte.fsf@ericabrahamsen.net> <87pn873p1e.fsf@hornfels.zedat.fu-berlin.de> <87zh7az6k0.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cancel-Lock: sha1:m7VHOeCfPmf81FOReSYGXLLU6Fs= Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/01 01:01:18 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.001, 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.49 X-TUID: swNjq5pTPqyV Eric Abrahamsen writes: > 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! 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.