# HG changeset patch # User Tassilo Horn # Date 1233174824 0 # Node ID 0974e3e4aca72f11acd6fd5a7042b011d917740c # Parent 0476d5672e5285ae97f5cabb686cb91bc417efb0 (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. diff -r 0476d5672e52 -r 0974e3e4aca7 lisp/ChangeLog --- a/lisp/ChangeLog Wed Jan 28 19:02:17 2009 +0000 +++ b/lisp/ChangeLog Wed Jan 28 20:33:44 2009 +0000 @@ -1,3 +1,9 @@ +2009-01-28 Tassilo Horn + + * 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 * ls-lisp.el (ls-lisp-classify): Propertize file name before diff -r 0476d5672e52 -r 0974e3e4aca7 lisp/doc-view.el --- a/lisp/doc-view.el Wed Jan 28 19:02:17 2009 +0000 +++ b/lisp/doc-view.el Wed Jan 28 20:33:44 2009 +0000 @@ -1093,11 +1093,11 @@ (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