Function: gnus-mime-display-single

gnus-mime-display-single is a byte-compiled function defined in gnus-art.el.gz.

Signature

(gnus-mime-display-single HANDLE)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-art.el.gz
(defun gnus-mime-display-single (handle)
  (let ((type (mm-handle-media-type handle))
	(ignored gnus-ignored-mime-types)
	(mm-inline-font-lock (gnus-visual-p 'article-highlight 'highlight))
	(not-attachment t)
	display text
        gnus-displaying-mime)
    (catch 'ignored
      (progn
	(while ignored
	  (when (string-match (pop ignored) type)
	    (throw 'ignored nil)))
	(if (and (not (and (if (gnus-buffer-live-p gnus-summary-buffer)
			       (with-current-buffer gnus-summary-buffer
				 gnus-inhibit-images)
			     gnus-inhibit-images)
			   (string-match "\\`image/" type)))
		 (setq not-attachment
		       (and (not (mm-inline-override-p handle))
			    (or (not (mm-handle-disposition handle))
				(equal (car (mm-handle-disposition handle))
				       "inline")
				(mm-attachment-override-p handle))))
		 (mm-automatic-display-p handle)
		 (or (and
		      (mm-inlinable-p handle)
		      (mm-inlined-p handle))
		     (mm-automatic-external-display-p type)))
	    (setq display t)
	  (when (equal (mm-handle-media-supertype handle) "text")
	    (setq text t)))
	(let ((id (car (rassq handle gnus-article-mime-handle-alist)))
	      beg)
	  (unless id
	    (setq id (1+ (length gnus-article-mime-handle-alist)))
	    (push (cons id handle) gnus-article-mime-handle-alist))
	  (when (and display
		     (equal (mm-handle-media-supertype handle) "message"))
	    (insert-char
	     ?\n
	     (cond ((not (bolp)) 2)
		   ((or (bobp) (eq (char-before (1- (point))) ?\n)) 0)
		   (t 1))))
	  (when (or (not display)
		    (not (gnus-unbuttonized-mime-type-p type))
		    (eq id gnus-mime-buttonized-part-id))
	    (gnus-insert-mime-button
	     handle id (list (or display (and not-attachment text)))))
	  (setq beg (point))
	  (cond
	   (display
	    (let ((mail-parse-charset gnus-newsgroup-charset)
		  (mail-parse-ignored-charsets
		   (save-excursion (condition-case ()
				       (set-buffer gnus-summary-buffer)
				     (error))
				   gnus-newsgroup-ignored-charsets)))
	      (gnus-bind-mm-vars (mm-display-part handle t))))
	   ((and text not-attachment)
	    (mm-display-inline handle)))
	  (goto-char (point-max))
	  (if (string-match "\\`image/" type)
	      (gnus-article-insert-newline)
	    (if (prog1
		    (= (skip-chars-backward "\n") -1)
		  (unless (eobp) (forward-char 1)))
		(gnus-article-insert-newline)
	      (put-text-property (point) (point-max) 'gnus-undeletable t))
	    (goto-char (point-max)))
	  ;; Do highlighting.
	  (save-excursion
	    (save-restriction
	      (narrow-to-region beg (point))
	      (if (eq handle gnus-article-mime-handles)
		  ;; The format=flowed case.
		  (gnus-treat-article nil 1 1 (mm-handle-media-type handle))
		;; Don't count signature parts that are never displayed.
		;; The part number should be re-calculated supposing this
		;; might be a message/rfc822 part.
		(let (handles)
		  (dolist (part gnus-article-mime-handles)
		    (unless (or (stringp part)
				(equal (car (mm-handle-type part))
				       "application/pgp-signature"))
		      (push part handles)))
		  (gnus-treat-article
		   nil (length (memq handle handles)) (length handles)
		   (mm-handle-media-type handle)))))))))))