]> git.eshelyaron.com Git - emacs.git/commitdiff
(doc-view-mode): Don't use string-match and file
authorTassilo Horn <tassilo@member.fsf.org>
Wed, 28 Jan 2009 20:33:44 +0000 (20:33 +0000)
committerTassilo Horn <tassilo@member.fsf.org>
Wed, 28 Jan 2009 20:33:44 +0000 (20:33 +0000)
extension to choose fallback mode on empty/non-existing files but
let-bind auto-mode-alist and call normal-mode.

lisp/ChangeLog
lisp/doc-view.el

index 47aaa51deb6cac070b4afaf50fe8c82f8ba86ee0..049e10dbe7e5e1bdc67e24302c1988f8467741cc 100644 (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
index 8817db739e14259287a926b65abf53ef755adbc8..6d8ad649b94896964f076ec83f607fe7ecae86f2 100644 (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