comparison lisp/doc-view.el @ 101623:0974e3e4aca7

(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.
author Tassilo Horn <tassilo@member.fsf.org>
date Wed, 28 Jan 2009 20:33:44 +0000
parents 4372a2194e53
children b62aecf6b1db
comparison
equal deleted inserted replaced
101622:0476d5672e52 101623:0974e3e4aca7
1091 \\{doc-view-mode-map}" 1091 \\{doc-view-mode-map}"
1092 (interactive) 1092 (interactive)
1093 1093
1094 (if (or (not (file-exists-p buffer-file-name)) 1094 (if (or (not (file-exists-p buffer-file-name))
1095 (= (point-min) (point-max))) 1095 (= (point-min) (point-max)))
1096 ;; The doc is empty or doesn't exist at all, so fallback to an 1096 ;; The doc is empty or doesn't exist at all, so fallback to
1097 ;; editing mode. 1097 ;; another mode.
1098 (if (string-match "[eE]?[pP][sS]" (file-name-extension buffer-file-name)) 1098 (let ((auto-mode-alist (remq (rassq 'doc-view-mode auto-mode-alist)
1099 (ps-mode) 1099 auto-mode-alist)))
1100 (fundamental-mode)) ;;Should we activate d-v-minor-mode here? 1100 (normal-mode))
1101 1101
1102 (let* ((prev-major-mode (if (eq major-mode 'doc-view-mode) 1102 (let* ((prev-major-mode (if (eq major-mode 'doc-view-mode)
1103 doc-view-previous-major-mode 1103 doc-view-previous-major-mode
1104 major-mode))) 1104 major-mode)))
1105 (kill-all-local-variables) 1105 (kill-all-local-variables)