1

I found here that the following disables DocView mode for a specific file type, like PDF:

(add-to-list 'auto-mode-alist '("\\.pdf\\'" . fundamental-mode))

But how can DocView mode be disabled completely, for any file type? (on GNU Emacs 26.1)

  • Did you try: (rassq-delete-all #'doc-view-mode auto-mode-alist)? The thread you link to suggests this is what you want. – Tyler May 14 at 16:32
  • Just tried, thanks, Tyler (I must have missed that). But it didn't work. JPGs still show up in DocView (even PDFs now that I removed the above). – Marius Hofert May 14 at 16:40
  • See @Stefan comment, I think it needs to be: (rassq-delete-all #'doc-view-mode-maybe auto-mode-alist)? – Tyler May 14 at 17:35
2

Other than the (rassq-delete-all #'doc-view-mode-maybe auto-mode-alist) suggested by Tyler (but note you need to use ...-maybe), you can also be more drastic:

;; Die, Doc-View-mode! die!
(defalias 'doc-view-mode #'doc-view-fallback-mode) ;Or fundamental-mode, ...
  • Hi, thanks, the #'fundamental-mode seems to work, but not for .jpg files. Is that normal? (minibuffer shows (Image[jpeg]) but file is still displayed as an image). Could that be something other than DocView? So I'm in dired-mode, hit RET on a .jpg file and that shows me the picture in the current buffer. Hmmm, even if I use emacs -Q. – Marius Hofert May 14 at 18:15
  • Ahhh, it's image mode! You can toggle via 'C-c C-c', then you see the source, great, thanks! – Marius Hofert May 14 at 18:19
  • I think "DocView" and "Image" don't start with the same letter, so there's a good chance it's not the same thing ;-) – Stefan May 14 at 18:19
  • ok, so now I need a die, DocView *and* Image mode, die! :-) Sometimes Emacs is just too smart... – Marius Hofert May 14 at 18:21
  • ... and since C-c C-c also works in doc-view mode, one should probably just remember that and not disable it at all (for consistency). – Marius Hofert May 14 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.