Function: view-mode-enter

view-mode-enter is an autoloaded and byte-compiled function defined in view.el.gz.

Signature

(view-mode-enter &optional QUIT-RESTORE EXIT-ACTION)

Documentation

Enter View mode and set up exit from view mode depending on optional arguments.

Optional argument QUIT-RESTORE if non-nil must specify a valid entry for quitting and restoring any window showing the current buffer. This entry replaces any parameter installed by display-buffer and is used by view-mode-exit.

Optional argument EXIT-ACTION, if non-nil, must specify a function that takes a buffer as argument. This function will be called by view-mode-exit.

For a list of all View commands, type H or h while viewing.

This function runs the normal hook view-mode-hook.

Probably introduced at or before Emacs version 20.1.

Aliases

erc-view-mode-enter (obsolete since 28.1) mh-view-mode-enter (obsolete since 29.1)

Source Code

;; Defined in /usr/src/emacs/lisp/view.el.gz
;;;###autoload
(defun view-mode-enter (&optional quit-restore exit-action)
  "Enter View mode and set up exit from view mode depending on optional arguments.
Optional argument QUIT-RESTORE if non-nil must specify a valid
entry for quitting and restoring any window showing the current
buffer.  This entry replaces any parameter installed by
`display-buffer' and is used by `view-mode-exit'.

Optional argument EXIT-ACTION, if non-nil, must specify a
function that takes a buffer as argument.  This function will be
called by `view-mode-exit'.

For a list of all View commands, type H or h while viewing.

This function runs the normal hook `view-mode-hook'."
  (when quit-restore
    (dolist (window (get-buffer-window-list nil nil t))
      (set-window-parameter window 'quit-restore quit-restore)))

  (when exit-action
    (setq view-exit-action exit-action))

  (unless view-mode
    (view-mode 1)
    (when (and (not view-inhibit-help-message)
               ;; Avoid spamming the echo area if `view-mode' is entered
               ;; non-interactively, e.g., in a temporary buffer (bug#44629).
               this-command)
      (message "%s"
	       (substitute-command-keys "\
View mode: type \\[help-command] for help, \\[describe-mode] for commands, \\[View-quit] to quit.")))))