Function: gnus-insert-mime-button

gnus-insert-mime-button is a byte-compiled function defined in gnus-art.el.gz.

Signature

(gnus-insert-mime-button HANDLE ID &optional DISPLAYED)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-art.el.gz
(defun gnus-insert-mime-button (handle id &optional displayed)
  (let ((gnus-tmp-name
	 (or (mm-handle-filename handle)
	     (mail-content-type-get (mm-handle-type handle) 'url)
	     ""))
        (gnus-tmp-id id)
	(gnus-tmp-type (mm-handle-media-type handle))
	(gnus-tmp-description (or (mm-handle-description handle) ""))
	(gnus-tmp-dots
	 (if (if displayed (car displayed)
	       (mm-handle-displayed-p handle))
	     "" "..."))
	(gnus-tmp-length (with-current-buffer (mm-handle-buffer handle)
			   (buffer-size)))
        (help-echo "mouse-2: toggle the MIME part; down-mouse-3: more options")
	gnus-tmp-type-long b e)
    (when (string-match ".*/" gnus-tmp-name)
      (setq gnus-tmp-name (replace-match "" t t gnus-tmp-name)))
    (setq gnus-tmp-type-long (concat gnus-tmp-type
				     (and (not (equal gnus-tmp-name ""))
					  (concat "; " gnus-tmp-name))))
    (unless (equal gnus-tmp-description "")
      (setq gnus-tmp-type-long (concat " --- " gnus-tmp-type-long)))
    (when (and (zerop gnus-tmp-length)
               ;; Only nnimap supports partial fetches so far.
               nnimap-fetch-partial-articles
               (string-match "^nnimap\\+" gnus-newsgroup-name))
      (setq gnus-tmp-type-long
            (concat
             gnus-tmp-type-long
             (substitute-command-keys
              (concat "\\<gnus-summary-mode-map> (not downloaded, "
                      "\\[gnus-summary-show-complete-article] to fetch.)"))))
      (setq help-echo
            (concat "Type \\[gnus-summary-show-complete-article] "
                    "to download complete article. " help-echo)))
    (setq b (point))
    (gnus-eval-format
     gnus-mime-button-line-format gnus-mime-button-line-format-alist
     `(keymap ,gnus-mime-button-map
	      gnus-callback gnus-mm-display-part
	      gnus-part ,gnus-tmp-id
	      article-type annotation
	      gnus-data ,handle
	      rear-nonsticky t))
    (setq e (if (bolp)
		;; Exclude a newline.
		(1- (point))
	      (point)))
    (make-text-button
     b e
     'keymap gnus-mime-button-map
     'face gnus-article-button-face
     'follow-link t
     'help-echo help-echo)))