LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 07-17-2010, 12:22 AM   #16
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081

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.
 
1 members found this post helpful.
Old 07-17-2010, 12:29 AM   #17
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by ntubski View Post
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 !
 
Old 07-17-2010, 12:39 AM   #18
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by anishakaul View Post
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
Code:
(define-key global-map (kbd "<mouse-5>") 'next-line)
(define-key global-map (kbd "<mouse-4>") 'previous-line)
 
Old 07-17-2010, 12:45 AM   #19
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by ntubski View Post
If you want the mouse wheel to move the cursor, you can get that with
Code:
(define-key global-map (kbd "<mouse-5>") 'next-line)
(define-key global-map (kbd "<mouse-4>") 'previous-line)
Thanks again, but that didn't help !

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 !!

Did you try that on your machine ?
 
Old 07-17-2010, 12:47 AM   #20
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by anishakaul View Post
Did you try that on your machine ?
It works here. This is without -nw, mind.
 
Old 07-17-2010, 12:51 AM   #21
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
I tried that once again, doesn't work,
Since you have tried it on your comp, please paste your .emacs file here, let me copy it and see what happens.
 
Old 07-17-2010, 01:01 AM   #22
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
As before I haven't put this in my own .emacs, but it works with .emacs consisting soley of the lines:

Code:
(define-key global-map (kbd "<mouse-5>") 'next-line)
(define-key global-map (kbd "<mouse-4>") 'previous-line)
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)
...
 
Old 07-17-2010, 01:05 AM   #23
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Thanks for bothering
Code:
<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.
 
Old 07-17-2010, 01:22 AM   #24
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
It appears that the define-key calls didn't work.

Okay, let's see what happens with this .emacs:
Code:
(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"))
Post the contents of the *Messages* buffer.

I get
Code:
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.
 
Old 07-17-2010, 01:28 AM   #25
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Thanks again,

*Messages* buffer:
Code:
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.
 
Old 07-17-2010, 01:45 AM   #26
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
The invalid image size looks kind of suspicious, although the define-key apparently worked on C-t.

Just to eliminate other factors, put just the following into a new file, call it scroll.el:
Code:
(message "defining keys")
(define-key global-map (kbd "<mouse-5>") 'next-line)
(define-key global-map (kbd "<mouse-4>") 'previous-line)
(message "defined keys")
(describe-key-briefly (kbd "<mouse-4>"))
Then run emacs like so
Code:
emacs -Q -l scroll.el
and post the *Messages* buffer.

Quote:
Originally Posted by anishakaul View Post
Have you learnt Lisp ? Is that the reason you know so much ?
Learning Lisp, and also reading the manuals, and a lot of the EmacsWiki, and lots of experimenting.
 
Old 07-17-2010, 01:52 AM   #27
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Messages buffer:
Code:
For information about GNU Emacs and the GNU system, type C-h C-a.
defining keys
defined keys
<mouse-4> at that spot runs the command previous-line
Quote:
Originally Posted by ntubski View Post
Learning Lisp, and also reading the manuals, and a lot of the EmacsWiki, and lots of experimenting.
Without learning Lisp, you couldn't have known all this, right ? EmacsWiki is not enough if one doesn't know Lisp !
 
Old 07-17-2010, 02:01 AM   #28
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by anishakaul View Post
Messages buffer:
Code:
For information about GNU Emacs and the GNU system, type C-h C-a.
defining keys
defined keys
<mouse-4> at that spot runs the command previous-line
It looks like the mouse wheel was rebound correctly, did you try scrolling?

Quote:
Without learning Lisp, you couldn't have known all this, right ? EmacsWiki is not enough if one doesn't know Lisp !
Yes, knowing Lisp is what lets you adapt/create new solutions to fit the current problem, rather than just knowing a bunch of canned sequences.
 
Old 07-17-2010, 02:05 AM   #29
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by ntubski View Post
It looks like the mouse wheel was rebound correctly, did you try scrolling?
Yes, that did not help ! I see no point in banging my head now.

Emacs version:
Code:
GNU Emacs 23.1.1 (x86_64-suse-linux-gnu, GTK+ Version 2.18.1) of 2009-10-24 on build24

Quote:
Originally Posted by ntubski View Post
Yes, knowing Lisp is what lets you adapt/create new solutions to fit the current problem, rather than just knowing a bunch of canned sequences.
Knowing Lisp was a part of your profession or just for knowing Emacs ?

Thanks for all your help till now.
 
Old 07-17-2010, 02:22 AM   #30
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by anishakaul View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mouse scroll wheel dasy2k1 Linux - Newbie 1 10-07-2005 07:25 PM
Scroll wheel of mouse - How to make it work? Redhat 9 umeshz Red Hat 19 12-29-2004 05:54 AM
4d wheel mouse - scroll wheel no worky CamelofCamelot Linux - Hardware 1 10-28-2004 08:33 PM
How do i make mouse wheel scroll page in KDE? glenn69 Linux - Newbie 3 09-18-2004 11:04 AM
wheel line scroll amount control? doublefailure Linux - Hardware 3 03-25-2003 08:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration