diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2009-02-26 22:18:16 +0100 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2009-02-26 22:18:16 +0100 |
commit | b4455950e3df7d7d9c7b025ca67765bda8ba3da3 (patch) | |
tree | 85ceaca3bea97b4fc7cc6d29be850e1d26f965ae | |
parent | c91bca9d1c36c6bb8f5da80ad5298ac95cad0a6b (diff) | |
download | org-mode-b4455950e3df7d7d9c7b025ca67765bda8ba3da3.tar.gz |
Publishing: Fix bug with finding project for a file.
Ian Barton writes:
>
> This has been happening for a while. I suspect it's something in my
> settings, but I can't work out what. When I publish a single file, I
> get the following error:
>
> Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
> file-truename(nil)
> org-publish-file("/home/ian/nfs/firewall/Documents/org/holiday/holiday.org")
> org-publish-current-file(nil)
> call-interactively(org-publish-current-file)
> org-export(nil)
> call-interactively(org-export)
>
> Publishing a whole project works fine.
This was caused by an attempt of the publishing code to always find
the top enclosing project. While this makes sense when publishing a
project, for a single file we want just the smallest enclosing
project. This commit makes sure that this difference is treated
correctly.
-rwxr-xr-x | lisp/ChangeLog | 4 | ||||
-rw-r--r-- | lisp/org-publish.el | 11 |
2 files changed, 10 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8860d8c..496f7a3 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2009-02-26 Carsten Dominik <carsten.dominik@gmail.com> + * org-publish.el (org-publish-get-project-from-filename): New + optional argument UP. Only find the top project if UP is set. + (org-publish-current-project): Find the top encloding project. + * org-agenda.el (org-agenda-before-write-hook) (org-agenda-add-entry-text-maxlines): New options. (org-write-agenda): Run the new hook in the temporary buffer. diff --git a/lisp/org-publish.el b/lisp/org-publish.el index 4af6b54..cbb2222 100644 --- a/lisp/org-publish.el +++ b/lisp/org-publish.el @@ -469,13 +469,14 @@ matching filenames." include-list) org-publish-temp-files)) -(defun org-publish-get-project-from-filename (filename) +(defun org-publish-get-project-from-filename (filename &optional up) "Return the project FILENAME belongs." (let* ((project-name (cdr (assoc (expand-file-name filename) org-publish-files-alist)))) - (dolist (prj org-publish-project-alist) - (if (member project-name (plist-get (cdr prj) :components)) - (setq project-name (car prj)))) + (when up + (dolist (prj org-publish-project-alist) + (if (member project-name (plist-get (cdr prj) :components)) + (setq project-name (car prj))))) (assoc project-name org-publish-project-alist))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -742,7 +743,7 @@ the project." (interactive "P") (org-publish-initialize-files-alist) (save-window-excursion - (let ((project (org-publish-get-project-from-filename (buffer-file-name))) + (let ((project (org-publish-get-project-from-filename (buffer-file-name) 'up)) (org-publish-use-timestamps-flag (if force nil org-publish-use-timestamps-flag))) (if (not project) |