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: org-mode, emacs;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11491 in the body.
You can then email your comments to 11491 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11491; Package emacs. (Wed, 16 May 2012 19:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Albert <ab.for.lists <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 16 May 2012 19:50:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

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.




Information forwarded to bug-gnu-emacs <at> gnu.org, emacs-orgmode <at> gnu.org:
bug#11491; Package emacs,org-mode. (Fri, 18 May 2012 02:28:02 GMT) Full text and rfc822 format available.

Message #8 received at 11491 <at> debbugs.gnu.org (full text, mbox):

From: Albert <ab.for.lists <at> gmail.com>
To: 11491 <at> debbugs.gnu.org
Subject: 24.0.96 instead of 23.0.96
Date: Fri, 18 May 2012 04:27:18 +0200
The version string has an typo in the original report.

I guess it is better to send it again with the correct version in the subject.

Should/Can I close this bug-report?

I will try.

Albert.




Information forwarded to bug-gnu-emacs <at> gnu.org, emacs-orgmode <at> gnu.org:
bug#11491; Package emacs,org-mode. (Fri, 18 May 2012 02:34:01 GMT) Full text and rfc822 format available.

Message #11 received at 11491 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Albert <ab.for.lists <at> gmail.com>
Cc: 11491 <at> debbugs.gnu.org
Subject: Re: bug#11491: 24.0.96 instead of 23.0.96
Date: Thu, 17 May 2012 22:33:31 -0400
Albert wrote:

> The version string has an typo in the original report.
>
> I guess it is better to send it again with the correct version in the
> subject.
>
> Should/Can I close this bug-report?

No, please don't close/resend it for such a reason.

I doubt anyone cares about the title, but I will retitle it.




bug No longer marked as found in versions 23.0.96. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 18 May 2012 02:36:02 GMT) Full text and rfc822 format available.

bug Marked as found in versions 24.0.96. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 18 May 2012 02:36:02 GMT) Full text and rfc822 format available.

Changed bug title to '24.0.96; org-mode: in org-publish.el: #+INCLUDE: cannot deal with spaces in a filename, like this "file name.org"' from '23.0.96; org-mode: in org-publish.el: #+INCLUDE: cannot deal with spaces in a filename, like this "file name.org"' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 18 May 2012 02:36:02 GMT) Full text and rfc822 format available.

Reply sent to Bastien <bzg <at> gnu.org>:
You have taken responsibility. (Fri, 18 May 2012 07:21:02 GMT) Full text and rfc822 format available.

Notification sent to Albert <ab.for.lists <at> gmail.com>:
bug acknowledged by developer. (Fri, 18 May 2012 07:21:02 GMT) Full text and rfc822 format available.

Message #22 received at 11491-done <at> debbugs.gnu.org (full text, mbox):

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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 15 Jun 2012 11:24:02 GMT) Full text and rfc822 format available.

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.