aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2005-03-13 23:20:49 +0000
committerKim F. Storm2005-03-13 23:20:49 +0000
commit295f6616401967b2fae6671a5d2ae36a287576e9 (patch)
tree36daf14bd11927bffc2bbabd82f25388879ac554
parent40821110d733562f0fabb01b257e14ad4ca670c6 (diff)
downloademacs-295f6616401967b2fae6671a5d2ae36a287576e9.tar.gz
emacs-295f6616401967b2fae6671a5d2ae36a287576e9.zip
(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.
-rw-r--r--lisp/simple.el25
1 files changed, 15 insertions, 10 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 207f5b83abc..9062d39e1c1 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3177,8 +3177,9 @@ commands which are sensitive to the Transient Mark mode."
3177 :version "21.1" 3177 :version "21.1"
3178 :group 'editing-basics) 3178 :group 'editing-basics)
3179 3179
3180(defun next-line (&optional arg) 3180(defun next-line (&optional arg try-vscroll)
3181 "Move cursor vertically down ARG lines. 3181 "Move cursor vertically down ARG lines.
3182Interactively, vscroll tall lines if `auto-window-vscroll' is enabled.
3182If there is no character in the target line exactly under the current column, 3183If there is no character in the target line exactly under the current column,
3183the cursor is positioned after the character in that line which spans this 3184the cursor is positioned after the character in that line which spans this
3184column, or at the end of the line if it is not long enough. 3185column, or at the end of the line if it is not long enough.
@@ -3197,7 +3198,7 @@ when there is no goal column.
3197If you are thinking of using this in a Lisp program, consider 3198If you are thinking of using this in a Lisp program, consider
3198using `forward-line' instead. It is usually easier to use 3199using `forward-line' instead. It is usually easier to use
3199and more reliable (no dependence on goal column, etc.)." 3200and more reliable (no dependence on goal column, etc.)."
3200 (interactive "p") 3201 (interactive "p\np")
3201 (or arg (setq arg 1)) 3202 (or arg (setq arg 1))
3202 (if (and next-line-add-newlines (= arg 1)) 3203 (if (and next-line-add-newlines (= arg 1))
3203 (if (save-excursion (end-of-line) (eobp)) 3204 (if (save-excursion (end-of-line) (eobp))
@@ -3205,16 +3206,17 @@ and more reliable (no dependence on goal column, etc.)."
3205 (let ((abbrev-mode nil)) 3206 (let ((abbrev-mode nil))
3206 (end-of-line) 3207 (end-of-line)
3207 (insert "\n")) 3208 (insert "\n"))
3208 (line-move arg nil nil t)) 3209 (line-move arg nil nil try-vscroll))
3209 (if (interactive-p) 3210 (if (interactive-p)
3210 (condition-case nil 3211 (condition-case nil
3211 (line-move arg nil nil t) 3212 (line-move arg nil nil try-vscroll)
3212 ((beginning-of-buffer end-of-buffer) (ding))) 3213 ((beginning-of-buffer end-of-buffer) (ding)))
3213 (line-move arg nil nil t))) 3214 (line-move arg nil nil try-vscroll)))
3214 nil) 3215 nil)
3215 3216
3216(defun previous-line (&optional arg) 3217(defun previous-line (&optional arg try-vscroll)
3217 "Move cursor vertically up ARG lines. 3218 "Move cursor vertically up ARG lines.
3219Interactively, vscroll tall lines if `auto-window-vscroll' is enabled.
3218If there is no character in the target line exactly over the current column, 3220If there is no character in the target line exactly over the current column,
3219the cursor is positioned after the character in that line which spans this 3221the cursor is positioned after the character in that line which spans this
3220column, or at the end of the line if it is not long enough. 3222column, or at the end of the line if it is not long enough.
@@ -3229,13 +3231,13 @@ when there is no goal column.
3229If you are thinking of using this in a Lisp program, consider using 3231If you are thinking of using this in a Lisp program, consider using
3230`forward-line' with a negative argument instead. It is usually easier 3232`forward-line' with a negative argument instead. It is usually easier
3231to use and more reliable (no dependence on goal column, etc.)." 3233to use and more reliable (no dependence on goal column, etc.)."
3232 (interactive "p") 3234 (interactive "p\np")
3233 (or arg (setq arg 1)) 3235 (or arg (setq arg 1))
3234 (if (interactive-p) 3236 (if (interactive-p)
3235 (condition-case nil 3237 (condition-case nil
3236 (line-move (- arg) nil nil t) 3238 (line-move (- arg) nil nil try-vscroll)
3237 ((beginning-of-buffer end-of-buffer) (ding))) 3239 ((beginning-of-buffer end-of-buffer) (ding)))
3238 (line-move (- arg) nil nil t)) 3240 (line-move (- arg) nil nil try-vscroll))
3239 nil) 3241 nil)
3240 3242
3241(defcustom track-eol nil 3243(defcustom track-eol nil
@@ -3274,8 +3276,11 @@ Outline mode sets this."
3274 (assq prop buffer-invisibility-spec))))) 3276 (assq prop buffer-invisibility-spec)))))
3275 3277
3276;; Perform vertical scrolling of tall images if necessary. 3278;; Perform vertical scrolling of tall images if necessary.
3279;; Don't vscroll in a keyboard macro.
3277(defun line-move (arg &optional noerror to-end try-vscroll) 3280(defun line-move (arg &optional noerror to-end try-vscroll)
3278 (if (and auto-window-vscroll try-vscroll) 3281 (if (and auto-window-vscroll try-vscroll
3282 (not defining-kbd-macro)
3283 (not executing-kbd-macro))
3279 (let ((forward (> arg 0)) 3284 (let ((forward (> arg 0))
3280 (part (nth 2 (pos-visible-in-window-p (point) nil t)))) 3285 (part (nth 2 (pos-visible-in-window-p (point) nil t))))
3281 (if (and (consp part) 3286 (if (and (consp part)