[SOLVED] How to make mouse wheel scroll ONE line at a time in Emacs ?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The -nw option would cause emacs to run inside a terminal so it can't get input from the mouse. In that case the terminal emulator is what is scrolling, not emacs. I use urxvt and it appears to scroll 5 lines at a time.
The -nw option would cause emacs to run inside a terminal so it can't get input from the mouse. In that case the terminal emulator is what is scrolling, not emacs. I use urxvt and it appears to scroll 5 lines at a time.
Till now all I was telling you was w.r.t using Emacs with -nw option !!!!
Now I used
Code:
emacs file.c
and when I moved the center wheel of my mouse, the screen scrolled but not the cursor !!!
Did this happen in your case too ? I want the cursor to move not the screen !
Till now all I was telling you was w.r.t using Emacs with -nw option !!!!
Hah, this has been an interesting case of online miscommunication.
Quote:
Now I used
Code:
emacs file.c
and when I moved the center wheel of my mouse, the screen scrolled but not the cursor !!!
Did this happen in your case too ? I want the cursor to move not the screen !
Yes that is the standard behaviour. Although note that in emacs, unlike in most other applications, the cursor always remains in the screen: if you move the screen far enough that the cursor goes off screen it gets "pushed" by the edge so that it stays in view.
If you want the mouse wheel to move the cursor, you can get that with
I added the following lines at the end of my .emacs file, closed it, restarted emacs, but again, the screen moves, cursor stays still, which is very annoying !!
Can you post the contents of *Help* buffer when you do C-h k <scroll with mouse wheel>, this is what I get:
Code:
<mouse-5> (translated from <down-mouse-5> <mouse-5>)
at that spot runs
the command next-line, which is an interactive compiled Lisp function.
It is bound to <mouse-5>, C-n.
(next-line &optional arg try-vscroll)
...
<mouse-4> (translated from <down-mouse-4> <mouse-4>) at that spot runs the
command mwheel-scroll, which is an interactive compiled Lisp function.
It is bound to <mouse-5>, <S-mouse-5>, <C-mouse-5>, <mouse-4>, <S-mouse-4>,
<C-mouse-4>.
(mwheel-scroll EVENT)
Scroll up or down according to the EVENT.
This should only be bound to mouse buttons 4 and 5.
For information about GNU Emacs and the GNU system, type C-h C-a.
defining keys
C-t runs the command transpose-chars
defined keys
C-t runs the command next-line
Quote:
Thanks for bothering
No problem, I'm going to be so satisfied when we figure this one out.
Loading /usr/share/emacs/site-lisp/nxml-mode/rng-auto.el (source)...done
defining keys
C-t runs the command transpose-chars
defined keys
C-t runs the command next-line
For information about GNU Emacs and the GNU system, type C-h C-a.
Invalid image size (see `max-image-size') [10 times]
and here is the relevant code of my .emacs file
Code:
;; ========== Line by line scrolling ==========
;; scroll one line at a time (less "jumpy" than defaults)
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(setq scroll-step 1) ;; keyboard scroll one line at a time
(setq scroll-conservatively 10000)
(setq mouse-wheel-scroll-amount '(0.01))
(define-key global-map (kbd "<mouse-5>") 'next-line)
(define-key global-map (kbd "<mouse-4>") 'previous-line)
(message "defining keys")
(describe-key-briefly (kbd "C-t"))
(define-key global-map (kbd "<mouse-5>") 'next-line)
(define-key global-map (kbd "<mouse-4>") 'previous-line)
(define-key global-map (kbd "C-t") 'next-line)
(message "defined keys")
(describe-key-briefly (kbd "C-t"))
Have you learnt Lisp ? Is that the reason you know so much ?
Last edited by Aquarius_Girl; 07-17-2010 at 01:31 AM.
Yes, that did not help ! I see no point in banging my head now.
So just to be clear, you started with emacs -Q -l scroll.el, the *Message* buffer says that <mouse-4> is bound to previous-line, but scrolling with the mouse wheel doesn't move the cursor? If you use C-h k <mouse wheel> does it show <mouse-4> still bound to previous-line?
Quote:
Emacs version:
Code:
GNU Emacs 23.1.1 (x86_64-suse-linux-gnu, GTK+ Version 2.18.1) of 2009-10-24 on build24
Code:
GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.18.3) of 2009-11-01 on excelsior, modified by Debian
Pretty much the same version, shouldn't be any problems there...
Quote:
Knowing Lisp was a part of your profession or just for knowing Emacs ?
Heh, still a student so I don't exactly have a profession. I learned scheme at in 1st year, and started using emacs a bit later. Then I noticed that elisp and scheme were similar so I read the An Introduction to Programming in Emacs Lisp, and I also learned Common Lisp later just for fun.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.