From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: Re: Advice on troubleshooting function to "unscroll" Date: 25 Jan 2015 21:35:46 GMT Message-ID: References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1422222024 16691 80.91.229.3 (25 Jan 2015 21:40:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Jan 2015 21:40: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 Sun Jan 25 22:40:23 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 1YFUut-00061b-FV for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Jan 2015 22:40:23 +0100 Original-Received: from localhost ([::1]:39012 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFUur-0005yI-ME for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Jan 2015 16:40:21 -0500 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 44 Original-X-Trace: individual.net NO8GEok/CpM7btEDjoiuJAcmO3Y3aIq2gPoWJ2Vh8e0qCmuACn Cancel-Lock: sha1:5XNtBN8fHbaEqqKdc7KQEeFFZQs= Mail-Copies-To: nobody X-Editor: Emacs of course! User-Agent: slrn/pre1.0.0-18 (Linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:209973 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:102252 Archived-At: Will Monroe wrote: > (defadvice scroll-up (before remember-for-unscroll > activate compile) > "Remember where we started from, for 'unscroll'." > (if (not (eq last-command 'scroll-up)) Note that (if (not ) ... ) can be written as (unless ...) if you don't have an `else' part. It's slightly more readable that way IMHO. Also, as of (I think) Emacs 24.4, defadvice is no longer the recommended way to advise functions. There's a new package (`nadvice.el`) that defines `advice-add`. See the Elisp manual, section "Advising functions". [...] > The test was just opening a lengthy file, usually an info page or an > existing org-mode file, pressing C-v a few times, and then using M-x > unscroll. In all cases, I found that M-x unscroll would return to the > position just before the last C-v but not to the original position. In > other words, if I pressed C-v two times and then pressed M-x unscroll, > in would only go back one C-v. My intent, and that of the example in > the book, is to return the point the position before any C-v key > sequences were pressed. Have you checked what `C-v` is bound to? In my Emacs (24.4) it's bound to `scroll-up-command`, not to `scroll-up`. So that would defeat your if test above. HTH -- Joost Kremers joostkremers@fastmail.fm Selbst in die Unterwelt dringt durch Spalten Licht EN:SiS(9)