From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?=C5=81ukasz?= Stelmach Subject: [PATCH] can't :include files in org-publish-project-alist Date: Sat, 21 Aug 2010 16:24:35 +0200 Message-ID: <87occwjb6k.fsf@kotik.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from [140.186.70.92] (port=47917 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Omp03-0007s3-U0 for emacs-orgmode@gnu.org; Sat, 21 Aug 2010 10:24:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Omp02-0001Nb-NR for emacs-orgmode@gnu.org; Sat, 21 Aug 2010 10:24:47 -0400 Received: from lo.gmane.org ([80.91.229.12]:58940) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Omp02-0001NT-Cj for emacs-orgmode@gnu.org; Sat, 21 Aug 2010 10:24:46 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Omp00-0003pz-UF for emacs-orgmode@gnu.org; Sat, 21 Aug 2010 16:24:44 +0200 Received: from 77-253-100-56.adsl.inetia.pl ([77.253.100.56]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 21 Aug 2010 16:24:44 +0200 Received: from lukasz.stelmach by 77-253-100-56.adsl.inetia.pl with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 21 Aug 2010 16:24:44 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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