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

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