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

Packages: emacs, org-mode;

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

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Bastien <bzg <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#11491: closed (24.0.96; org-mode: in org-publish.el:
 #+INCLUDE: cannot deal with spaces in a filename, like this "file
 name.org")
Date: Fri, 18 May 2012 07:21:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Fri, 18 May 2012 09:20:20 +0200
with message-id <87zk96vtu3.fsf <at> altern.org>
and subject line Re: bug#11491: 24.0.96 instead of 23.0.96
has caused the debbugs.gnu.org bug report #11491,
regarding 24.0.96; org-mode: in org-publish.el: #+INCLUDE: cannot deal with spaces in a filename, like this "file name.org"
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
11491: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11491
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Albert <ab.for.lists <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.0.96; org-mode: in org-publish.el: #+INCLUDE: cannot deal with
	spaces in a filename, like this "file name.org"
Date: Wed, 16 May 2012 21:49:34 +0200
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.


[Message part 3 (message/rfc822, inline)]
From: Bastien <bzg <at> gnu.org>
To: Albert <ab.for.lists <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 11491-done <at> debbugs.gnu.org
Subject: Re: bug#11491: 24.0.96 instead of 23.0.96
Date: Fri, 18 May 2012 09:20:20 +0200
Fixed in latest Org (from git.)

Quotes are now mandatory and filenames can contain spaces.

Thanks for suggesting this.

-- 
 Bastien


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.