emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Remove text properties of body before calculating cache hash.
@ 2010-07-06  8:32 David Maus
  2010-07-06  8:43 ` Patchwork: Patch 119 Accepted Carsten Dominik
  2010-07-06 10:52 ` [PATCH] Remove text properties of body before calculating cache hash Carsten Dominik
  0 siblings, 2 replies; 3+ messages in thread
From: David Maus @ 2010-07-06  8:32 UTC (permalink / raw)
  To: emacs-orgmode

* 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

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

* Patchwork: Patch 119 Accepted
  2010-07-06  8:32 [PATCH] Remove text properties of body before calculating cache hash David Maus
@ 2010-07-06  8:43 ` Carsten Dominik
  2010-07-06 10:52 ` [PATCH] Remove text properties of body before calculating cache hash Carsten Dominik
  1 sibling, 0 replies; 3+ messages in thread
From: Carsten Dominik @ 2010-07-06  8:43 UTC (permalink / raw)
  To: emacs-orgmode

Patch 119 (http://patchwork.newartisans.com/patch/119/) is now Accepted.

This relates to the following submission:

http://mid.gmane.org/%3C1278405171-5093-1-git-send-email-dmaus%40ictsoc.de%3E

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

* Re: [PATCH] Remove text properties of body before calculating cache hash.
  2010-07-06  8:32 [PATCH] Remove text properties of body before calculating cache hash David Maus
  2010-07-06  8:43 ` Patchwork: Patch 119 Accepted Carsten Dominik
@ 2010-07-06 10:52 ` Carsten Dominik
  1 sibling, 0 replies; 3+ messages in thread
From: Carsten Dominik @ 2010-07-06 10:52 UTC (permalink / raw)
  To: David Maus; +Cc: emacs-orgmode

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

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

end of thread, other threads:[~2010-07-06 10:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-06  8:32 [PATCH] Remove text properties of body before calculating cache hash David Maus
2010-07-06  8:43 ` Patchwork: Patch 119 Accepted Carsten Dominik
2010-07-06 10:52 ` [PATCH] Remove text properties of body before calculating cache hash Carsten Dominik

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).