From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id kOkLOZxZ6GDOiwAAgWs5BA (envelope-from ) for ; Fri, 09 Jul 2021 16:13:48 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 4Ci9NJxZ6GB4agAAB5/wlQ (envelope-from ) for ; Fri, 09 Jul 2021 14:13:48 +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 3446C275FE for ; Fri, 9 Jul 2021 16:13:48 +0200 (CEST) Received: from localhost ([::1]:35798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m1rGF-00045l-7l for larch@yhetil.org; Fri, 09 Jul 2021 10:13:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1rFc-000425-Nb for emacs-orgmode@gnu.org; Fri, 09 Jul 2021 10:13:08 -0400 Received: from ciao.gmane.io ([116.202.254.214]:46406) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1rFa-0005vj-NH for emacs-orgmode@gnu.org; Fri, 09 Jul 2021 10:13:08 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1m1rFY-0008HW-3Y for emacs-orgmode@gnu.org; Fri, 09 Jul 2021 16:13:04 +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: Fri, 09 Jul 2021 16:12:56 +0200 Message-ID: <87r1g7a847.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> <878sduynls.fsf@hornfels.zedat.fu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cancel-Lock: sha1:ka1eYHc9SGSRU/Sn8XBXvZbwmAc= Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io 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-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625840028; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=yuKNxsXgiXwk2xQxNY+B8ImShppTRR3fnmPpE9dVl7s=; b=f3By5GAbzL9/l/0rK8i6r03nc34FiiTOTj8doJ8gV+2OPHaIlAyXiSFDgFVpaCJJjsdP2s JCzzb0OEFE6wx90d0FZo8dVBdeGNXH+MtXdzmV+yGdN6MYsru9RV4Oq6r4S+1EEnbDLVOG pYKbTDT8eACeNcKZePJTe+gNHJd5iX5EzXW+65x6vEY5KcWb+vLJS5lpOhlpjO/witjFKQ TmTfK4uPY5Cc6ZoVmPCLPQkkSEnv3MuEuFGG6MJ+e1mqfWm0/3iW+5dqPCcT8aeCrnn6Wn wy82qkNns1O4GGPvWA77408w+2JioBwb5sjji1bi7p8coTS5nKIVZK6ctbVH9A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625840028; a=rsa-sha256; cv=none; b=kr7Uix6j8pmxM3XrjxTMWscGph6KZ902vYEacjZmk8ve+3K43R9zROILecDiFa+ihK14LQ yexcjBP3UgtbHqVFkr8REPrFabIJeUaErPBF2BHKY0fv4Y7tyeVH2u8KQ43ktXf569iQ2a NrV4b6sK1gsPRxSff1ZloZgiZKTwH8hi7o0ZqMSHk7th7XGuSxVv3+dr7T2HHmPgWWxKrP tASr1ETNngYjDeqqN8TyCQrWcyZrdDcBCX8FfIW7V32xFigiw8/hyLH2wu3OZ5NdISnMxa bc59hRsNpeDUOabZW3Z8q57fzgU5C3+tJzQ3YrWu2sJ2pyWwERpADZxGEvh+1g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=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-Migadu-Spam-Score: -0.90 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-Migadu-Queue-Id: 3446C275FE X-Spam-Score: -0.90 X-Migadu-Scanner: scn1.migadu.com X-TUID: i+6nuI77mJOP "Loris Bennett" writes: > 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? I can't find any response to this question from 1st September 2020. I am still interested in having this in Org and would be willing to offer my extremely modest Elisp skills and moderately modest Git skills to help move this along, assuming it gets enough thumbs up. To recap: Eric's patch allows one to define a subdirectory into which a file generated by exporting will be written, e.g. #+EXPORT_PUB_DIR: ./export This has worked well for me for exporting to PDF Cheers, Loris -- This signature is currently under construction.