Subject: bug#5002: patch

From: Vivek Dasmohapatra <[email-masked]>
Date: Thu, 26 Nov 2009 05:32:35 +0000 (GMT)

Tags: patch

This patch should allow those props to be stripped.

A defcustom has been added and the properties listed in it should be
ripped out just after the buffer is copied.

(I have dropped rear-nonsticky from the list of props to ignore,
  it does not seem problematic (or likely to be problematic) to me.)

diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el
index f60e7e8..cdad960 100644
--- a/lisp/htmlfontify.el
+++ b/lisp/htmlfontify.el
@@ -373,6 +373,18 @@ commands in `hfy-etags-cmd-alist'."
   :tag   "shell-file-name"
   :type  '(file))
 
+(defcustom hfy-ignored-properties '(read-only 
+                                    intangible
+                                    modification-hooks
+                                    insert-in-front-hooks
+                                    insert-behind-hooks
+                                    point-entered
+                                    point-left)
+  "Properties to omit when copying a fontified buffer for html transformation."
+  :group 'htmlfontify
+  :tag   "ignored-properties"
+  :type '(repeat symbol))
+
 (defun hfy-which-etags ()
   "Return a string  indicating which flavour of etags we are using."
   (let ((v (shell-command-to-string (concat hfy-etags-bin " --version"))))
@@ -1623,6 +1635,8 @@ FILE, if set, is the file name."
       (delete-overlay rovl))
     (copy-to-buffer html-buffer (point-min) (point-max))
     (set-buffer     html-buffer)
+    ;; rip out props that could interfere with our htmlisation of the buffer:
+    (remove-text-properties (point-min) (point-max) hfy-ignored-properties)
     ;; Apply overlay invisible spec
     (setq orig-ovls
           (sort orig-ovls