From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Will Monroe Newsgroups: gmane.emacs.help Subject: Re: Advice on troubleshooting function to "unscroll" Date: Sun, 25 Jan 2015 15:57:41 -0600 Message-ID: <54C566D5.60609@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1422223084 876 80.91.229.3 (25 Jan 2015 21:58:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Jan 2015 21:58:04 +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:58:03 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 1YFVBx-00013T-Uz for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Jan 2015 22:58:02 +0100 Original-Received: from localhost ([::1]:39062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFVBx-0003BG-CN for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Jan 2015 16:58:01 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFVBi-0003Ay-Bx for help-gnu-emacs@gnu.org; Sun, 25 Jan 2015 16:57:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFVBf-000159-7a for help-gnu-emacs@gnu.org; Sun, 25 Jan 2015 16:57:46 -0500 Original-Received: from mail-oi0-x22f.google.com ([2607:f8b0:4003:c06::22f]:44139) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFVBf-00014V-36 for help-gnu-emacs@gnu.org; Sun, 25 Jan 2015 16:57:43 -0500 Original-Received: by mail-oi0-f47.google.com with SMTP id a141so4760595oig.6 for ; Sun, 25 Jan 2015 13:57:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=nniAcYDcPWsj8gWR2shd5QiFR+YqOYAZpR9nNTtv9Jw=; b=JmioJZMT5jw8RdRaIMfz5WIwMqq8Xr5sGhSD6k3WCRWgW6kWLycJexzC7NPjkr1jx6 QWMqYvlUUsf1xSw7zwz+F6PNsxWYlxRHmkQHDD5Er2ERg6rismAVqDyizfh06QhO8yX4 AM+xIA4veaSonBjb6A1fLKwoK9IQbJnZHETo3qkko/zh29w0ojivwbOP73CgVpHuH4dP kKkJhos2oubzToCSbepKPjiitltqkD1HNM8daqy8LcnJlj7Lh1FODHVUqdaELkIbHijn z45DfB8KKi+wDC2vd1imwIgLW3WXIi9p16Nqkaau783K7JVSbYtit7j7IuQssDTXBMxR nliA== X-Received: by 10.60.54.71 with SMTP id h7mr3542942oep.56.1422223062620; Sun, 25 Jan 2015 13:57:42 -0800 (PST) Original-Received: from [10.70.17.167] (wsip-66-210-63-210.br.no.cox.net. [66.210.63.210]) by mx.google.com with ESMTPSA id v187sm4293415oie.2.2015.01.25.13.57.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Jan 2015 13:57:42 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c06::22f 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:102256 Archived-At: Joost, Thank you for you response! On 01/25/2015 03:35 PM, Joost Kremers wrote: > 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. Thanks for recommending that more-readable rewrite. I will look into redrafting it this way. > > 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". > > [...] Thank you again. This is also very helpful. I found that defadvice still worked for this example (with one change, see below) but I won't likely use it again since it's no longer preferred. >> 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. > So simple! Thank you for this insight. Going forward, I'll include a check of what functions my keybindings are actually bound to! After substituting scroll-up-command for scroll-up in two places, it worked as intended. Thank you very much, Will > HTH > >