From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yevgeniy Makarov Newsgroups: gmane.emacs.help Subject: Re: How to scroll while keeping the position of the point with respect to the text? Date: Wed, 05 Sep 2007 19:49:48 -0000 Organization: http://groups.google.com Message-ID: <1189021788.363162.152960@19g2000hsx.googlegroups.com> References: <1189019337.916627.259710@57g2000hsv.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: sea.gmane.org 1189024884 19188 80.91.229.12 (5 Sep 2007 20:41:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 5 Sep 2007 20:41:24 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Sep 05 22:41:24 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IT1gh-0001yb-Gm for geh-help-gnu-emacs@m.gmane.org; Wed, 05 Sep 2007 22:41:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IT1gf-0006DW-TF for geh-help-gnu-emacs@m.gmane.org; Wed, 05 Sep 2007 16:41:21 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!19g2000hsx.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 23 Original-NNTP-Posting-Host: 193.52.24.125 Original-X-Trace: posting.google.com 1189021788 14759 127.0.0.1 (5 Sep 2007 19:49:48 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 5 Sep 2007 19:49:48 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.5) Gecko/20070718 Fedora/2.0.0.5-1.fc7 Firefox/2.0.0.5,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: 19g2000hsx.googlegroups.com; posting-host=193.52.24.125; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Original-Xref: shelby.stanford.edu gnu.emacs.help:151726 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:47250 Archived-At: > (global-set-key [M-up] > (lambda() (interactive) (scroll-down 1) (previous-line 1))) > (global-set-key [M-down] > (lambda() (interactive) (scroll-up 1) (next-line 1))) > (global-set-key [S-up] > (lambda() (interactive) (scroll-up 1))) > (global-set-key [S-down] > (lambda() (interactive) (scroll-down 1))) > > in my .emacs. Thus I could use Shift-up/down to scroll and keep the > position of the point wrt the text (Ithink that was what you were > looking for) or use M-up/down to scroll the text underneath the point. I am sorry, something does not fit here. Your Shift-up does scroll-up, which does change the position of the cursor. Second, "(scroll-down 1) (previous-line 1)" moves the point *two* lines w.r.t. the text. You probably meant "(scroll-down 1) (next-line 1)". Finally, the problem with this is that the point is moved to the beginning of the line. And preserving the horizontal position is not easy, because if some line is shorter but the following one is long, I'd like for the point to keep the horizontal position. This calls for watching for the unbroken series of scrolling commands.