From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH] Remove text properties of body before calculating cache hash. Date: Tue, 6 Jul 2010 12:52:28 +0200 Message-ID: <56991DC8-1D0C-4A30-94B6-841DA282C64A@gmail.com> References: <1278405171-5093-1-git-send-email-dmaus@ictsoc.de> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=59104 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OW5le-0001eI-1q for emacs-orgmode@gnu.org; Tue, 06 Jul 2010 06:52:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OW5lc-0006Uf-14 for emacs-orgmode@gnu.org; Tue, 06 Jul 2010 06:52:45 -0400 Received: from mail-bw0-f41.google.com ([209.85.214.41]:62160) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OW5lb-0006UX-GK for emacs-orgmode@gnu.org; Tue, 06 Jul 2010 06:52:43 -0400 Received: by bwz9 with SMTP id 9so4288765bwz.0 for ; Tue, 06 Jul 2010 03:52:42 -0700 (PDT) In-Reply-To: <1278405171-5093-1-git-send-email-dmaus@ictsoc.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: David Maus Cc: emacs-orgmode@gnu.org Applied, thanks. - Carsten On Jul 6, 2010, at 10:32 AM, David Maus wrote: > * org-exp-blocks.el (org-export-blocks-format-ditaa) > (org-export-blocks-format-dot): Remove text properties of body before > calculating cache hash. > > Otherwise one and the same ditta/graphviz image has a different hash > depending on the text properties of the body. > E.g. `org-export-region-as-html' with target buffer 'string passed the > body of the block without possible indentation property `wrap-prefix' > while `org-export-as-html' does. > --- > lisp/org-exp-blocks.el | 32 ++++++++++++++++++-------------- > 1 files changed, 18 insertions(+), 14 deletions(-) > > diff --git a/lisp/org-exp-blocks.el b/lisp/org-exp-blocks.el > index 4ff6c5c..4bf5db6 100644 > --- a/lisp/org-exp-blocks.el > +++ b/lisp/org-exp-blocks.el > @@ -227,13 +227,15 @@ passed to the ditaa utility as command line > arguments." > (message "ditaa-formatting...") > (let* ((args (if (cdr headers) (mapconcat 'identity (cdr headers) > " "))) > (data-file (make-temp-file "org-ditaa")) > - (hash (sha1 (prin1-to-string (list body args)))) > - (raw-out-file (if headers (car headers))) > - (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\) > $" raw-out-file) > - (cons (match-string 1 raw-out-file) > - (match-string 2 raw-out-file)) > - (cons raw-out-file "png"))) > - (out-file (concat (car out-file-parts) "_" hash "." (cdr > out-file-parts)))) > + (hash (progn > + (set-text-properties 0 (length body) nil body) > + (sha1 (prin1-to-string (list body args))))) > + (raw-out-file (if headers (car headers))) > + (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\)$" raw- > out-file) > + (cons (match-string 1 raw-out-file) > + (match-string 2 raw-out-file)) > + (cons raw-out-file "png"))) > + (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file- > parts)))) > (unless (file-exists-p org-ditaa-jar-path) > (error (format "Could not find ditaa.jar at %s" org-ditaa-jar- > path))) > (setq body (if (string-match "^\\([^:\\|:[^ ]\\)" body) > @@ -287,13 +289,15 @@ digraph data_relationships { > (message "dot-formatting...") > (let* ((args (if (cdr headers) (mapconcat 'identity (cdr headers) > " "))) > (data-file (make-temp-file "org-ditaa")) > - (hash (sha1 (prin1-to-string (list body args)))) > - (raw-out-file (if headers (car headers))) > - (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\) > $" raw-out-file) > - (cons (match-string 1 raw-out-file) > - (match-string 2 raw-out-file)) > - (cons raw-out-file "png"))) > - (out-file (concat (car out-file-parts) "_" hash "." (cdr > out-file-parts)))) > + (hash (progn > + (set-text-properties 0 (length body) nil body) > + (sha1 (prin1-to-string (list body args))))) > + (raw-out-file (if headers (car headers))) > + (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\)$" raw- > out-file) > + (cons (match-string 1 raw-out-file) > + (match-string 2 raw-out-file)) > + (cons raw-out-file "png"))) > + (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file- > parts)))) > (cond > ((or htmlp latexp docbookp) > (unless (file-exists-p out-file) > -- > 1.7.1 > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode - Carsten