[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which
From: |
Juri Linkov |
Subject: |
Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom. |
Date: |
Tue, 06 Apr 2010 23:19:16 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) |
> This fixes one problem, but not the other: scroll-(up|down)-command do
> not preserve the column.
I see now what do you mean. This patch takes care of that:
=== modified file 'lisp/simple.el'
--- lisp/simple.el 2010-04-05 19:08:58 +0000
+++ lisp/simple.el 2010-04-06 20:18:23 +0000
@@ -4877,6 +4877,16 @@ (define-globalized-minor-mode global-vis
;;; of buffer at first key-press (instead moves to top/bottom
;;; of buffer).
+(defcustom scroll-error-top-bottom nil
+ "Move point to top/bottom of buffer before signalling a scrolling error.
+A value of nil means just signal an error if no more scrolling possible.
+A value of t means point moves to the beginning or the end of the buffer
+\(depending on scrolling direction) when no more scrolling possible.
+When point is already on that position, then signal an error."
+ :type 'boolean
+ :group 'scrolling
+ :version "24.1")
+
(defun scroll-up-command (&optional arg)
"Scroll text of selected window upward ARG lines; or near full screen if no
ARG.
If `scroll-up' cannot scroll window further, move cursor to the bottom line.
@@ -4886,6 +4896,8 @@ (defun scroll-up-command (&optional arg)
If ARG is the atom `-', scroll downward by nearly full screen."
(interactive "^P")
(cond
+ ((null scroll-error-top-bottom)
+ (scroll-up arg))
((eq arg '-) (scroll-down-command nil))
((< (prefix-numeric-value arg) 0)
(scroll-down-command (- (prefix-numeric-value arg))))
@@ -4893,7 +4905,14 @@ (defun scroll-up-command (&optional arg)
(scroll-up arg)) ; signal error
(t
(condition-case nil
- (scroll-up arg)
+ (progn
+ (when (and scroll-preserve-screen-position
+ (not (eq scroll-preserve-screen-position t)))
+ (setq temporary-goal-column
+ (if (and track-eol (eolp) (not (bolp)))
+ most-positive-fixnum
+ (current-column))))
+ (scroll-up arg))
(end-of-buffer
(if arg
;; When scrolling by ARG lines can't be done,
@@ -4901,7 +4920,10 @@ (defun scroll-up-command (&optional arg)
(forward-line arg)
;; When ARG is nil for full-screen scrolling,
;; move to the bottom of the buffer.
- (goto-char (point-max))))))))
+ (goto-char (point-max))
+ (when (and scroll-preserve-screen-position
+ (not (eq scroll-preserve-screen-position t)))
+ (line-move-to-column (truncate temporary-goal-column)))))))))
(put 'scroll-up-command 'isearch-scroll t)
@@ -4914,6 +4936,8 @@ (defun scroll-down-command (&optional ar
If ARG is the atom `-', scroll upward by nearly full screen."
(interactive "^P")
(cond
+ ((null scroll-error-top-bottom)
+ (scroll-down arg))
((eq arg '-) (scroll-up-command nil))
((< (prefix-numeric-value arg) 0)
(scroll-up-command (- (prefix-numeric-value arg))))
@@ -4921,7 +4945,14 @@ (defun scroll-down-command (&optional ar
(scroll-down arg)) ; signal error
(t
(condition-case nil
- (scroll-down arg)
+ (progn
+ (when (and scroll-preserve-screen-position
+ (not (eq scroll-preserve-screen-position t)))
+ (setq temporary-goal-column
+ (if (and track-eol (eolp) (not (bolp)))
+ most-positive-fixnum
+ (current-column))))
+ (scroll-down arg))
(beginning-of-buffer
(if arg
;; When scrolling by ARG lines can't be done,
@@ -4929,7 +4960,10 @@ (defun scroll-down-command (&optional ar
(forward-line (- arg))
;; When ARG is nil for full-screen scrolling,
;; move to the top of the buffer.
- (goto-char (point-min))))))))
+ (goto-char (point-min))
+ (when (and scroll-preserve-screen-position
+ (not (eq scroll-preserve-screen-position t)))
+ (line-move-to-column (truncate temporary-goal-column)))))))))
(put 'scroll-down-command 'isearch-scroll t)
--
Juri Linkov
http://www.jurta.org/emacs/
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom., Juanma Barranquero, 2010/04/05
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom., Juri Linkov, 2010/04/05
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom., Juanma Barranquero, 2010/04/05
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom., Juri Linkov, 2010/04/06
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom., Juanma Barranquero, 2010/04/06
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom.,
Juri Linkov <=
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom., Juanma Barranquero, 2010/04/06
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom., Juri Linkov, 2010/04/06
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom., Juanma Barranquero, 2010/04/06
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom., Juanma Barranquero, 2010/04/06
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom., Juri Linkov, 2010/04/07
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom., Juanma Barranquero, 2010/04/07
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom., Juri Linkov, 2010/04/07
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom., Juanma Barranquero, 2010/04/07
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom., Stefan Monnier, 2010/04/09
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom., Juri Linkov, 2010/04/09