emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] can't :include files in org-publish-project-alist
@ 2010-08-21 14:24 Łukasz Stelmach
  2010-08-21 14:34 ` Nick Dokos
  0 siblings, 1 reply; 5+ messages in thread
From: Łukasz Stelmach @ 2010-08-21 14:24 UTC (permalink / raw)
  To: emacs-orgmode

EHLO.

I've just discovered that I can't publish a simple webpage anymore (some
options under C-c C-e sitll work but F and P don't). Short investigation
shows that when I run:

(org-publish-get-project-from-filename "/home/steelman/dydaktyka/index.org")

in the *scratch* buffer I get

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (wrong-type-argument stringp ("index.org"))
  string-match(("index.org") "/home/steelman/dydaktyka/index.org")
  (and i (string-match i filename))
  (or (and i (string-match i filename)) (and (not ...) (string-match xm filename)))
  (if (or (and i ...) (and ... ...)) (progn (setq project-name ...) (throw ... project-name)))
[...]
--8<---------------cut here---------------end--------------->8---

assuming my org-publish-project-alist

--8<---------------cut here---------------start------------->8---
(setq org-publish-project-alist
      '(("dydaktyka-org"
         :base-directory "~/dydaktyka"
         :base-extension "org"
         :publishing-directory "/some/dir"
         :exclude ".*"
         :table-of-contents nil
         :publishing-function org-publish-org-to-html
         :include ("index.org")) ; <---- HERE
        ("dydaktyka-files"
         :base-directory "~/dydaktyka/data"
         :recursive t
         :publishing-directory "/some/dir/data"
         :base-extension "odt"
         :publishing-function org-publish-attachment)
        ("dydaktyka" :components ("dydaktyka-org" "dydaktyka-files"))))
--8<---------------cut here---------------end--------------->8---

However, with parenthesis around "index.org" removed the function seems to
work fine and returns

--8<---------------cut here---------------start------------->8---
("dydaktyka-org" :base-directory "~/dydaktyka" :base-extension "org"
 :publishing-directory "/some/dir"
 :exclude ".*"
 :table-of-contents nil
 :publishing-function org-publish-org-to-html
 :include "index.org")
--8<---------------cut here---------------end--------------->8---

All this leads to a patch like this:

--8<---------------cut here---------------start------------->8---
Fix org-publish to accept list of files to :include again

Fix a regression introduced by Sebastian Rose's 339d6fe4 that makes
org-publish-get-project-from-filename function break if a project's
:include parameter contains a list of strings.

diff --git a/lisp/org-publish.el b/lisp/org-publish.el
index 6324eba..8a02df1 100644
--- a/lisp/org-publish.el
+++ b/lisp/org-publish.el
@@ -466,12 +466,15 @@ matching filenames."
          ;; [[info:org:Selecting%20files]] shows how this is supposed to work:
          (let* ((r (plist-get (cdr prj) :recursive))
                 (b (expand-file-name (plist-get (cdr prj) :base-directory)))
+                (b (concat b (when (string-match "[^/]$" b) "/"))) ; How about Win?
                 (x (or (plist-get (cdr prj) :base-extension) "org"))
                 (e (plist-get (cdr prj) :exclude))
                 (i (plist-get (cdr prj) :include))
                 (xm (concat "^" b (if r ".+" "[^/]+") "\\.\\(" x "\\)$")))
            (when (or
-                  (and i (string-match i filename))
+                  (and i (stringp i) (string-match i filename))
+                  (and i (listp i) (member filename
+                                           (mapcar (lambda (x) (concat b x)) i)))
                   (and
                    (not (and e (string-match e filename)))
                    (string-match xm filename)))
--8<---------------cut here---------------end--------------->8---

-- 
Miłego dnia,
Łukasz Stelmach

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

* Re: [PATCH] can't :include files in org-publish-project-alist
  2010-08-21 14:24 [PATCH] can't :include files in org-publish-project-alist Łukasz Stelmach
@ 2010-08-21 14:34 ` Nick Dokos
  2010-08-21 16:46   ` Łukasz Stelmach
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Dokos @ 2010-08-21 14:34 UTC (permalink / raw)
  To: Łukasz Stelmach; +Cc: nicholas.dokos, emacs-orgmode

=?utf-8?Q?=C5=81ukasz?= Stelmach <lukasz.stelmach@iem.pw.edu.pl> wrote:

>          :include ("index.org")) ; <---- HERE
>... 
> However, with parenthesis around "index.org" removed the function seems to
> work fine and returns
> 

Wasn't that fixed by the following commit?

commit 3529be82eff7906c1182fafbea6012fb6bfec160
Author: Carsten Dominik <carsten.dominik@gmail.com>
Date:   Mon Aug 16 17:27:25 2010 +0200

    Fix interpretation of the :include property as a list of file names

Nick

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

* Re: [PATCH] can't :include files in org-publish-project-alist
  2010-08-21 14:34 ` Nick Dokos
@ 2010-08-21 16:46   ` Łukasz Stelmach
  2010-09-02 14:03     ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Łukasz Stelmach @ 2010-08-21 16:46 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <nicholas.dokos@hp.com> writes:

> =?utf-8?Q?=C5=81ukasz?= Stelmach <lukasz.stelmach@iem.pw.edu.pl> wrote:
>
>>          :include ("index.org")) ; <---- HERE
>>... 
>> However, with parenthesis around "index.org" removed the function seems to
>> work fine and returns
>> 
>
> Wasn't that fixed by the following commit?
>
> commit 3529be82eff7906c1182fafbea6012fb6bfec160
> Author: Carsten Dominik <carsten.dominik@gmail.com>
> Date:   Mon Aug 16 17:27:25 2010 +0200
>
>     Fix interpretation of the :include property as a list of file names

Yes it was. I forgot to pull. However the part with appending "/" to b
might still be valuable at least for building xm regexp. If
:base-directory is set to "~/dydaktyka" (my example) then xm becomes
"^/home/steelman/dydaktyka[^/]+\.\(org\)" which not necessarily makes
sense. It may go like this

   (xm (concat "^" b
    (when (string-match "^[/]$" b) "/")
    (if r ".+" "[^/]+")
     "\\.\\(" x "\\)$")))

-- 
Miłego dnia,
Łukasz Stelmach

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

* Re: Re: [PATCH] can't :include files in org-publish-project-alist
  2010-08-21 16:46   ` Łukasz Stelmach
@ 2010-09-02 14:03     ` Bastien
  2010-09-02 14:46       ` Łukasz Stelmach
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2010-09-02 14:03 UTC (permalink / raw)
  To: Łukasz Stelmach; +Cc: emacs-orgmode

Łukasz Stelmach <lukasz.stelmach@iem.pw.edu.pl> writes:

> Yes it was. I forgot to pull. However the part with appending "/" to b
> might still be valuable at least for building xm regexp. If
> :base-directory is set to "~/dydaktyka" (my example) then xm becomes
> "^/home/steelman/dydaktyka[^/]+\.\(org\)" which not necessarily makes
> sense. It may go like this
>
>    (xm (concat "^" b
>     (when (string-match "^[/]$" b) "/")
>     (if r ".+" "[^/]+")
>      "\\.\\(" x "\\)$")))

:base-directory now allows a directory name with no ending slash.

I did this in a slightly different way than the one you suggest:

,----
|  	  (let* ((r (plist-get (cdr prj) :recursive))
| -		 (b (expand-file-name (plist-get (cdr prj) :base-directory)))
| +		 (b (expand-file-name (file-name-as-directory
| +				       (plist-get (cdr prj) :base-directory))))
|  		 (x (or (plist-get (cdr prj) :base-extension) "org"))
`----

Thanks!

-- 
 Bastien

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

* Re: [PATCH] can't :include files in org-publish-project-alist
  2010-09-02 14:03     ` Bastien
@ 2010-09-02 14:46       ` Łukasz Stelmach
  0 siblings, 0 replies; 5+ messages in thread
From: Łukasz Stelmach @ 2010-09-02 14:46 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bastien.guerry@wikimedia.fr> writes:

> :base-directory now allows a directory name with no ending slash.
>
> I did this in a slightly different way than the one you suggest:
>
> ,----
> |  	  (let* ((r (plist-get (cdr prj) :recursive))
> | -		 (b (expand-file-name (plist-get (cdr prj) :base-directory)))
> | +		 (b (expand-file-name (file-name-as-directory
> | +				       (plist-get (cdr prj) :base-directory))))
> |  		 (x (or (plist-get (cdr prj) :base-extension) "org"))
> `----

Great :-) I didn't know there is the `file-name-as-directory' function.

-- 
Miłego dnia,
Łukasz Stelmach

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

end of thread, other threads:[~2010-09-02 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-21 14:24 [PATCH] can't :include files in org-publish-project-alist Łukasz Stelmach
2010-08-21 14:34 ` Nick Dokos
2010-08-21 16:46   ` Łukasz Stelmach
2010-09-02 14:03     ` Bastien
2010-09-02 14:46       ` Łukasz Stelmach

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