]> code.delx.au - gnu-emacs/blobdiff - lisp/gnus/mailcap.el
Clean up nnimap-request-move-article slightly
[gnu-emacs] / lisp / gnus / mailcap.el
index 11a071b2542670198bb3ca3d955faca9ce340080..609a8f4d64b5b64f5a4906649ef67b0a82f69287 100644 (file)
@@ -1,6 +1,6 @@
 ;;; 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"
@@ -66,12 +46,6 @@ This is a compatibility function for different Emacsen."
     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)
@@ -993,7 +967,7 @@ If FORCE, re-parse even if already parsed."
 (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
@@ -1021,14 +995,14 @@ If FORCE, re-parse even if already parsed."
   (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)))
@@ -1046,17 +1020,20 @@ If FORCE, re-parse even if already parsed."
            (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))