emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Variable publishing-directory?
@ 2011-08-15 18:11 Kai Tetzlaff
  2011-08-18  6:54 ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Kai Tetzlaff @ 2011-08-15 18:11 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 474 bytes --]


I'm using an org-mode publishing project in different locations and
would like to set different (location dependent) values for the
publishing-directory property (e.g. use different servers to upload
published files).

There might be a way to do that with the current org-mode which i just
did not find. In that case, please let me know how. Otherwise the
attached patch seems to provide the desired effect and it would be great
if it could be added to org-mode.

BR,
Kai


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: allow variable publishing-dir --]
[-- Type: text/x-patch, Size: 481 bytes --]

diff --git a/lisp/org-publish.el b/lisp/org-publish.el
index ccd2068..4ed2346 100644
--- a/lisp/org-publish.el
+++ b/lisp/org-publish.el
@@ -685,7 +685,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)

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Variable publishing-directory?
  2011-08-15 18:11 Variable publishing-directory? Kai Tetzlaff
@ 2011-08-18  6:54 ` Bastien
  2011-08-18  8:17   ` Variable publishing-directory? (resent with patch as attachment) Kai Tetzlaff
  2011-08-18  8:17   ` Variable publishing-directory? Kai Tetzlaff
  0 siblings, 2 replies; 6+ messages in thread
From: Bastien @ 2011-08-18  6:54 UTC (permalink / raw)
  To: emacs-orgmode

Hi Kai,

Kai Tetzlaff <kai.tetzlaff@web.de> writes:

> There might be a way to do that with the current org-mode which i just
> did not find. In that case, please let me know how. Otherwise the
> attached patch seems to provide the desired effect and it would be great
> if it could be added to org-mode.

The patch looks good but I'd like to understand it better.
Can you send an example configuration working with your patch?

Also, please try to send git patch using these conventions:
http://orgmode.org/worg/org-contribute.html#sec-5

Thanks a lot!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Variable publishing-directory?
  2011-08-18  6:54 ` Bastien
  2011-08-18  8:17   ` Variable publishing-directory? (resent with patch as attachment) Kai Tetzlaff
@ 2011-08-18  8:17   ` Kai Tetzlaff
  1 sibling, 0 replies; 6+ messages in thread
From: Kai Tetzlaff @ 2011-08-18  8:17 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1734 bytes --]

Bastien <bzg@altern.org> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: eval :publishing-directory --]
[-- Type: text/x-patch, Size: 941 bytes --]

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Variable publishing-directory? (resent with patch as attachment)
  2011-08-18  6:54 ` Bastien
@ 2011-08-18  8:17   ` Kai Tetzlaff
  2011-10-22  8:41     ` [Accepted] " Bastien Guerry
  2011-10-29 11:55     ` Bastien
  2011-08-18  8:17   ` Variable publishing-directory? Kai Tetzlaff
  1 sibling, 2 replies; 6+ messages in thread
From: Kai Tetzlaff @ 2011-08-18  8:17 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1734 bytes --]

Bastien <bzg@altern.org> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: eval :publishing-directory --]
[-- Type: text/x-patch, Size: 941 bytes --]

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Accepted] Variable publishing-directory? (resent with patch as attachment)
  2011-08-18  8:17   ` Variable publishing-directory? (resent with patch as attachment) Kai Tetzlaff
@ 2011-10-22  8:41     ` Bastien Guerry
  2011-10-29 11:55     ` Bastien
  1 sibling, 0 replies; 6+ messages in thread
From: Bastien Guerry @ 2011-10-22  8:41 UTC (permalink / raw)
  To: emacs-orgmode

Patch 895 (http://patchwork.newartisans.com/patch/895/) is now "Accepted".

Maintainer comment: none

This relates to the following submission:

http://mid.gmane.org/%3C7ipqk3qfxn.fsf%40mack.tetzco.de%3E

Here is the original message containing the patch:

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [O] Variable publishing-directory? (resent with patch as attachment)
> Date: Thu, 18 Aug 2011 13:17:56 -0000
> From: Kai Tetzlaff <kai.tetzlaff@web.de>
> X-Patchwork-Id: 895
> Message-Id: <7ipqk3qfxn.fsf@mack.tetzco.de>
> To: emacs-orgmode@gnu.org
> 
> Bastien <bzg@altern.org> 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.
> 
> 
> 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
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Variable publishing-directory? (resent with patch as attachment)
  2011-08-18  8:17   ` Variable publishing-directory? (resent with patch as attachment) Kai Tetzlaff
  2011-10-22  8:41     ` [Accepted] " Bastien Guerry
@ 2011-10-29 11:55     ` Bastien
  1 sibling, 0 replies; 6+ messages in thread
From: Bastien @ 2011-10-29 11:55 UTC (permalink / raw)
  To: emacs-orgmode

Hi Kay,

Kai Tetzlaff <kai.tetzlaff@web.de> writes:

> 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.

Thanks for the detailed explanations -- for the record, 
this patch has been applied a while ago.

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-10-29 11:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-15 18:11 Variable publishing-directory? Kai Tetzlaff
2011-08-18  6:54 ` Bastien
2011-08-18  8:17   ` Variable publishing-directory? (resent with patch as attachment) Kai Tetzlaff
2011-10-22  8:41     ` [Accepted] " Bastien Guerry
2011-10-29 11:55     ` Bastien
2011-08-18  8:17   ` Variable publishing-directory? Kai Tetzlaff

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).