X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/da932079d0f7a35c0c7567a9c5fd4dbbbe7af077..9e362b84e9a054a5bbed81480e0d69b371efd255:/lisp/view.el diff --git a/lisp/view.el b/lisp/view.el index b17cd52ae3..457d5efc1c 100644 --- a/lisp/view.el +++ b/lisp/view.el @@ -1,7 +1,7 @@ ;;; view.el --- peruse file or buffer without editing -;; Copyright (C) 1985, 1989, 1994, 1995, 1997, 2000, 2001 -;; Free Software Foundation, Inc. +;; Copyright (C) 1985, 1989, 1994, 1995, 1997, 2000, 2001, 2002, +;; 2003, 2004, 2005, 2006 Free Software Foundation, Inc. ;; Author: K. Shane Hartman ;; Maintainer: Inge Frick @@ -21,8 +21,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. ;;; Commentary: @@ -93,6 +93,12 @@ considered for restoring." :type 'boolean :group 'view) +(defcustom view-inhibit-help-message nil + "*Non-nil inhibits the help message showed upon entering View mode." + :type 'boolean + :group 'view + :version "22.1") + ;;;###autoload (defvar view-mode nil "Non-nil if View mode is enabled. @@ -117,12 +123,12 @@ functions that enable or disable view mode.") (defvar view-page-size nil "Default number of lines to scroll by View page commands. -If nil then the local value of this is initially set to window size.") +If nil that means use the window size.") (make-variable-buffer-local 'view-page-size) (defvar view-half-page-size nil "Default number of lines to scroll by View half page commands. -If nil then the local value of this is initially set to half window size.") +If nil that means use half the window size.") (make-variable-buffer-local 'view-half-page-size) (defvar view-last-regexp nil) @@ -433,12 +439,14 @@ p searches backward for last regular expression. \\[View-kill-and-leave] quit View mode, kill current buffer and go back to other buffer. The effect of \\[View-leave] , \\[View-quit] and \\[View-kill-and-leave] depends on how view-mode was entered. If it was -entered by view-file, view-file-other-window or view-file-other-frame -\(\\[view-file], \\[view-file-other-window], \\[view-file-other-frame] or the dired mode v command), then \\[View-quit] will -try to kill the current buffer. If view-mode was entered from another buffer -as is done by View-buffer, View-buffer-other-window, View-buffer-other frame, -View-file, View-file-other-window or View-file-other-frame then \\[View-leave] , \\[View-quit] and \\[View-kill-and-leave] -will return to that buffer. +entered by view-file, view-file-other-window, view-file-other-frame, or +\\[dired-view-file] \(\\[view-file], \\[view-file-other-window], +\\[view-file-other-frame], or the Dired mode v command), +then \\[View-quit] will try to kill the current buffer. +If view-mode was entered from another buffer, by \\[view-buffer], +\\[view-buffer-other-window], \\[view-buffer-other frame], \\[view-file], +\\[view-file-other-window], or \\[view-file-other-frame], +then \\[View-leave] , \\[View-quit] and \\[View-kill-and-leave] will return to that buffer. Entry to view-mode runs the normal hook `view-mode-hook'." (interactive "P") @@ -453,8 +461,8 @@ Entry to view-mode runs the normal hook `view-mode-hook'." ;; This is to guarantee that the buffer-read-only variable is restored. (add-hook 'change-major-mode-hook 'view-mode-disable nil t) (setq view-mode t - view-page-size (view-page-size-default view-page-size) - view-half-page-size (or view-half-page-size (/ (view-window-size) 2)) + view-page-size nil + view-half-page-size nil view-old-buffer-read-only buffer-read-only buffer-read-only t view-old-Helper-return-blurb (and (boundp 'Helper-return-blurb) @@ -516,9 +524,10 @@ This function runs the normal hook `view-mode-hook'." (unless view-mode ; Do nothing if already in view mode. (view-mode-enable) (force-mode-line-update) - (message "%s" - (substitute-command-keys "\ -View mode: type \\[help-command] for help, \\[describe-mode] for commands, \\[View-quit] to quit.")))) + (unless view-inhibit-help-message + (message "%s" + (substitute-command-keys "\ +View mode: type \\[help-command] for help, \\[describe-mode] for commands, \\[View-quit] to quit."))))) (defun view-mode-exit (&optional return-to-alist exit-action all-win) "Exit View mode in various ways, depending on optional arguments. @@ -675,7 +684,8 @@ previous state and go to previous buffer or window." (defun view-set-half-page-size-default (lines) ;; Get and maybe set half page size. - (if (not lines) view-half-page-size + (if (not lines) (or view-half-page-size + (/ (view-window-size) 2)) (setq view-half-page-size (if (zerop (setq lines (prefix-numeric-value lines))) (/ (view-window-size) 2) @@ -803,13 +813,13 @@ Exit if end of text is visible and `view-scroll-auto-exit' is non-nil. \\[View-scroll-page-backward-set-page-size]. If LINES is more than a window-full, only the last window-full is shown." (interactive "P") - (view-scroll-lines lines nil view-page-size nil)) + (view-scroll-lines lines nil (view-page-size-default view-page-size) nil)) (defun View-scroll-page-backward (&optional lines) "Scroll \"page size\" or prefix LINES lines backward in View mode. See also `View-scroll-page-forward'." (interactive "P") - (view-scroll-lines lines t view-page-size nil)) + (view-scroll-lines lines t (view-page-size-default view-page-size) nil)) (defun View-scroll-page-forward-set-page-size (&optional lines) "Scroll forward LINES lines in View mode, setting the \"page size\". @@ -873,7 +883,7 @@ If LINES is more than a window-full, only the last window-full is shown." (interactive "P") (let ((view-scroll-auto-exit nil) (view-try-extend-at-buffer-end t)) - (view-scroll-lines lines nil view-page-size nil))) + (view-scroll-lines lines nil (view-page-size-default view-page-size) nil))) (defun View-search-regexp-forward (n regexp) "Search forward for first (or prefix Nth) occurrence of REGEXP in View mode.