Function: gnus-mime-buttonize-attachments-in-header
gnus-mime-buttonize-attachments-in-header is an interactive and
byte-compiled function defined in gnus-art.el.gz.
Signature
(gnus-mime-buttonize-attachments-in-header &optional INTERACTIVE)
Documentation
Show attachments as buttons in the end of the header of an article.
This function toggles the display when called interactively. Note that
buttons to be added to the header are only the ones that aren't inlined
in the body. Use gnus-header-face-alist to highlight buttons.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-art.el.gz
(defun gnus-mime-buttonize-attachments-in-header (&optional interactive)
"Show attachments as buttons in the end of the header of an article.
This function toggles the display when called interactively. Note that
buttons to be added to the header are only the ones that aren't inlined
in the body. Use `gnus-header-face-alist' to highlight buttons."
(interactive (list t) gnus-article-mode gnus-summary-mode)
(gnus-with-article-buffer
(let ((case-fold-search t) buttons st)
(save-excursion
(save-restriction
(widen)
(article-narrow-to-head)
;; Header buttons exist?
(while (and (not buttons)
(re-search-forward "^attachments?:[\n ]+" nil t))
(when (get-char-property (match-end 0)
'gnus-button-attachment-extra)
(setq buttons (match-beginning 0))))
(widen)
(when buttons
;; Delete header buttons.
(delete-region buttons (if (re-search-forward "^[^ ]" nil t)
(match-beginning 0)
(point-max))))
(unless (and interactive buttons)
;; Find buttons.
(setq buttons nil)
(dolist (button (gnus-article-mime-handles))
(unless (mm-handle-undisplayer (cdr button))
(push button buttons)))
(when buttons
;; Add header buttons.
(article-goto-body)
(forward-line -1)
(narrow-to-region (point) (point))
(insert "Attachment" (if (cdr buttons) "s" "") ":")
(dolist (button (nreverse buttons))
(setq st (point))
(insert " ")
(gnus-insert-mime-button (cdr button) (car button))
(skip-chars-backward "\t\n ")
(delete-region (point) (point-max))
(when (> (current-column) (window-width))
(goto-char st)
(insert "\n")
(end-of-line)))
(insert "\n")
(let ((ovl (make-overlay (point-min) (point))))
(overlay-put ovl 'gnus-button-attachment-extra t)
(overlay-put ovl 'evaporate t))
(let ((gnus-treatment-function-alist
'((gnus-treat-highlight-headers
gnus-article-highlight-headers))))
(gnus-treat-article 'head)))))))))