From: Tassilo Horn Date: Thu, 30 Dec 2010 14:47:53 +0000 (+0100) Subject: * doc-view.el (doc-view-mode, doc-view-toggle-display): Use X-Git-Tag: emacs-pretest-24.0.90~104^2~618^2~1322^2~278^2~45 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ad727c819a625c4f9cf482dda17cf339fa88610c;p=emacs.git * doc-view.el (doc-view-mode, doc-view-toggle-display): Use normal-mode without doc-view-mode bindings in auto-mode-alist as fallback instead of hard coding fundamental mode. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8717bb441b7..3b28681fec5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2010-12-30 Tassilo Horn + + * doc-view.el (doc-view-mode, doc-view-toggle-display): Use + normal-mode without doc-view-mode bindings in auto-mode-alist as + fallback instead of hard coding fundamental mode. + 2010-12-30 Tassilo Horn * doc-view.el (doc-view-doc->txt): Handle OpenDocument (or MS diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 9f5826484e5..526bf7694fb 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1047,7 +1047,6 @@ For now these keys are useful: ;;;;; Toggle between editing and viewing - (defun doc-view-toggle-display () "Toggle between editing a document as text or viewing it." (interactive) @@ -1058,11 +1057,12 @@ For now these keys are useful: (setq buffer-read-only nil) (remove-overlays (point-min) (point-max) 'doc-view t) (set (make-local-variable 'image-mode-winprops-alist) t) - ;; Switch to the previously used major mode or fall back to fundamental - ;; mode. + ;; Switch to the previously used major mode or fall back to + ;; normal mode. (if doc-view-previous-major-mode (funcall doc-view-previous-major-mode) - (fundamental-mode)) + (let ((auto-mode-alist (rassq-delete-all 'doc-view-mode auto-mode-alist))) + (normal-mode))) (doc-view-minor-mode 1)) ;; Switch to doc-view-mode (when (and (buffer-modified-p) @@ -1271,7 +1271,8 @@ toggle between displaying the document or editing it as text. (let* ((prev-major-mode (if (eq major-mode 'doc-view-mode) doc-view-previous-major-mode - major-mode))) + (when (not (eq major-mode 'fundamental-mode)) + major-mode)))) (kill-all-local-variables) (set (make-local-variable 'doc-view-previous-major-mode) prev-major-mode))