[gnus git] branch master updated: n0-15-8-g005516d =1= mm-view: font-lock based on filename

Julien Danjou <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  005516d5b03f4a6aa11ec9a7ebb1bbff4d119ccc (commit)
      from  6c37a908184a6cc014ba7ee895faab615acbadc0 (commit)


- Log -----------------------------------------------------------------
commit 005516d5b03f4a6aa11ec9a7ebb1bbff4d119ccc
Author: Julien Danjou <[email protected]>
Date:   Mon Mar 21 18:28:09 2011 +0100

    mm-view: font-lock based on filename
    
    Signed-off-by: Julien Danjou <[email protected]>

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8f52c49..ec1bc75 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,6 +1,11 @@
 2011-03-21  Julien Danjou  <[email protected]>
 
-	* mm-view.el (mm-display-inline-fontify):
+	* mm-view.el (mm-display-inline-fontify): Make mode optional, and call
+	normal-mode if not set. Set temp buffer unmodified to avoid kill-buffer
+	query.
+	(mm-inline-text): Render normal text with fontification whenever
+	possible.
+
 	* gnus-sum.el (gnus-summary-save-parts-1):
 	* gnus-art.el (gnus-article-browse-html-save-cid-content)
 	(gnus-article-browse-html-parts, gnus-mime-delete-part)
diff --git a/lisp/mm-view.el b/lisp/mm-view.el
index e8282ed..39d49af 100644
--- a/lisp/mm-view.el
+++ b/lisp/mm-view.el
@@ -455,7 +455,7 @@
 	  (narrow-to-region (point) (point))
 	  (mm-insert-part handle)
 	  (goto-char (point-max)))
-      (insert (mm-decode-string (mm-get-part handle) charset)))
+      (mm-display-inline-fontify handle))
     (when (and mm-fill-flowed
 	       (equal type "plain")
 	       (equal (cdr (assoc 'format (mm-handle-type handle)))
@@ -565,7 +565,9 @@
 		     (face-property 'default prop) (current-buffer))))
 	      (delete-region ,(point-min-marker) ,(point-max-marker)))))))))
 
-(defun mm-display-inline-fontify (handle mode)
+(defun mm-display-inline-fontify (handle &optional mode)
+  "Insert HANDLE inline fontifying with MODE.
+If MODE is not set, try to find mode automatically."
   (let ((charset (mail-content-type-get (mm-handle-type handle) 'charset))
 	text coding-system)
     (unless (eq charset 'gnus-decoded)
@@ -600,7 +602,10 @@
 	    (font-lock-support-mode nil)
 	    ;; I find font-lock a bit too verbose.
 	    (font-lock-verbose nil))
+        (setq buffer-file-name (mm-handle-filename handle))
+        (if mode
 	(funcall mode)
+          (normal-mode))
 	;; The mode function might have already turned on font-lock.
 	(unless (symbol-value 'font-lock-mode)
 	  (font-lock-fontify-buffer)))
@@ -613,6 +618,9 @@
 		       nil)
 		     nil nil nil nil nil 'text-prop))
       (setq text (buffer-string))
+      ;; Set buffer unmodified to avoid confirmation when killing the
+      ;; buffer.
+      (set-buffer-modified-p nil)
       (kill-buffer (current-buffer)))
     (mm-insert-inline handle text)))
 

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog  |    7 ++++++-
 lisp/mm-view.el |   14 +++++++++++---
 2 files changed, 17 insertions(+), 4 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.