("toggle display" . gnus-article-press-button)
("toggle display" . gnus-article-view-part-as-charset)
("view as type" . gnus-mime-view-part-as-type)
- ("internalize type" . gnus-mime-internalize-part)
- ("externalize type" . gnus-mime-externalize-part))
+ ("view internally" . gnus-mime-view-part-internally)
+ ("view externally" . gnus-mime-view-part-externally))
"An alist of actions that run on the MIME attachment."
:group 'gnus-article-mime
:type '(repeat (cons (string :tag "name")
(function))))
-(defcustom gnus-mime-action-alist
- '(("save to file" . gnus-mime-save-part)
- ("display as text" . gnus-mime-inline-part)
- ("view the part" . gnus-mime-view-part)
- ("pipe to command" . gnus-mime-pipe-part)
- ("toggle display" . gnus-article-press-button)
- ("view as type" . gnus-mime-view-part-as-type)
- ("internalize type" . gnus-mime-internalize-part)
- ("externalize type" . gnus-mime-externalize-part))
- "An alist of actions that run on the MIME attachment."
- :version "21.1"
- :group 'gnus-article-mime
- :type '(repeat (cons (string :tag "name")
- (function))))
-
;;;
;;; The treatment variables
;;;
:type 'string
:group 'mime-security)
-(defcustom gnus-article-wash-function
- (cond ((locate-library "w3")
- 'gnus-article-wash-html-with-w3)
- ((locate-library "w3m")
- 'gnus-article-wash-html-with-w3m))
- "Function used for converting HTML into text."
- :type '(radio (function-item gnus-article-wash-html-with-w3)
- (function-item gnus-article-wash-html-with-w3m))
- :group 'gnus-article)
+(defvar gnus-article-wash-function nil
+ "Function used for converting HTML into text.")
;;; Internal variables
(set-buffer gnus-original-article-buffer))
(save-restriction
(mail-narrow-to-head)
- (let ((regexp
- (if gnus-treat-display-grey-xface
- "x-face\\(-[0-9]+\\)?"
- "x-face")))
- (while (gnus-article-goto-header regexp)
- (when (match-beginning 2)
- (setq grey t))
+ (if gnus-treat-display-grey-xface
+ (progn
+ (while (gnus-article-goto-header "X-Face\\(-[0-9]+\\)?")
+ (if (match-beginning 2)
+ (progn
+ (setq grey t)
+ (push (cons (- (string-to-number (match-string 2)))
+ (mail-header-field-value))
+ x-faces))
+ (push (cons 0 (mail-header-field-value)) x-faces)))
+ (dolist (x-face (prog1
+ (if grey
+ (sort x-faces 'car-less-than-car)
+ (nreverse x-faces))
+ (setq x-faces nil)))
+ (push (cdr x-face) x-faces)))
+ (while (gnus-article-goto-header "X-Face")
(push (mail-header-field-value) x-faces)))
(setq from (message-fetch-field "from"))))
(if grey
(save-window-excursion
(save-restriction
(narrow-to-region (point) (point-max))
- (funcall gnus-article-wash-function))))))
+ (let* ((func (or gnus-article-wash-function mm-text-html-renderer))
+ (entry (assq func mm-text-html-washer-alist)))
+ (if entry
+ (setq func (cdr entry)))
+ (cond
+ ((gnus-functionp func)
+ (funcall func))
+ (t
+ (apply (car func) (cdr func))))))))))
(defun gnus-article-wash-html-with-w3 ()
"Wash the current buffer with w3."
(mm-setup-w3)
(let ((w3-strict-width (window-width))
(url-standalone-mode t)
- (url-gateway-unplugged t)
- (w3-honor-stylesheets nil)
- (w3-delay-image-loads t))
+ (url-gateway-unplugged t)
+ (w3-honor-stylesheets nil))
(condition-case var
(w3-region (point-min) (point-max))
(error))))
(gnus-mime-save-part-and-strip "\C-o" "Save and Strip")
(gnus-mime-copy-part "c" "View As Text, In Other Buffer")
(gnus-mime-inline-part "i" "View As Text, In This Buffer")
- (gnus-mime-internalize-part "E" "View Internally")
- (gnus-mime-externalize-part "e" "View Externally")
+ (gnus-mime-view-part-internally "E" "View Internally")
+ (gnus-mime-view-part-externally "e" "View Externally")
(gnus-mime-print-part "p" "Print")
(gnus-mime-pipe-part "|" "Pipe To Command...")
(gnus-mime-action-on-part "." "Take action on the part")))
(gnus-newsgroup-ignored-charsets 'gnus-all))
(gnus-article-press-button)))))
-(defun gnus-mime-externalize-part (&optional handle)
+(defun gnus-mime-view-part-externally (&optional handle)
"View the MIME part under point with an external viewer."
(interactive)
(gnus-article-check-buffer)
(mm-remove-part handle)
(mm-display-part handle)))))
-(defun gnus-mime-internalize-part (&optional handle)
+(defun gnus-mime-view-part-internally (&optional handle)
"View the MIME part under point with an internal viewer.
If no internal viewer is available, use an external viewer."
(interactive)
(interactive "p")
(gnus-article-part-wrapper n 'gnus-mime-view-part-as-charset))
-(defun gnus-article-externalize-part (n)
+(defun gnus-article-view-part-externally (n)
"View MIME part N externally, which is the numerical prefix."
(interactive "p")
- (gnus-article-part-wrapper n 'gnus-mime-externalize-part))
+ (gnus-article-part-wrapper n 'gnus-mime-view-part-externally))
(defun gnus-article-inline-part (n)
"Inline MIME part N, which is the numerical prefix."
;; may change the point. So we set the window point.
(set-window-point window point)))
(let* ((handles (or ihandles (mm-dissect-buffer
- gnus-article-no-strict-mime)
+ nil gnus-article-loose-mime)
(mm-uu-dissect)))
buffer-read-only handle name type b e display)
(when (and (not ihandles)