[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom. |
Date: |
Tue, 06 Apr 2010 02:38:53 +0300 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 99831
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Tue 2010-04-06 02:38:53 +0300
message:
Scrolling commands which does not signal errors at top/bottom.
http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg01452.html
* simple.el (scroll-up-command, scroll-down-command): New commands.
Put property isearch-scroll=t on them.
* bindings.el (global-map): Rebind [prior] from `scroll-down' to
`scroll-down-command' and [next] from `scroll-up' to
`scroll-up-command'.
* emulation/cua-base.el: Put property CUA=move on
`scroll-up-command' and `scroll-down-command'.
(cua--init-keymaps): Remap `scroll-up-command' to `cua-scroll-up'
and `scroll-down-command' to `cua-scroll-down'.
modified:
etc/NEWS
lisp/ChangeLog
lisp/bindings.el
lisp/emulation/cua-base.el
lisp/simple.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2010-03-31 14:55:01 +0000
+++ b/etc/NEWS 2010-04-05 23:38:53 +0000
@@ -65,6 +65,10 @@
** GTK scroll-bars are now placed on the right by default.
Use `set-scroll-bar-mode' to change this.
+** New scrolling commands `scroll-up-command' and `scroll-down-command'
+(bound to [next] and [prior]) does not signal errors at top/bottom
+of buffer at first key-press (instead moves to top/bottom of buffer).
+
* Editing Changes in Emacs 24.1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2010-04-05 20:05:47 +0000
+++ b/lisp/ChangeLog 2010-04-05 23:38:53 +0000
@@ -1,3 +1,20 @@
+2010-04-05 Juri Linkov <address@hidden>
+
+ Scrolling commands which does not signal errors at top/bottom.
+ http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg01452.html
+
+ * simple.el (scroll-up-command, scroll-down-command): New commands.
+ Put property isearch-scroll=t on them.
+
+ * bindings.el (global-map): Rebind [prior] from `scroll-down' to
+ `scroll-down-command' and [next] from `scroll-up' to
+ `scroll-up-command'.
+
+ * emulation/cua-base.el: Put property CUA=move on
+ `scroll-up-command' and `scroll-down-command'.
+ (cua--init-keymaps): Remap `scroll-up-command' to `cua-scroll-up'
+ and `scroll-down-command' to `cua-scroll-down'.
+
2010-04-05 Juanma Barranquero <address@hidden>
* help.el (describe-mode): Return nil.
=== modified file 'lisp/bindings.el'
--- a/lisp/bindings.el 2010-01-13 08:35:10 +0000
+++ b/lisp/bindings.el 2010-04-05 23:38:53 +0000
@@ -873,8 +873,8 @@
(define-key global-map [up] 'previous-line)
(define-key global-map [right] 'forward-char)
(define-key global-map [down] 'next-line)
-(define-key global-map [prior] 'scroll-down)
-(define-key global-map [next] 'scroll-up)
+(define-key global-map [prior] 'scroll-down-command)
+(define-key global-map [next] 'scroll-up-command)
(define-key global-map [C-up] 'backward-paragraph)
(define-key global-map [C-down] 'forward-paragraph)
(define-key global-map [C-prior] 'scroll-right)
=== modified file 'lisp/emulation/cua-base.el'
--- a/lisp/emulation/cua-base.el 2010-01-13 08:35:10 +0000
+++ b/lisp/emulation/cua-base.el 2010-04-05 23:38:53 +0000
@@ -1440,6 +1440,8 @@
;; scrolling
(define-key cua-global-keymap [remap scroll-up] 'cua-scroll-up)
(define-key cua-global-keymap [remap scroll-down] 'cua-scroll-down)
+ (define-key cua-global-keymap [remap scroll-up-command] 'cua-scroll-up)
+ (define-key cua-global-keymap [remap scroll-down-command] 'cua-scroll-down)
(define-key cua--cua-keys-keymap [(control x) timeout] 'kill-region)
(define-key cua--cua-keys-keymap [(control c) timeout] 'copy-region-as-kill)
@@ -1499,6 +1501,7 @@
move-end-of-line move-beginning-of-line
end-of-buffer beginning-of-buffer
scroll-up scroll-down
+ scroll-up-command scroll-down-command
up-list down-list backward-up-list
end-of-defun beginning-of-defun
forward-sexp backward-sexp
=== modified file 'lisp/simple.el'
--- a/lisp/simple.el 2010-03-31 15:16:12 +0000
+++ b/lisp/simple.el 2010-04-05 23:38:53 +0000
@@ -4738,6 +4738,69 @@
visual-line-mode turn-on-visual-line-mode
:lighter " vl")
+;;; Scrolling commands.
+
+;;; Scrolling commands which does not signal errors at top/bottom
+;;; of buffer at first key-press (instead moves to top/bottom
+;;; of buffer).
+
+(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.
+When point is already on that position, then signal an error.
+A near full screen is `next-screen-context-lines' less than a full screen.
+Negative ARG means scroll downward.
+If ARG is the atom `-', scroll downward by nearly full screen."
+ (interactive "^P")
+ (cond
+ ((eq arg '-) (scroll-down-command nil))
+ ((< (prefix-numeric-value arg) 0)
+ (scroll-down-command (- (prefix-numeric-value arg))))
+ ((eobp)
+ (scroll-up arg)) ; signal error
+ (t
+ (condition-case nil
+ (scroll-up arg)
+ (end-of-buffer
+ (if arg
+ ;; When scrolling by ARG lines can't be done,
+ ;; move by ARG lines instead.
+ (forward-line arg)
+ ;; When ARG is nil for full-screen scrolling,
+ ;; move to the bottom of the buffer.
+ (goto-char (point-max))))))))
+
+(put 'scroll-up-command 'isearch-scroll t)
+
+(defun scroll-down-command (&optional arg)
+ "Scroll text of selected window down ARG lines; or near full screen if no
ARG.
+If `scroll-down' cannot scroll window further, move cursor to the top line.
+When point is already on that position, then signal an error.
+A near full screen is `next-screen-context-lines' less than a full screen.
+Negative ARG means scroll upward.
+If ARG is the atom `-', scroll upward by nearly full screen."
+ (interactive "^P")
+ (cond
+ ((eq arg '-) (scroll-up-command nil))
+ ((< (prefix-numeric-value arg) 0)
+ (scroll-up-command (- (prefix-numeric-value arg))))
+ ((bobp)
+ (scroll-down arg)) ; signal error
+ (t
+ (condition-case nil
+ (scroll-down arg)
+ (beginning-of-buffer
+ (if arg
+ ;; When scrolling by ARG lines can't be done,
+ ;; move by ARG lines instead.
+ (forward-line (- arg))
+ ;; When ARG is nil for full-screen scrolling,
+ ;; move to the top of the buffer.
+ (goto-char (point-min))))))))
+
+(put 'scroll-down-command 'isearch-scroll t)
+
+
(defun scroll-other-window-down (lines)
"Scroll the \"other window\" down.
For more details, see the documentation for `scroll-other-window'."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r99831: Scrolling commands which does not signal errors at top/bottom.,
Juri Linkov <=