From: Hrvoje Niksic Date: Tue, 24 Apr 2001 12:21:19 +0000 (+0000) Subject: Make mm-display-inline-fontify use a temp buffer that does not begin X-Git-Url: https://cgit.sxemacs.org/?a=commitdiff_plain;h=4017b2852781925c9b03fa004d5cb0d96b55fa10;p=gnus Make mm-display-inline-fontify use a temp buffer that does not begin with space. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1952828eb..71727cc48 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2001-04-24 Hrvoje Niksic + + * mm-view.el (mm-display-inline-fontify): Allow XEmacs to fully + fontify HANDLE. + 2001-04-18 Simon Josefsson * smime.el (smime-ask-passphrase): Rework to return value. diff --git a/lisp/mm-view.el b/lisp/mm-view.el index 639c32ebc..976cdffe6 100644 --- a/lisp/mm-view.el +++ b/lisp/mm-view.el @@ -266,18 +266,37 @@ (defun mm-display-inline-fontify (handle mode) (let (text) - (with-temp-buffer - (mm-insert-part handle) - (funcall mode) - (font-lock-fontify-buffer) - (when (fboundp 'extent-list) - (map-extents (lambda (ext ignored) - (set-extent-property ext 'duplicable t) - nil) - nil nil nil nil nil 'text-prop)) - (setq text (buffer-string))) + ;; XEmacs @#$@ version of font-lock refuses to fully turn itself + ;; on for buffers whose name begins with " ". That's why we use + ;; save-current-buffer/get-buffer-create rather than + ;; with-temp-buffer. + (save-current-buffer + (set-buffer (generate-new-buffer "*fontification*")) + (unwind-protect + (progn + (buffer-disable-undo) + (mm-insert-part handle) + (funcall mode) + (let ((font-lock-verbose nil)) + ;; I find font-lock a bit too verbose. + (font-lock-fontify-buffer)) + ;; By default, XEmacs font-lock uses non-duplicable text + ;; properties. This code forces all the text properties + ;; to be copied along with the text. + (when (fboundp 'extent-list) + (map-extents (lambda (ext ignored) + (set-extent-property ext 'duplicable t) + nil) + nil nil nil nil nil 'text-prop)) + (setq text (buffer-string))) + (kill-buffer (current-buffer)))) (mm-insert-inline handle text))) +;; Shouldn't these functions check whether the user even wants to use +;; font-lock? At least under XEmacs, this fontification is pretty +;; much unconditional. Also, it would be nice to change for the size +;; of the fontified region. + (defun mm-display-patch-inline (handle) (mm-display-inline-fontify handle 'diff-mode))