all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#11491: 23.0.96; org-mode: in org-publish.el: #+INCLUDE: cannot deal with spaces in a filename, like this "file name.org"
@ 2012-05-16 19:49 Albert
  2012-05-18  2:27 ` bug#11491: 24.0.96 instead of 23.0.96 Albert
  2012-05-18  2:27 ` Albert
  0 siblings, 2 replies; 7+ messages in thread
From: Albert @ 2012-05-16 19:49 UTC (permalink / raw)
  To: 11491

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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#11491: 24.0.96 instead of 23.0.96
  2012-05-16 19:49 bug#11491: 23.0.96; org-mode: in org-publish.el: #+INCLUDE: cannot deal with spaces in a filename, like this "file name.org" Albert
@ 2012-05-18  2:27 ` Albert
  2012-05-18  2:33   ` Glenn Morris
  2012-05-18  2:33   ` Glenn Morris
  2012-05-18  2:27 ` Albert
  1 sibling, 2 replies; 7+ messages in thread
From: Albert @ 2012-05-18  2:27 UTC (permalink / raw)
  To: 11491

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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#11491: 24.0.96 instead of 23.0.96
  2012-05-16 19:49 bug#11491: 23.0.96; org-mode: in org-publish.el: #+INCLUDE: cannot deal with spaces in a filename, like this "file name.org" Albert
  2012-05-18  2:27 ` bug#11491: 24.0.96 instead of 23.0.96 Albert
@ 2012-05-18  2:27 ` Albert
  1 sibling, 0 replies; 7+ messages in thread
From: Albert @ 2012-05-18  2:27 UTC (permalink / raw)
  To: 11491

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#11491: 24.0.96 instead of 23.0.96
  2012-05-18  2:27 ` bug#11491: 24.0.96 instead of 23.0.96 Albert
  2012-05-18  2:33   ` Glenn Morris
@ 2012-05-18  2:33   ` Glenn Morris
  1 sibling, 0 replies; 7+ messages in thread
From: Glenn Morris @ 2012-05-18  2:33 UTC (permalink / raw)
  To: Albert; +Cc: 11491

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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#11491: 24.0.96 instead of 23.0.96
  2012-05-18  2:27 ` bug#11491: 24.0.96 instead of 23.0.96 Albert
@ 2012-05-18  2:33   ` Glenn Morris
  2012-05-18  7:20     ` Bastien
  2012-05-18  7:20     ` Bastien
  2012-05-18  2:33   ` Glenn Morris
  1 sibling, 2 replies; 7+ messages in thread
From: Glenn Morris @ 2012-05-18  2:33 UTC (permalink / raw)
  To: Albert; +Cc: 11491

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#11491: 24.0.96 instead of 23.0.96
  2012-05-18  2:33   ` Glenn Morris
@ 2012-05-18  7:20     ` Bastien
  2012-05-18  7:20     ` Bastien
  1 sibling, 0 replies; 7+ messages in thread
From: Bastien @ 2012-05-18  7:20 UTC (permalink / raw)
  To: Albert; +Cc: 11491-done

Fixed in latest Org (from git.)

Quotes are now mandatory and filenames can contain spaces.

Thanks for suggesting this.

-- 
 Bastien





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#11491: 24.0.96 instead of 23.0.96
  2012-05-18  2:33   ` Glenn Morris
  2012-05-18  7:20     ` Bastien
@ 2012-05-18  7:20     ` Bastien
  1 sibling, 0 replies; 7+ messages in thread
From: Bastien @ 2012-05-18  7:20 UTC (permalink / raw)
  To: Albert; +Cc: Glenn Morris, 11491-done

Fixed in latest Org (from git.)

Quotes are now mandatory and filenames can contain spaces.

Thanks for suggesting this.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-05-18  7:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-16 19:49 bug#11491: 23.0.96; org-mode: in org-publish.el: #+INCLUDE: cannot deal with spaces in a filename, like this "file name.org" Albert
2012-05-18  2:27 ` bug#11491: 24.0.96 instead of 23.0.96 Albert
2012-05-18  2:33   ` Glenn Morris
2012-05-18  7:20     ` Bastien
2012-05-18  7:20     ` Bastien
2012-05-18  2:33   ` Glenn Morris
2012-05-18  2:27 ` Albert

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.