1) Let's assume the cursor is somewhere in the middle of the
screen. How can I scroll the screen by 1 line up or down?
2) If I'm at the bottom of the screen and I press cursor-down then the
screen scrolls by several lines. Google told me to set scroll-step to
1.
(setq scroll-step 1)
That works several times but then the cursor is suddenly in the middle
of the screen. I don't like that.
Thanks for any help :)
schaecsn> 1) Let's assume the cursor is somewhere in the
schaecsn> middle of the screen. How can I scroll the screen by 1
schaecsn> line up or down?
I use the following:
(defun pete-scroll-down-one ()
(interactive)
(scroll-down 1))
(defun pete-scroll-up-one ()
(interactive)
(scroll-up 1))
(global-set-key (kbd "<f12>") 'pete-scroll-down-one)
(global-set-key (kbd "<f11>") 'pete-scroll-up-one)
schaecsn> 2) If I'm at the bottom of the screen and I press
schaecsn> cursor-down then the screen scrolls by several
schaecsn> lines. Google told me to set scroll-step to 1.
schaecsn> (setq scroll-step 1)
schaecsn> That works several times but then the cursor is suddenly
schaecsn> in the middle of the screen. I don't like that.
This happens to me too... go to top of large buffer and just hit C-n.
Every once in a while the cursor pops to center of buffer and
continues down. Hopefully someone here can tell us how to fix that.
(require 'scroll-in-place)
(setq scroll-step 1)
(scroll-bar-mode -1)
> (global-set-key (kbd "<f12>") 'pete-scroll-down-one)
> (global-set-key (kbd "<f11>") 'pete-scroll-up-one)
... at least in emacs-20.x and emacs-21.x but not in emacs-19.34.
Is there a way to refer in emacs-19.34 to the function keys?
- Stefan
Hi!
I had the ame problem and didn't like the scroll behavior.
I found scroll-in-place.el, which I bound to shift-cursor keys. When I
use it the cursor stays in place and the bzuffer content moves.
You should be able to find the code here:
http://www.on.ics.keio.ac.jp/~yasu/linux/scroll-in-place.el or
somewhere else on google. If not I can mail it to you or post it on
gnu.emacs.sources
I added the following lines to my .emacs:
;; Scrolls one line at the time
(setq scroll-step 1)
;; Better scrolling...
(require 'scroll-in-place)
;; By default, this package provides for the standard GNU Emacs vertical
;; scrolling commands (`scroll-down', `scroll-up', `scroll-other-window-
;; down', and `scroll-other-window') to use the "in place" features. If you
;; would rather not have this, set the variable `scroll-in-place' to `nil':
(setq scroll-in-place nil)
;; When `scroll-in-place' is `nil' you will have to bind keys in order to
;; call the "in place" scrolling commands. For example, you might want to do
;; the following:
(setq scroll-command-groups
(list '(scroll-down-one-line scroll-up-one-line)))
;;; You could write the `scroll-down-one-line' command like this:
(defun scroll-down-one-line (arg)
"Scroll down one line, or number of lines specified by prefix arg."
(interactive "P")
(let ((scroll-default-lines 1))
(scroll-down-in-place arg)))
(defun scroll-up-one-line (arg)
"Scroll down one line, or number of lines specified by prefix arg."
(interactive "P")
(let ((scroll-default-lines 1))
(scroll-up-in-place arg)))
;; key bindings
(global-set-key [(shift up)] 'scroll-down-one-line)
(global-set-key [(shift down)] 'scroll-up-one-line)
HTH, best
--
Michael
r-znvy: zvpunry.wryqra jro.qr (chg gur "@" jurer vg svgf...)
ab fcnz cyrnfr
On Fri, 08 Aug 2003 07:01:47 GMT, schaecsn <scha...@taipeh.wonderland.de> wrote:
>
> > (global-set-key (kbd "<f12>") 'pete-scroll-down-one)
> > (global-set-key (kbd "<f11>") 'pete-scroll-up-one)
>
> ... at least in emacs-20.x and emacs-21.x but not in emacs-19.34.
>
> Is there a way to refer in emacs-19.34 to the function keys?
(define-key global-map '[f11] 'pete-scroll-up-one)
Ehud.
- --
Ehud Karni Tel: +972-3-7966-561 /"\
Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign
Insurance agencies (USA) voice mail and X Against HTML Mail
http://www.mvs.co.il FAX: 1-815-5509341 / \
mailto:eh...@unix.mvs.co.il Better Safe Than Sorry
-----BEGIN PGP SIGNATURE-----
Comment: use http://www.keyserver.net/ to get my key (and others)
iD8DBQE/M2AMLFvTvpjqOY0RArAzAJwLr0ZHpdJEIBsVrhNCgacY5GKcTQCeIKro
5eqA8ni1DVHR9RoCgspcxh0=
=qyQK
-----END PGP SIGNATURE-----
* For scrolling down one line, I use C-down (the down arrow):
(global-set-key [C-down] '"\C-u1\C-v")
* For scrolling up one line, I user C-up (the up arrow):
(global-set-key [C-up] '"\C-u1\M-v")
schaecsn wrote:
--
Harshdeep S Jawanda
> 2) If I'm at the bottom of the screen and I press cursor-down then the
> screen scrolls by several lines. Google told me to set scroll-step to
> 1.
>
> (setq scroll-step 1)
>
> That works several times but then the cursor is suddenly in the middle
> of the screen. I don't like that.
Emacs 21 has the variable scroll-conservatively. Use C-h v for more
information.
Does this help?
--
Two cafe au lait please, but without milk.
>> 2) If I'm at the bottom of the screen and I press cursor-down then the
>> screen scrolls by several lines. Google told me to set scroll-step to
>> 1.
>>
>> (setq scroll-step 1)
>>
>> That works several times but then the cursor is suddenly in the middle
>> of the screen. I don't like that.
>
> Emacs 21 has the variable scroll-conservatively. Use C-h v for more
> information.
Finally, after 20 versions! :)
> Does this help?
Almost :) I set it to 1. Scrolling down in a large buffer works a
couple of times but then the cursor jumps in the middle of the screen.
- Stefan
>> Emacs 21 has the variable scroll-conservatively. Use C-h v for more
>> information.
[...]
> I set it to 1. Scrolling down in a large buffer works a couple of
> times but then the cursor jumps in the middle of the screen.
Also read what C-h v scroll-step says.
--
Join us on #emacs @ irc.freenode.net.
http://www.emacswiki.org/cgi-bin/wiki.pl/EmacsChannel
> Almost :) I set it to 1. Scrolling down in a large buffer works a
> couple of times but then the cursor jumps in the middle of the screen.
Instead of 1, try a large number.
Kai> schaecsn <scha...@taipeh.wonderland.de> writes:
>> Almost :) I set it to 1. Scrolling down in a large buffer works
>> a couple of times but then the cursor jumps in the middle of
>> the screen.
Kai> Instead of 1, try a large number.
It doesn't appear to do what we want. When I repeatedly next-line I
would like the cursor to move down the buffer until it hits the bottom
and then the buffer would scroll up one line at a time.
What happens now is it works for a while, but will periodically jump
the cursor to the middle of the buffer.
Setting scroll-conservatively to 50 caused it to jump to the top of
the buffer while setting it to 4 caused it to jump 4 lines up from the
bottom. I was looking for a way to prevent it from jumping at all.
I don't think there's a way to do this currently, and I've learned to
live with it. If I'm scrolling down that much I usually use C-v
anyway.
Thanks for the info.
> Setting scroll-conservatively to 50 caused it to jump to the top of
> the buffer while setting it to 4 caused it to jump 4 lines up from the
> bottom. I was looking for a way to prevent it from jumping at all.
I wasn't thinking of 50 when I said large number :-)
FWIW, I have (setq scroll-conservatively 9999) and scrolling down
some part of my ~/.emacs file didn't cause it to jump, even though
Emacs was doing garbage collection after a few hundred lines.
What happens when you leave scroll-step at the default of 0 and set
scroll-conservatively as I suggested?
[time passes]
Okay, I did a test. I invoked Emacs 21.3 (not the version I'm using
to post this) via "emacs -q -no-site-file", then I typed the
following into the *scratch* buffer and hit C-j at the end of the
line:
(setq scroll-conservatively 9999)
Then I opened ~/.emacs and scrolled down 600 lines. I didn't observe
any jumping.
What happens when you do this? (Maybe use another file.)
Kai> I wasn't thinking of 50 when I said large number :-)
Kai> FWIW, I have (setq scroll-conservatively 9999) and scrolling
Kai> down some part of my ~/.emacs file didn't cause it to jump,
Kai> even though Emacs was doing garbage collection after a few
Kai> hundred lines.
Setting it to 9999 solves the problem. It's just not intuitive to me
why.
Setting that var to 0 sporadically re-centers the cursor... setting it
to 50 causes cursor to pop to top of buffer every time cursor hits
bottom, setting it to 9999 causes desired behavior (at least in my
view).
Oh well, at least it works. Thanks for the help.
It should not be "sporadically" but "always". Maybe you have set
scroll-step at the same time as scroll-conservatively.
Stefan
> Setting it to 9999 solves the problem. It's just not intuitive to me
> why.
Suppose the cursor runs off the screen. If it was moving quick, it
might be 100 lines off-screen. If it was moving slow, it might be
just a few lines off-screen, before scrolling takes place.
The limit says how many lines does Emacs have to scroll. If the
cursor is further off, then Emacs doesn't scroll, it recenters.
At least that's my poor memory from the time when somebody else (Eli
or Stefan?) explained the issue. I never thought about it much,
except that I learned to set scroll-conservatively to a high value.
But now I find that the docstring of scroll-conservatively is, err,
suboptimal. So IWBNI somebody who groks this could explain it better.
> Hi,
>
> 1) Let's assume the cursor is somewhere in the middle of the
> screen. How can I scroll the screen by 1 line up or down?
Am I missing something or can't you just C-u 1 C-v?!
--
export AUTHOR=Alex\ Nikolov
echo $AUTHOR