From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: possible org bug Date: Fri, 10 Aug 2012 13:06:13 +0200 Message-ID: <87pq6z80re.fsf@gnu.org> References: <87d33rzecj.fsf@argentum.i-did-not-set--mail-host-address--so-tickle-me> <878ve7d7sl.fsf@Rainer.invalid> <3374.1343242848@alphaville> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:33615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Szn2K-00084s-1o for emacs-orgmode@gnu.org; Fri, 10 Aug 2012 07:05:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Szn2H-0002it-OV for emacs-orgmode@gnu.org; Fri, 10 Aug 2012 07:05:47 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:48679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Szn2H-0002iI-Ei for emacs-orgmode@gnu.org; Fri, 10 Aug 2012 07:05:45 -0400 Received: by wgbez12 with SMTP id ez12so955801wgb.30 for ; Fri, 10 Aug 2012 04:05:44 -0700 (PDT) In-Reply-To: <3374.1343242848@alphaville> (Nick Dokos's message of "Wed, 25 Jul 2012 15:00:48 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: nicholas.dokos@hp.com Cc: Achim Gratz , emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi Nick, Nick Dokos writes: > Re: the relative vs. absolute pathnames - David Maus had fixed a problem > with symlinks but was trying to avoid carrying the default directory > context. See this thread: > > http://thread.gmane.org/gmane.emacs.orgmode/40645 > > I just wanted to make sure that anybody who takes a look at this, keeps > in mind the symlink case(s) as well. > > But I also wanted to add a plug for the exemplary bug report that the OP > put together: if all bug reports were as complete as this one, life > would be much easier. I usually complain about bad bug reports, so this > was my chance to praise a good one: thanks! > > Nick > > PS. I had got to the cache problem (but not as far as the font-lock > problem that Achim traced it to), ran out of time, wanted to get back to > it but never got the chance. I might be able to take another look at it > this weekend, but if anybody beats me to it, I will *not* complain... Here is another chance. :) Please test the attached patch and see if this fixes the issue. Thanks! --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-publish.el-Fix-problem-with-org-publish-cache-ct.patch >From 55f1cf816d65b1c98044ae82a42da84b5613c5bd Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Fri, 10 Aug 2012 13:04:55 +0200 Subject: [PATCH] org-publish.el: Fix problem with `org-publish-cache-ctime-of-src' not expanding from the correct directory * org-publish.el (org-publish-needed-p) (org-publish-update-timestamp, org-publish-file) (org-publish-cache-file-needs-publishing): New argument `base-dir'. (org-publish-cache-ctime-of-src): Use the new argument to make sure we find the file according to :base-directory. --- lisp/org-publish.el | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lisp/org-publish.el b/lisp/org-publish.el index cb496ff..3225495 100644 --- a/lisp/org-publish.el +++ b/lisp/org-publish.el @@ -315,7 +315,7 @@ You could use brackets to delimit on what part the link will be. (format "%s" (or pub-func "")))) (concat "X" (if (fboundp 'sha1) (sha1 filename) (md5 filename)))) -(defun org-publish-needed-p (filename &optional pub-dir pub-func true-pub-dir) +(defun org-publish-needed-p (filename &optional pub-dir pub-func true-pub-dir base-dir) "Return t if FILENAME should be published in PUB-DIR using PUB-FUNC. TRUE-PUB-DIR is where the file will truly end up. Currently we are not using this - maybe it can eventually be used to check if the file is present at @@ -325,7 +325,7 @@ function can still decide about that independently." (let ((rtn (if org-publish-use-timestamps-flag (org-publish-cache-file-needs-publishing - filename pub-dir pub-func) + filename pub-dir pub-func base-dir) ;; don't use timestamps, always return t t))) (if rtn @@ -334,11 +334,11 @@ function can still decide about that independently." (message "Skipping unmodified file %s" filename))) rtn)) -(defun org-publish-update-timestamp (filename &optional pub-dir pub-func) +(defun org-publish-update-timestamp (filename &optional pub-dir pub-func base-dir) "Update publishing timestamp for file FILENAME. If there is no timestamp, create one." (let ((key (org-publish-timestamp-filename filename pub-dir pub-func)) - (stamp (org-publish-cache-ctime-of-src filename))) + (stamp (org-publish-cache-ctime-of-src filename base-dir))) (org-publish-cache-set key stamp))) (defun org-publish-remove-all-timestamps () @@ -705,15 +705,14 @@ See `org-publish-projects'." (if (listp publishing-function) ;; allow chain of publishing functions (mapc (lambda (f) - (when (org-publish-needed-p filename pub-dir f tmp-pub-dir) + (when (org-publish-needed-p filename pub-dir f tmp-pub-dir base-dir) (funcall f project-plist filename tmp-pub-dir) - (org-publish-update-timestamp filename pub-dir f))) + (org-publish-update-timestamp filename pub-dir f base-dir))) publishing-function) - (when (org-publish-needed-p filename pub-dir publishing-function - tmp-pub-dir) + (when (org-publish-needed-p filename pub-dir publishing-function tmp-pub-dir base-dir) (funcall publishing-function project-plist filename tmp-pub-dir) (org-publish-update-timestamp - filename pub-dir publishing-function))) + filename pub-dir publishing-function base-dir))) (unless no-cache (org-publish-write-cache-file)))) (defun org-publish-projects (projects) @@ -1103,7 +1102,7 @@ If FREE-CACHE, empty the cache." (clrhash org-publish-cache)) (setq org-publish-cache nil)) -(defun org-publish-cache-file-needs-publishing (filename &optional pub-dir pub-func) +(defun org-publish-cache-file-needs-publishing (filename &optional pub-dir pub-func base-dir) "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, @@ -1123,12 +1122,12 @@ so that the file including them will be republished as well." (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)))) + (org-publish-cache-ctime-of-src included-file base-dir) 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))) + (let ((ctime (org-publish-cache-ctime-of-src filename base-dir))) (or (< pstamp ctime) (when included-files-ctime (not (null (delq nil (mapcar (lambda(ct) (< ctime ct)) @@ -1183,9 +1182,10 @@ Returns value on success, else nil." (error "`org-publish-cache-set' called, but no cache present")) (puthash key value org-publish-cache)) -(defun org-publish-cache-ctime-of-src (f) +(defun org-publish-cache-ctime-of-src (f base-dir) "Get the FILENAME ctime as an integer." - (let ((attr (file-attributes (expand-file-name (or (file-symlink-p f) f))))) + (let ((attr (file-attributes + (expand-file-name (or (file-symlink-p f) f) base-dir)))) (+ (lsh (car (nth 5 attr)) 16) (cadr (nth 5 attr))))) -- 1.7.10.2 --=-=-= Content-Type: text/plain -- Bastien --=-=-=--