From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: JohnF Newsgroups: gmane.emacs.help Subject: Re: .emacs to keep cursor stationary when scrolling with mouse Date: Sun, 31 May 2015 04:03:52 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Message-ID: References: <556822a6$0$3333$426a74cc@news.free.fr> <556871ca$0$3055$426a74cc@news.free.fr> <556986bf$0$3339$426a74cc@news.free.fr> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1433045118 20365 80.91.229.3 (31 May 2015 04:05:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 31 May 2015 04:05:18 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 31 06:05:17 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YyuUv-0000xg-Gi for geh-help-gnu-emacs@m.gmane.org; Sun, 31 May 2015 06:05:17 +0200 Original-Received: from localhost ([::1]:41081 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyuUu-0008MA-TG for geh-help-gnu-emacs@m.gmane.org; Sun, 31 May 2015 00:05:16 -0400 Original-Path: usenet.stanford.edu!panix!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 43 Original-NNTP-Posting-Host: panix3.panix.com Original-X-Trace: reader1.panix.com 1433045032 22747 166.84.1.3 (31 May 2015 04:03:52 GMT) Original-X-Complaints-To: abuse@panix.com Original-NNTP-Posting-Date: Sun, 31 May 2015 04:03:52 +0000 (UTC) User-Agent: tin/2.2.1-20140504 ("Tober an Righ") (UNIX) (NetBSD/6.1.5 (i386)) Original-Xref: usenet.stanford.edu gnu.emacs.help:212412 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:104696 Archived-At: Damien Wyart wrote: >> [...] This is what it does with keyboard. Mouse wheel and drag bar >> always scroll text, but point gets dragged along with the scrolling >> text, and jumps back towards center when it nears window top/bottom. >> Instead, I'd like point to just remain stationary on screen, as yexy >> scrolls "underneath" it. > > I could get what you want for the wheel by using this: > (global-set-key (kbd "") 'scroll-down-command) > (global-set-key (kbd "") 'scroll-up-command) > Can you confirm this is OK? Absolutely confirmed! Thanks Damien, works like a charm. I guess the guy who replied "You can't..." to one of the stackoverflow questions you referred me to earlier was wrong. Looks like "You can". And now "I can", too :) Thanks. I guess you could post this solution there, though it's maybe a bit late for that op. > About the scrollbar, I do not use it myself (many users of emacs use > "(scroll-bar-mode -1)" in their .emacs and only use keyboard and mouse > wheel), Yeah, no problem. I use the scrollbar mostly for large moves within the buffer, where M->,< don't get close. The wheel is way more important to me. I'd have mentioned that if it had occurred to me that it might make a difference. > but looking at the code this is more difficult to get the exact > behavior you want. Thanks again for your time and effort looking at it. > When testing, this seems most of the time to do what > you want, but a few jumps apear from time to time, depending on the > content of the buffer. It's perfect. Those jumps occur when the point starts at a column beyond the end-of-line for text passing underneath it as you scroll. Then it jumps left to the end of that line, and jumps back to the original column when text passing underneath it is again long enough. -- John Forkosh ( mailto: j@f.com where j=john and f=forkosh )