(doc-view-mode): Don't use string-match and file

extension to choose fallback mode on empty/non-existing files but
let-bind auto-mode-alist and call normal-mode.
This commit is contained in:
Tassilo Horn 2009-01-28 20:33:44 +00:00
parent 40077a525f
commit 856997723b
2 changed files with 11 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2009-01-28 Tassilo Horn <tassilo@member.fsf.org>
* doc-view.el (doc-view-mode): Don't use string-match and file
extension to choose fallback mode on empty/non-existing files but
let-bind auto-mode-alist and call normal-mode.
2009-01-28 Eli Zaretskii <eliz@gnu.org>
* ls-lisp.el (ls-lisp-classify): Propertize file name before

View file

@ -1093,11 +1093,11 @@ toggle between displaying the document or editing it as text.
(if (or (not (file-exists-p buffer-file-name))
(= (point-min) (point-max)))
;; The doc is empty or doesn't exist at all, so fallback to an
;; editing mode.
(if (string-match "[eE]?[pP][sS]" (file-name-extension buffer-file-name))
(ps-mode)
(fundamental-mode)) ;;Should we activate d-v-minor-mode here?
;; The doc is empty or doesn't exist at all, so fallback to
;; another mode.
(let ((auto-mode-alist (remq (rassq 'doc-view-mode auto-mode-alist)
auto-mode-alist)))
(normal-mode))
(let* ((prev-major-mode (if (eq major-mode 'doc-view-mode)
doc-view-previous-major-mode