[gnu.emacs.bug] view.el: why does View-scroll-lines-forward exit?

beldar@mips.COM (Gardner Cohen) (12/07/89)

emacs 18.55:

View-scroll-lines-forward in view.el prints a message suggesting
typing the 'exit-recursive-edit' key when you reach the end; however,
it has code to exit-recursive-edit the next time
View-scroll-lines-forward is called, as with the next space or
control-v.

Is this a bug, and if not, can it be made configurable (e.g.,
view-mode-exit-at-end)?

Another related request: should manual-entry (man.el) (1) leave the
buffer writable, (2) use only one buffer name, preventing multiple man
page buffers, and (3) not select the man page buffer?  I have a hacked
manual-entry that runs view-mode on the uniquely named man page
buffer.  (manual-entry-hook, anyone?)
-- 
Gardner Cohen     beldar@mips.com   (408) 991-6567

gildea@ALEXANDER.BBN.COM (Stephen Gildea) (01/04/90)

    View-scroll-lines-forward in view.el prints a message suggesting
    typing the 'exit-recursive-edit' key when you reach the end; however,
    it has code to exit-recursive-edit the next time
    View-scroll-lines-forward is called, as with the next space or
    control-v.
    
    Is this a bug, and if not, can it be made configurable (e.g.,
    view-mode-exit-at-end)?


It's a feature, not a bug.  The following diffs should satisfy you.
They change the message in the echo area to tell you that SPC also
exits, and add a user variable, view-scroll-forward-exits, to turn off
this behavior.

 < Stephen


diff -c /usr/local/emacs/lisp/view.el view.el
*** /usr/local/emacs/lisp/view.el       Sun Aug 21 21:04:47 1988
--- view.el     Tue Jan  2 11:32:19 1990
***************
*** 22,27 ****
--- 22,31 ----

  (provide 'view)

+ (defvar view-scroll-forward-exits t
+   "*Non-nil to have \\[View-scroll-lines-forward] exit View mode when at EOF.
+ If nil, an explicit \\[exit-recursive-edit] must be typed.")
+
  (defvar view-mode-map nil)
  (if view-mode-map
      nil
***************
*** 249,260 ****
    (recenter (/ (view-window-size) 2)))

  (defun View-scroll-lines-forward (&optional lines)
!   "Scroll forward in View mode, or exit if end of text is visible.
  No arg means whole window full, or number of lines set by \\[View-scroll-lines
-forward-set-scroll-size].
  Arg is number of lines to scroll."
    (interactive "P")
!   (if (pos-visible-in-window-p (point-max))
!       (exit-recursive-edit))
    (setq lines
        (if lines (prefix-numeric-value lines)
          (view-scroll-size)))
--- 253,266 ----
    (recenter (/ (view-window-size) 2)))

  (defun View-scroll-lines-forward (&optional lines)
!   "Scroll forward in View mode.
! Exits if end of text is visible and  view-scroll-forward-exits  is non-nil.
  No arg means whole window full, or number of lines set by \\[View-scroll-lines
-forward-set-scroll-size].
  Arg is number of lines to scroll."
    (interactive "P")
!   (and (pos-visible-in-window-p (point-max))
!        view-scroll-forward-exits
!        (exit-recursive-edit))
    (setq lines
        (if lines (prefix-numeric-value lines)
          (view-scroll-size)))
***************
*** 267,274 ****
    (cond ((pos-visible-in-window-p (point-max))
         (goto-char (point-max))
         (recenter -1)
!        (message (substitute-command-keys
!               "End.  Type \\[exit-recursive-edit] to quit viewing."))))
    (move-to-window-line -1)
    (beginning-of-line))

--- 273,283 ----
    (cond ((pos-visible-in-window-p (point-max))
         (goto-char (point-max))
         (recenter -1)
!        (if view-scroll-forward-exits
!            (message (substitute-command-keys
!                      "End.  Scrolling forward or typing \\[exit-recursive-edit
] quits viewing."))
!          (message (substitute-command-keys
!                    "End.  Type \\[exit-recursive-edit] to quit viewing.")))))
    (move-to-window-line -1)
    (beginning-of-line))