[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scroll-top-bottom (was: delete-selection-mode)
From: |
Juri Linkov |
Subject: |
scroll-top-bottom (was: delete-selection-mode) |
Date: |
Sat, 20 Mar 2010 03:34:59 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) |
>> The pc-select-override-scroll-error feature is something more.
>
> I think it should be moved to simple.el since it is not directly related
> to pc-select and is useful globally outside of pc-select.
This feature is implemented by CUA mode, but it would be very useful
for users who don't use CUA. To support it in the core, I've implemented
a new user option `scroll-top-bottom' (that defines the scrolling behavior
at the top/bottom of the buffer).
If this is better to implement in Lisp, then `scroll-up' and
`scroll-down' should be moved from window.c to window.el.
=== modified file 'lisp/emulation/pc-select.el'
--- lisp/emulation/pc-select.el 2010-03-12 17:47:22 +0000
+++ lisp/emulation/pc-select.el 2010-03-19 23:59:44 +0000
@@ -93,6 +93,9 @@ (defcustom pc-select-override-scroll-err
errors are suppressed."
:type 'boolean
:group 'pc-select)
+(define-obsolete-variable-alias 'pc-select-override-scroll-error
+ 'scroll-top-bottom
+ "24.1")
(defcustom pc-select-selection-keys-only nil
"*Non-nil means only bind the basic selection keys when started.
=== modified file 'lisp/cus-start.el'
--- lisp/cus-start.el 2010-01-13 08:35:10 +0000
+++ lisp/cus-start.el 2010-03-19 23:55:19 +0000
@@ -306,6 +306,12 @@ (let ((all '(;; alloc.c
(const :tag "Off (nil)" :value nil)
(const :tag "Full screen (t)" :value t)
(other :tag "Always" 1)) "22.1")
+ (scroll-top-bottom
+ windows (choice
+ (const :tag "Off (nil)" :value nil)
+ (other :tag "Move to top/bottom (t)" :value t))
+ "24.1")
(recenter-redisplay windows
(choice
(const :tag "Never (nil)" :value nil)
=== modified file 'src/window.c'
--- src/window.c 2010-01-13 08:35:10 +0000
+++ src/window.c 2010-03-19 23:57:16 +0000
@@ -168,6 +168,11 @@ (at your option) any later version.
Lisp_Object Vscroll_preserve_screen_position;
+/* Non-nil means scroll commands move point to top/bottom of buffer
+ before signalling an error. */
+
+Lisp_Object Vscroll_top_bottom;
+
/* Non-nil means that text is inserted before window's markers. */
Lisp_Object Vwindow_point_insertion_type;
@@ -5014,7 +5019,12 @@
- it.current_y + it.max_ascent + it.max_descent);
adjust_glyphs (it.f);
}
- else if (noerror)
+ else if (!NILP (Vscroll_top_bottom) && PT < ZV)
+ {
+ SET_PT (ZV);
+ return;
+ }
+ else if (noerror)
return;
else if (n < 0) /* could happen with empty buffers */
xsignal0 (Qbeginning_of_buffer);
@@ -5027,7 +5037,12 @@
/* The first line was only partially visible, make it fully
visible. */
w->vscroll = 0;
- else if (noerror)
+ else if (!NILP (Vscroll_top_bottom) && PT > BEGV)
+ {
+ SET_PT (BEGV);
+ return;
+ }
+ else if (noerror)
return;
else
xsignal0 (Qbeginning_of_buffer);
@@ -5242,7 +5257,12 @@
if (lose)
{
- if (noerror)
+ if (!NILP (Vscroll_top_bottom) && PT > BEGV)
+ {
+ SET_PT (BEGV);
+ return;
+ }
+ else if (noerror)
return;
else
xsignal0 (Qbeginning_of_buffer);
@@ -5328,7 +5348,12 @@
}
else
{
- if (noerror)
+ if (!NILP (Vscroll_top_bottom) && PT < ZV)
+ {
+ SET_PT (ZV);
+ return;
+ }
+ else if (noerror)
return;
else
xsignal0 (Qend_of_buffer);
@@ -7268,6 +7293,15 @@
Any other value means point always keeps its screen position. */);
Vscroll_preserve_screen_position = Qnil;
+ DEFVAR_LISP ("scroll-top-bottom",
+ &Vscroll_top_bottom,
+ doc: /* Controls if scroll commands move point to the top/bottom
of the buffer.
+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. */);
+ Vscroll_top_bottom = Qnil;
+
DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type,
doc: /* Type of marker to use for `window-point'. */);
Vwindow_point_insertion_type = Qnil;
--
Juri Linkov
http://www.jurta.org/emacs/
- Motif, (continued)
- Motif, Richard Stallman, 2010/03/13
- delete-selection-mode (was: Put scroll-bar on right by default on UNIX.), Juri Linkov, 2010/03/16
- Re: delete-selection-mode (was: Put scroll-bar on right by default on UNIX.), Lennart Borgman, 2010/03/16
- RE: delete-selection-mode (was: Put scroll-bar on right by default onUNIX.), Drew Adams, 2010/03/17
- Re: delete-selection-mode, Juri Linkov, 2010/03/17
- RE: delete-selection-mode, Drew Adams, 2010/03/17
- Re: delete-selection-mode, Stefan Monnier, 2010/03/17
- Re: delete-selection-mode, Chong Yidong, 2010/03/18
- Re: delete-selection-mode, Johan Bockgård, 2010/03/18
- Re: delete-selection-mode, Juri Linkov, 2010/03/18
- scroll-top-bottom (was: delete-selection-mode),
Juri Linkov <=
- Re: scroll-top-bottom, Stefan Monnier, 2010/03/20
- Re: scroll-top-bottom, Juri Linkov, 2010/03/20
- Scrolling commands (was: scroll-top-bottom), Juri Linkov, 2010/03/30
- Re: Scrolling commands (was: scroll-top-bottom), Juanma Barranquero, 2010/03/30
- Re: Scrolling commands, Juri Linkov, 2010/03/31
- Re: Scrolling commands, Juanma Barranquero, 2010/03/31
- Re: delete-selection-mode, Juri Linkov, 2010/03/18
- Permanent shift-select-mode (was: delete-selection-mode), Juri Linkov, 2010/03/20
- Re: Permanent shift-select-mode, Stefan Monnier, 2010/03/21
- Re: delete-selection-mode, David Kastrup, 2010/03/17