From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kai Tetzlaff Subject: Re: Variable publishing-directory? (resent with patch as attachment) Date: Thu, 18 Aug 2011 10:17:56 +0200 Message-ID: <7ipqk3qfxn.fsf@mack.tetzco.de> References: <7imxfapmtl.fsf@mack.tetzco.de> <87wrebky5v.fsf@altern.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:42979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qty0X-0000Bl-OU for emacs-orgmode@gnu.org; Thu, 18 Aug 2011 04:31:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qty0W-0007Xh-Ax for emacs-orgmode@gnu.org; Thu, 18 Aug 2011 04:31:21 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:62665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qty0V-0007Xb-VE for emacs-orgmode@gnu.org; Thu, 18 Aug 2011 04:31:20 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.tetzco.de (Postfix) with ESMTP id 204DC14AA0E5 for ; Thu, 18 Aug 2011 10:31:18 +0200 (CEST) Received: from mail.tetzco.de ([127.0.0.1]) by localhost (mini.tetzco.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GlQ0yyhEqtgr for ; Thu, 18 Aug 2011 10:31:17 +0200 (CEST) Received: from mack.tetzco.de (mack.tetzco.de [IPv6:2001:a60:f05d:1:226:bbff:fe03:b2e9]) by mail.tetzco.de (Postfix) with ESMTPS id 68BB114AA0D4 for ; Thu, 18 Aug 2011 10:31:17 +0200 (CEST) In-Reply-To: <87wrebky5v.fsf@altern.org> (Bastien's message of "Thu, 18 Aug 2011 08:54:04 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Content-Disposition: inline Bastien writes: Hi Bastien, > The patch looks good but I'd like to understand it better. > Can you send an example configuration working with your patch? In org-publish-project-alist, i have HTML publishing projects which should be published to different target directories depending on e.g. where emacs is running (which i determine in my init files using the MAC address of the default GW, the name the machine, ...). Here is an example: At home, i publish to a local directory (:publishing-directory "~/tmp/publish-test") but at work i would like to publish directly to a webserver (:publishing-directory "/plinkx:doxydoc:~/public_html/publish-test" - this is on w32, using tramps PuTTY/plink). To avoid having to change the definition of the publishing project when i change locations i would like to construct the actual value of :publishing-directory by calling a function: ("publishing-dir-test" :base-directory "~/Documents/Work/RS" :recursive t :base-extension "org" :exclude-tags ("intern") :publishing-directory '(expand-file-name "publish-test" kt:org-default-publishing-dir) :publishing-function org-publish-org-to-html) Depending on the location i'm in, 'kt:org-default-publishing-dir' would be set to either "~/tmp" or "/plinkx:doxydoc:~/public_html". Without the patch, the example above does not work as the value of :publishing-directory does not get evaluated. > Also, please try to send git patch using these conventions: > http://orgmode.org/worg/org-contribute.html#sec-5 > > Thanks a lot! Thanks for the hint. I've attached a revised version of the patch which includes a changelog/commit msg - i hope that works for you. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=publish-dir-eval.patch Content-Description: eval :publishing-directory Publish: allow dynamic construction of the publish destination. * org-publish.el (org-publish-file): Added 'eval'ing the value of the :publishing-directory property before using it as destination of the publishing project. This allows to construct the publish destination directory dynamically at run-time using the return value of a function. TINYCHANGE --- lisp/org-publish.el | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lisp/org-publish.el b/lisp/org-publish.el index e2213c5..518c1bf 100644 --- a/lisp/org-publish.el +++ b/lisp/org-publish.el @@ -684,7 +684,7 @@ See `org-publish-projects'." (pub-dir (file-name-as-directory (file-truename - (or (plist-get project-plist :publishing-directory) + (or (eval (plist-get project-plist :publishing-directory)) (error "Project %s does not have :publishing-directory defined" (car project)))))) tmp-pub-dir) -- 1.7.5.4 --=-=-=--