Function: doc-view-toggle-display
doc-view-toggle-display is an interactive and byte-compiled function
defined in doc-view.el.gz.
Signature
(doc-view-toggle-display)
Documentation
Toggle between editing a document as text or viewing it.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/doc-view.el.gz
(defun doc-view-toggle-display ()
"Toggle between editing a document as text or viewing it."
(interactive)
(cond
((eq major-mode 'doc-view-mode)
;; Switch to editing mode
(doc-view-kill-proc)
(setq buffer-read-only nil)
;; Switch to the previously used major mode or fall back to
;; normal mode.
(doc-view-fallback-mode)
(doc-view-minor-mode 1))
((eq major-mode 'doc-view--text-view-mode)
;; We're currently viewing the document's text contents, switch to
;; the buffer visiting the real document and kill myself.
(let ((dv-buffer (find-buffer-visiting doc-view--buffer-file-name)))
(kill-buffer)
(switch-to-buffer dv-buffer)))
(t
;; Switch to doc-view-mode
(when (and (buffer-modified-p)
(y-or-n-p "The buffer has been modified. Save the changes? "))
(save-buffer))
(doc-view-mode))))