From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: Advice on troubleshooting function to "unscroll" Date: Sun, 25 Jan 2015 22:35:28 +0100 Message-ID: <874mreh7c5.fsf@wmi.amu.edu.pl> References: <54C5577D.4030700@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1422221758 12469 80.91.229.3 (25 Jan 2015 21:35:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Jan 2015 21:35:58 +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:35:58 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 1YFUqb-00016Q-7o for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Jan 2015 22:35:57 +0100 Original-Received: from localhost ([::1]:39003 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFUqa-0004sN-JD for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Jan 2015 16:35:56 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFUqJ-0004s7-Eq for help-gnu-emacs@gnu.org; Sun, 25 Jan 2015 16:35:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFUqG-0003vk-5W for help-gnu-emacs@gnu.org; Sun, 25 Jan 2015 16:35:39 -0500 Original-Received: from msg.wmi.amu.edu.pl ([2001:808:114:2::50]:34011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFUqF-0003vP-SL for help-gnu-emacs@gnu.org; Sun, 25 Jan 2015 16:35:36 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by msg.wmi.amu.edu.pl (Postfix) with ESMTP id 84B2B4AC59 for ; Sun, 25 Jan 2015 22:35:33 +0100 (CET) Original-Received: from msg.wmi.amu.edu.pl ([127.0.0.1]) by localhost (msg.wmi.amu.edu.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HIRmq3Hqf3Ir for ; Sun, 25 Jan 2015 22:35:33 +0100 (CET) Original-Received: from localhost (117-116.echostar.pl [213.156.117.116]) by msg.wmi.amu.edu.pl (Postfix) with ESMTPSA id 0E50A4AC4F for ; Sun, 25 Jan 2015 22:35:32 +0100 (CET) In-reply-to: <54C5577D.4030700@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:808:114:2::50 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:102251 Archived-At: On 2015-01-25, at 21:52, Will Monroe wrote: > Hello, > > I'm studying Emacs Lisp so that I can become more proficient at > customizing GNU Emacs for purposes, mainly using org-mode. I'm studying > alone using Bob Glickstein's *Writing GNU Emacs Extensions*. So far, > the book has been a terrific guide to basic concepts. But I've run into > a problem that I can't seem to troubleshoot any further and I'd > appreciate advice on: 1) the best way to troubleshoot this problem > (e.g., other forums, listservs, or IRC channels that might be more > appropriate) and 2) troubleshooting the problem itself. I apologize in > advance if this query has failed to take into account any basics or if > it would be better posed elsewhere. I welcome your on the best way to > proceed. Welcome to the land of Elisp. (I'm also a relative newcomer here.) BTW, I looked at the free sample of Glickstein's book in the Amazon Kindle store (not that I recommend it -- in fact, it is seemingly prohibited to recommend things like that here), and got the impression that it is a nice book -- something to read right after the "Emacs Lisp Intro" by Robert J. Chassell -- but it might be a bit outdated. (For instance, the early part about problems with C-h and backspace seem to be irrelevant nowadays.) A question to more knowledgeable people: is that impression correct? > So, following Glickstein's advice in Chapter 3, I'm trying to create a > function that will allow me to create an "unscroll" function that will > allow me to return to a prior buffer position after (inadvertently) > pressing C-v a few times. The code to do this defines three new > variables, defines advice for an extant Emacs function, scroll-up, and > then defines a new function, unscroll. The code is below. Please note that there is new syntax for advising functions in Emacs 24.4 (or 25, I'm not sure). The old one should work, but the new one is much simpler. > 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. > > I could move one but I suspect that the mistake I've made will come up > again. I'd really welcome your (gentle) feedback! I would strongly advise (no pun intended) to read the Emacs Lisp reference, section about Edebug. > All the best, > > Will The same to you, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University