1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-31 20:02:42 +00:00

(next-line, previous-line): Add optional try-vscroll

arg to recognize interactive use.  Pass it on to line-move.
(line-move): Don't perform auto-window-vscroll when defining or
executing keyboard macro to ensure consistent behaviour.
This commit is contained in:
Kim F. Storm 2005-03-13 23:20:49 +00:00
parent 40821110d7
commit 295f661640

View File

@ -3177,8 +3177,9 @@ commands which are sensitive to the Transient Mark mode."
:version "21.1" :version "21.1"
:group 'editing-basics) :group 'editing-basics)
(defun next-line (&optional arg) (defun next-line (&optional arg try-vscroll)
"Move cursor vertically down ARG lines. "Move cursor vertically down ARG lines.
Interactively, vscroll tall lines if `auto-window-vscroll' is enabled.
If there is no character in the target line exactly under the current column, If there is no character in the target line exactly under the current column,
the cursor is positioned after the character in that line which spans this the cursor is positioned after the character in that line which spans this
column, or at the end of the line if it is not long enough. column, or at the end of the line if it is not long enough.
@ -3197,7 +3198,7 @@ when there is no goal column.
If you are thinking of using this in a Lisp program, consider If you are thinking of using this in a Lisp program, consider
using `forward-line' instead. It is usually easier to use using `forward-line' instead. It is usually easier to use
and more reliable (no dependence on goal column, etc.)." and more reliable (no dependence on goal column, etc.)."
(interactive "p") (interactive "p\np")
(or arg (setq arg 1)) (or arg (setq arg 1))
(if (and next-line-add-newlines (= arg 1)) (if (and next-line-add-newlines (= arg 1))
(if (save-excursion (end-of-line) (eobp)) (if (save-excursion (end-of-line) (eobp))
@ -3205,16 +3206,17 @@ and more reliable (no dependence on goal column, etc.)."
(let ((abbrev-mode nil)) (let ((abbrev-mode nil))
(end-of-line) (end-of-line)
(insert "\n")) (insert "\n"))
(line-move arg nil nil t)) (line-move arg nil nil try-vscroll))
(if (interactive-p) (if (interactive-p)
(condition-case nil (condition-case nil
(line-move arg nil nil t) (line-move arg nil nil try-vscroll)
((beginning-of-buffer end-of-buffer) (ding))) ((beginning-of-buffer end-of-buffer) (ding)))
(line-move arg nil nil t))) (line-move arg nil nil try-vscroll)))
nil) nil)
(defun previous-line (&optional arg) (defun previous-line (&optional arg try-vscroll)
"Move cursor vertically up ARG lines. "Move cursor vertically up ARG lines.
Interactively, vscroll tall lines if `auto-window-vscroll' is enabled.
If there is no character in the target line exactly over the current column, If there is no character in the target line exactly over the current column,
the cursor is positioned after the character in that line which spans this the cursor is positioned after the character in that line which spans this
column, or at the end of the line if it is not long enough. column, or at the end of the line if it is not long enough.
@ -3229,13 +3231,13 @@ when there is no goal column.
If you are thinking of using this in a Lisp program, consider using If you are thinking of using this in a Lisp program, consider using
`forward-line' with a negative argument instead. It is usually easier `forward-line' with a negative argument instead. It is usually easier
to use and more reliable (no dependence on goal column, etc.)." to use and more reliable (no dependence on goal column, etc.)."
(interactive "p") (interactive "p\np")
(or arg (setq arg 1)) (or arg (setq arg 1))
(if (interactive-p) (if (interactive-p)
(condition-case nil (condition-case nil
(line-move (- arg) nil nil t) (line-move (- arg) nil nil try-vscroll)
((beginning-of-buffer end-of-buffer) (ding))) ((beginning-of-buffer end-of-buffer) (ding)))
(line-move (- arg) nil nil t)) (line-move (- arg) nil nil try-vscroll))
nil) nil)
(defcustom track-eol nil (defcustom track-eol nil
@ -3274,8 +3276,11 @@ Outline mode sets this."
(assq prop buffer-invisibility-spec))))) (assq prop buffer-invisibility-spec)))))
;; Perform vertical scrolling of tall images if necessary. ;; Perform vertical scrolling of tall images if necessary.
;; Don't vscroll in a keyboard macro.
(defun line-move (arg &optional noerror to-end try-vscroll) (defun line-move (arg &optional noerror to-end try-vscroll)
(if (and auto-window-vscroll try-vscroll) (if (and auto-window-vscroll try-vscroll
(not defining-kbd-macro)
(not executing-kbd-macro))
(let ((forward (> arg 0)) (let ((forward (> arg 0))
(part (nth 2 (pos-visible-in-window-p (point) nil t)))) (part (nth 2 (pos-visible-in-window-p (point) nil t))))
(if (and (consp part) (if (and (consp part)