GNU bug report logs -
#11491
24.0.96; org-mode: in org-publish.el: #+INCLUDE: cannot deal with spaces in a filename, like this "file name.org"
Previous Next
Reported by: Albert <ab.for.lists <at> gmail.com>
Date: Wed, 16 May 2012 19:50:02 UTC
Severity: normal
Found in version 24.0.96
Done: Bastien <bzg <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
It showed up in a quite difficult set-up, but looking at the regexp
used it seems obvious
the code has problems with this:
in the function org-publish-cache-file-needs-publishing there is the
line (the only line in
org-publish containing the string "INCLUDE")
(while (re-search-forward "^#\\+INCLUDE:[ \t]+\"?\\([^
\t\n\r\"]*\\)\"?[ \t]*.*$" nil t)
this tries to catch a filename, see #+INCLUDE in the org manual, if I
see it correctly
(and I have seen the result confirming this) the parentheses catch
everything from after
the first ", if there is one, up till the first space, tab, newline,
carriage return or second ".
Up till the first space is a problem.
If needed I can try to provide a simple recipe to reproduce my
problem, but I think the problem
is obvious.
I myself removed the ? 's after the " 's to make the " around the
filename mandatory and then
also removed the space after the ^, as in
(while (re-search-forward "^#\\+INCLUDE:[ \t]+\"\\([^\t\n\r\"]*\\)\"[
\t]*.*$" nil t)
This solves my problem.
For easy reference I have included here the whole defun:
(defun org-publish-cache-file-needs-publishing (filename &optional
pub-dir pub-func)
"Check the timestamp of the last publishing of FILENAME.
Return `t', if the file needs publishing. The function also
checks if any included files have been more recently published,
so that the file including them will be republished as well."
(unless org-publish-cache
(error "%s" "`org-publish-cache-file-needs-publishing' called, but
no cache present"))
(let* ((key (org-publish-timestamp-filename filename pub-dir pub-func))
(pstamp (org-publish-cache-get key))
(visiting (find-buffer-visiting filename))
included-files-ctime buf)
(when (equal (file-name-extension filename) "org")
(setq buf (find-file (expand-file-name filename)))
(with-current-buffer buf
(goto-char (point-min))
(while (re-search-forward "^#\\+INCLUDE:[ \t]+\"?\\([^
\t\n\r\"]*\\)\"?[ \t]*.*$" nil t)
(let* ((included-file (expand-file-name (match-string 1))))
(add-to-list 'included-files-ctime
(org-publish-cache-ctime-of-src included-file) t))))
;; FIXME don't kill current buffer
(unless visiting (kill-buffer buf)))
(if (null pstamp)
t
(let ((ctime (org-publish-cache-ctime-of-src filename)))
(or (< pstamp ctime)
(when included-files-ctime
(not (null (delq nil (mapcar (lambda(ct) (< ctime ct))
included-files-ctime))))))))))
Best regards,
Albert.
This bug report was last modified 13 years and 12 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.