;;; mailcap.el --- MIME media types configuration
-;; Copyright (C) 1998-2015 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2016 Free Software Foundation, Inc.
;; Author: William M. Perry <wmperry@aventail.com>
;; Lars Magne Ingebrigtsen <larsi@gnus.org>
(eval-when-compile (require 'cl))
(autoload 'mail-header-parse-content-type "mail-parse")
-;; `mm-delete-duplicates' is an alias for `delete-dups' in Emacs 22.
-(defalias 'mailcap-delete-duplicates
- (if (fboundp 'delete-dups)
- 'delete-dups
- (autoload 'mm-delete-duplicates "mm-util")
- 'mm-delete-duplicates))
-
-;; `mailcap-replace-in-string' is an alias like `gnus-replace-in-string'.
-(eval-and-compile
- (cond
- ((fboundp 'replace-regexp-in-string)
- (defun mailcap-replace-in-string (string regexp newtext &optional literal)
- "Replace all matches for REGEXP with NEWTEXT in STRING.
-If LITERAL is non-nil, insert NEWTEXT literally. Return a new
-string containing the replacements.
-This is a compatibility function for different Emacsen."
- (replace-regexp-in-string regexp newtext string nil literal)))
- ((fboundp 'replace-in-string)
- (defalias 'mailcap-replace-in-string 'replace-in-string))))
-
(defgroup mailcap nil
"Definition of viewers for MIME types."
:version "21.1"
table)
"A syntax table for parsing SGML attributes.")
-(eval-and-compile
- (when (featurep 'xemacs)
- (condition-case nil
- (require 'lpr)
- (error nil))))
-
(defvar mailcap-print-command
(mapconcat 'identity
(cons (if (boundp 'lpr-command)
(defun mailcap-mime-types ()
"Return a list of MIME media types."
(mailcap-parse-mimetypes)
- (mailcap-delete-duplicates
+ (delete-dups
(nconc
(mapcar 'cdr mailcap-mime-extensions)
(apply
(mailcap-parse-mimetypes)
(let* ((all-mime-type
;; All unique MIME types from file extensions
- (mailcap-delete-duplicates
+ (delete-dups
(mapcar (lambda (file)
(mailcap-extension-to-mime
(file-name-extension file t)))
files)))
(all-mime-info
;; All MIME info lists
- (mailcap-delete-duplicates
+ (delete-dups
(mapcar (lambda (mime-type)
(mailcap-mime-info mime-type 'all))
all-mime-type)))
(car all-mime-info)))
(commands
;; Command strings from `viewer' field of the MIME info
- (mailcap-delete-duplicates
- (delq nil (mapcar (lambda (mime-info)
- (let ((command (cdr (assoc 'viewer mime-info))))
- (if (stringp command)
- (mailcap-replace-in-string
- ;; Replace mailcap's `%s' placeholder
- ;; with dired's `?' placeholder
- (mailcap-replace-in-string
- ;; Remove the final filename placeholder
- command "[ \t\n]*\\('\\)?%s\\1?[ \t\n]*\\'" "" t)
- "%s" "?" t))))
+ (delete-dups
+ (delq nil (mapcar
+ (lambda (mime-info)
+ (let ((command (cdr (assoc 'viewer mime-info))))
+ (if (stringp command)
+ (replace-regexp-in-string
+ ;; Replace mailcap's `%s' placeholder
+ ;; with dired's `?' placeholder
+ "%s" "?"
+ (replace-regexp-in-string
+ ;; Remove the final filename placeholder
+ "[ \t\n]*\\('\\)?%s\\1?[ \t\n]*\\'" ""
+ command nil t)
+ nil t))))
common-mime-info)))))
commands))