Well, yes, that's what it does. But it doesn't need to build a list of name-typesbased on just one file name and it does not need to build a list of content-types
based on the beginning of just one buffer...
I mean, AFAICS this would do the same and would not require `doc-view-intersection',
just eq'ing two symbols.
diff --git i/lisp/doc-view.el w/lisp/doc-view.el
index e5f0e89a36..58f8535328 100644
--- i/lisp/doc-view.el
+++ w/lisp/doc-view.el
@@ -1753,4 +1753,5 @@ doc-view-clone-buffer-hook
(defun doc-view-intersection (l1 l2)
+ (declare (obsolete nil "28.1"))
(let ((l ()))
(dolist (x l1) (if (memq x l2) (push x l)))
@@ -1759,5 +1760,5 @@ doc-view-intersection
(defun doc-view-set-doc-type ()
"Figure out the current document type (`doc-view-doc-type')."
- (let ((name-types
+ (let ((name-type
(when buffer-file-name
(cdr (assoc-string
@@ -1765,36 +1766,36 @@ doc-view-set-doc-type
'(
;; DVI
- ("dvi" dvi)
+ ("dvi" . dvi)
;; PDF
- ("pdf" pdf) ("epdf" pdf)
+ ("pdf" . pdf) ("epdf" . pdf)
;; PostScript
- ("ps" ps) ("eps" ps)
+ ("ps" . ps) ("eps" . ps)
;; DjVu
- ("djvu" djvu)
+ ("djvu" . djvu)
;; OpenDocument formats.
- ("odt" odf) ("ods" odf) ("odp" odf) ("odg" odf)
- ("odc" odf) ("odi" odf) ("odm" odf) ("ott" odf)
- ("ots" odf) ("otp" odf) ("otg" odf)
+ ("odt" . odf) ("ods" . odf) ("odp" . odf) ("odg" . odf)
+ ("odc" . odf) ("odi" . odf) ("odm" . odf) ("ott" . odf)
+ ("ots" . odf) ("otp" . odf) ("otg" . odf)
;; Microsoft Office formats (also handled by the odf
;; conversion chain).
- ("doc" odf) ("docx" odf) ("xls" odf) ("xlsx" odf)
- ("ppt" odf) ("pps" odf) ("pptx" odf) ("rtf" odf))
+ ("doc" . odf) ("docx" . odf) ("xls" . odf) ("xlsx" . odf)
+ ("ppt" . odf) ("pps" . odf) ("pptx" . odf) ("rtf" . odf))
t))))
- (content-types
+ (content-type
(save-excursion
(goto-char (point-min))
(cond
- ((looking-at "%!") '(ps))
- ((looking-at "%PDF") '(pdf))
- ((looking-at "\367\002") '(dvi))
- ((looking-at "AT&TFORM") '(djvu))))))
+ ((looking-at "%!") 'ps)
+ ((looking-at "%PDF") 'pdf)
+ ((looking-at "\367\002") 'dvi)
+ ((looking-at "AT&TFORM") 'djvu)))))
(setq-local
doc-view-doc-type
- (car (or (doc-view-intersection name-types content-types)
- (when (and name-types content-types)
- (error "Conflicting types: name says %s but content says %s"
- name-types content-types))
- name-types content-types
- (error "Cannot determine the document type"))))))
+ (or (and (eq name-type content-type) name-type)
+ (when (and name-type content-type)
+ (error "Conflicting types: name says %s but content says %s"
+ name-type content-type))
+ name-type content-type
+ (error "Cannot determine the document type")))))
(defun doc-view-set-up-single-converter ()