diff options
| author | Katsumi Yamaoka | 2015-10-22 00:08:23 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2015-10-22 00:08:23 +0000 |
| commit | 2ab48bafa3e8c3c686dcadfb5d2410178e9dd269 (patch) | |
| tree | 7bf67949c94abb8c9d315bf245b6f82b62eb703a | |
| parent | 54f59907f1e30aa9c6345295ee9a689468075802 (diff) | |
| download | emacs-2ab48bafa3e8c3c686dcadfb5d2410178e9dd269.tar.gz emacs-2ab48bafa3e8c3c686dcadfb5d2410178e9dd269.zip | |
Remove fboundp checks from mailcap-mime-data
* lisp/gnus/mailcap.el (mailcap-mime-data): Remove fboundp checks.
(mailcap-viewer-passes-test): Do it instead. Thanks to Stefan Monnier.
| -rw-r--r-- | lisp/gnus/mailcap.el | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/lisp/gnus/mailcap.el b/lisp/gnus/mailcap.el index d8881104af8..11a071b2542 100644 --- a/lisp/gnus/mailcap.el +++ b/lisp/gnus/mailcap.el | |||
| @@ -96,11 +96,9 @@ This is a compatibility function for different Emacsen." | |||
| 96 | (type . "application/vnd.ms-excel")) | 96 | (type . "application/vnd.ms-excel")) |
| 97 | ("x-x509-ca-cert" | 97 | ("x-x509-ca-cert" |
| 98 | (viewer . ssl-view-site-cert) | 98 | (viewer . ssl-view-site-cert) |
| 99 | (test . (fboundp 'ssl-view-site-cert)) | ||
| 100 | (type . "application/x-x509-ca-cert")) | 99 | (type . "application/x-x509-ca-cert")) |
| 101 | ("x-x509-user-cert" | 100 | ("x-x509-user-cert" |
| 102 | (viewer . ssl-view-user-cert) | 101 | (viewer . ssl-view-user-cert) |
| 103 | (test . (fboundp 'ssl-view-user-cert)) | ||
| 104 | (type . "application/x-x509-user-cert")) | 102 | (type . "application/x-x509-user-cert")) |
| 105 | ("octet-stream" | 103 | ("octet-stream" |
| 106 | (viewer . mailcap-save-binary-file) | 104 | (viewer . mailcap-save-binary-file) |
| @@ -129,23 +127,18 @@ This is a compatibility function for different Emacsen." | |||
| 129 | (type . "application/x-tar")) | 127 | (type . "application/x-tar")) |
| 130 | ("x-latex" | 128 | ("x-latex" |
| 131 | (viewer . tex-mode) | 129 | (viewer . tex-mode) |
| 132 | (test . (fboundp 'tex-mode)) | ||
| 133 | (type . "application/x-latex")) | 130 | (type . "application/x-latex")) |
| 134 | ("x-tex" | 131 | ("x-tex" |
| 135 | (viewer . tex-mode) | 132 | (viewer . tex-mode) |
| 136 | (test . (fboundp 'tex-mode)) | ||
| 137 | (type . "application/x-tex")) | 133 | (type . "application/x-tex")) |
| 138 | ("latex" | 134 | ("latex" |
| 139 | (viewer . tex-mode) | 135 | (viewer . tex-mode) |
| 140 | (test . (fboundp 'tex-mode)) | ||
| 141 | (type . "application/latex")) | 136 | (type . "application/latex")) |
| 142 | ("tex" | 137 | ("tex" |
| 143 | (viewer . tex-mode) | 138 | (viewer . tex-mode) |
| 144 | (test . (fboundp 'tex-mode)) | ||
| 145 | (type . "application/tex")) | 139 | (type . "application/tex")) |
| 146 | ("texinfo" | 140 | ("texinfo" |
| 147 | (viewer . texinfo-mode) | 141 | (viewer . texinfo-mode) |
| 148 | (test . (fboundp 'texinfo-mode)) | ||
| 149 | (type . "application/tex")) | 142 | (type . "application/tex")) |
| 150 | ("zip" | 143 | ("zip" |
| 151 | (viewer . mailcap-save-binary-file) | 144 | (viewer . mailcap-save-binary-file) |
| @@ -155,13 +148,11 @@ This is a compatibility function for different Emacsen." | |||
| 155 | ("pdf" | 148 | ("pdf" |
| 156 | (viewer . pdf-view-mode) | 149 | (viewer . pdf-view-mode) |
| 157 | (type . "application/pdf") | 150 | (type . "application/pdf") |
| 158 | (test . (and (fboundp 'pdf-view-mode) | 151 | (test . (eq window-system 'x))) |
| 159 | (eq window-system 'x)))) | ||
| 160 | ("pdf" | 152 | ("pdf" |
| 161 | (viewer . doc-view-mode) | 153 | (viewer . doc-view-mode) |
| 162 | (type . "application/pdf") | 154 | (type . "application/pdf") |
| 163 | (test . (and (fboundp 'doc-view-mode) | 155 | (test . (eq window-system 'x))) |
| 164 | (eq window-system 'x)))) | ||
| 165 | ("pdf" | 156 | ("pdf" |
| 166 | (viewer . "gv -safer %s") | 157 | (viewer . "gv -safer %s") |
| 167 | (type . "application/pdf") | 158 | (type . "application/pdf") |
| @@ -202,7 +193,6 @@ This is a compatibility function for different Emacsen." | |||
| 202 | ("copiousoutput")) | 193 | ("copiousoutput")) |
| 203 | ("sieve" | 194 | ("sieve" |
| 204 | (viewer . sieve-mode) | 195 | (viewer . sieve-mode) |
| 205 | (test . (fboundp 'sieve-mode)) | ||
| 206 | (type . "application/sieve")) | 196 | (type . "application/sieve")) |
| 207 | ("pgp-keys" | 197 | ("pgp-keys" |
| 208 | (viewer . "gpg --import --interactive --verbose") | 198 | (viewer . "gpg --import --interactive --verbose") |
| @@ -223,7 +213,6 @@ This is a compatibility function for different Emacsen." | |||
| 223 | (type . "message/rfc822")) | 213 | (type . "message/rfc822")) |
| 224 | ("rfc-*822" | 214 | ("rfc-*822" |
| 225 | (viewer . vm-mode) | 215 | (viewer . vm-mode) |
| 226 | (test . (fboundp 'vm-mode)) | ||
| 227 | (type . "message/rfc822")) | 216 | (type . "message/rfc822")) |
| 228 | ("rfc-*822" | 217 | ("rfc-*822" |
| 229 | (viewer . view-mode) | 218 | (viewer . view-mode) |
| @@ -260,18 +249,15 @@ This is a compatibility function for different Emacsen." | |||
| 260 | ("text" | 249 | ("text" |
| 261 | ("plain" | 250 | ("plain" |
| 262 | (viewer . view-mode) | 251 | (viewer . view-mode) |
| 263 | (test . (fboundp 'view-mode)) | ||
| 264 | (type . "text/plain")) | 252 | (type . "text/plain")) |
| 265 | ("plain" | 253 | ("plain" |
| 266 | (viewer . fundamental-mode) | 254 | (viewer . fundamental-mode) |
| 267 | (type . "text/plain")) | 255 | (type . "text/plain")) |
| 268 | ("enriched" | 256 | ("enriched" |
| 269 | (viewer . enriched-decode) | 257 | (viewer . enriched-decode) |
| 270 | (test . (fboundp 'enriched-decode)) | ||
| 271 | (type . "text/enriched")) | 258 | (type . "text/enriched")) |
| 272 | ("dns" | 259 | ("dns" |
| 273 | (viewer . dns-mode) | 260 | (viewer . dns-mode) |
| 274 | (test . (fboundp 'dns-mode)) | ||
| 275 | (type . "text/dns"))) | 261 | (type . "text/dns"))) |
| 276 | ("video" | 262 | ("video" |
| 277 | ("mpeg" | 263 | ("mpeg" |
| @@ -288,8 +274,7 @@ This is a compatibility function for different Emacsen." | |||
| 288 | ("archive" | 274 | ("archive" |
| 289 | ("tar" | 275 | ("tar" |
| 290 | (viewer . tar-mode) | 276 | (viewer . tar-mode) |
| 291 | (type . "archive/tar") | 277 | (type . "archive/tar")))) |
| 292 | (test . (fboundp 'tar-mode))))) | ||
| 293 | "The mailcap structure is an assoc list of assoc lists. | 278 | "The mailcap structure is an assoc list of assoc lists. |
| 294 | 1st assoc list is keyed on the major content-type | 279 | 1st assoc list is keyed on the major content-type |
| 295 | 2nd assoc list is keyed on the minor content-type (which can be a regexp) | 280 | 2nd assoc list is keyed on the minor content-type (which can be a regexp) |
| @@ -310,9 +295,9 @@ attribute name (viewer, test, etc). This looks like: | |||
| 310 | FLAG) | 295 | FLAG) |
| 311 | 296 | ||
| 312 | Where VIEWERINFO specifies how the content-type is viewed. Can be | 297 | Where VIEWERINFO specifies how the content-type is viewed. Can be |
| 313 | a string, in which case it is run through a shell, with | 298 | a string, in which case it is run through a shell, with appropriate |
| 314 | appropriate parameters, or a symbol, in which case the symbol is | 299 | parameters, or a symbol, in which case the symbol is `funcall'ed if |
| 315 | `funcall'ed, with the buffer as an argument. | 300 | and only if it exists as a function, with the buffer as an argument. |
| 316 | 301 | ||
| 317 | TESTINFO is a test for the viewer's applicability, or nil. If nil, it | 302 | TESTINFO is a test for the viewer's applicability, or nil. If nil, it |
| 318 | means the viewer is always valid. If it is a Lisp function, it is | 303 | means the viewer is always valid. If it is a Lisp function, it is |
| @@ -658,10 +643,12 @@ to supply to the test." | |||
| 658 | (let* ((test-info (assq 'test viewer-info)) | 643 | (let* ((test-info (assq 'test viewer-info)) |
| 659 | (test (cdr test-info)) | 644 | (test (cdr test-info)) |
| 660 | (otest test) | 645 | (otest test) |
| 661 | (viewer (cdr (assoc 'viewer viewer-info))) | 646 | (viewer (cdr (assq 'viewer viewer-info))) |
| 662 | (default-directory (expand-file-name "~/")) | 647 | (default-directory (expand-file-name "~/")) |
| 663 | status parsed-test cache result) | 648 | status parsed-test cache result) |
| 664 | (cond ((setq cache (assoc test mailcap-viewer-test-cache)) | 649 | (cond ((not (or (stringp viewer) (fboundp viewer))) |
| 650 | nil) ; Non-existent Lisp function | ||
| 651 | ((setq cache (assoc test mailcap-viewer-test-cache)) | ||
| 665 | (cadr cache)) | 652 | (cadr cache)) |
| 666 | ((not test-info) t) ; No test clause | 653 | ((not test-info) t) ; No test clause |
| 667 | (t | 654 | (t |