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:43:52 -0600 Message-ID: <54C56398.1050404@gmail.com> References: <54C5577D.4030700@gmail.com> <874mreh7c5.fsf@wmi.amu.edu.pl> 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 1422222262 20643 80.91.229.3 (25 Jan 2015 21:44:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Jan 2015 21:44:22 +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:44:22 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 1YFUye-0002ch-FT for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Jan 2015 22:44:16 +0100 Original-Received: from localhost ([::1]:39020 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFUyd-0007Bq-OC for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Jan 2015 16:44:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFUyN-00072U-TE for help-gnu-emacs@gnu.org; Sun, 25 Jan 2015 16:44:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFUyJ-0005pV-Eo for help-gnu-emacs@gnu.org; Sun, 25 Jan 2015 16:43:58 -0500 Original-Received: from mail-ob0-x230.google.com ([2607:f8b0:4003:c01::230]:48987) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFUyJ-0005pR-8P for help-gnu-emacs@gnu.org; Sun, 25 Jan 2015 16:43:55 -0500 Original-Received: by mail-ob0-f176.google.com with SMTP id va2so5135634obc.7 for ; Sun, 25 Jan 2015 13:43:53 -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=bypk/LYwkGs+/9HubvdzikmCFE04N4Yw07KjMCQ3J34=; b=jrZUgYVnmml5k3omOyX/3TONBC9KJuk8FrKqsCqbu1OgD2Y7GlQnlIKVfPfgX/OhGh SpcNDgdeiaY5WbGfgK5WFEis9/e4oet2lYwrqBcUkkiPUPm7LeNukRsI9YzZd7XlFkMf 3tGQ8IOw29qv+6dEqeOJYVLLWn2r6cm0jYDeja1fylVmE9f5qAwHmHclSZnYKh8dsExI AIFJbBTF4QKXO0/eCb5BaaqmKHk8ZkyhOkCgdhY0u2oYo/vvi1SwvK/FnDozsXhmwhSB qlIRzD6cRsz+mNPru8XbPcWyvltGKrxWu0TeRq4yOXxChq3wnbm42IKfVILOnZF3gxUv 9G5A== X-Received: by 10.182.27.207 with SMTP id v15mr11112245obg.21.1422222233622; Sun, 25 Jan 2015 13:43:53 -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 d6sm4328940obh.4.2015.01.25.13.43.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Jan 2015 13:43:52 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 In-Reply-To: <874mreh7c5.fsf@wmi.amu.edu.pl> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::230 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:102253 Archived-At: Marcin, Thanks for your quick and friendly response! On 01/25/2015 03:35 PM, Marcin Borkowski wrote: > > 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. Thanks for this suggestion! (For > instance, the early part about problems with C-h and backspace seem to > be irrelevant nowadays.) You know, I wondered about the backspace and C-h too. But then I heard an interview RMS did on some podcast recently and he mentioned some early design differences between Emacs developers on this point. Perhaps intended as a humorous anecdote? ; ) 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. Thanks for this tip. In the first three chapters, I recall seeing a few references that were a bit dated but I just worked around them. But your mentioning this brings to mind the possibility that code provided in the book is so dated that it might explain why it fails to work as I expect. But knowing so little about lisp, It's hard to say. "DePaul Online Teaching Series: Facilitating effective online learning > >> 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. Thanks for the advice about Edebug. It's definitely something that is on my mind. But over the last day or so, I've hesitated from diving into Edebug because there was no "error" as such. That is, the code "worked" it just didn't do what I intended. Wasn't sure Edebug would help in a case like that...but your point is well taken. Thank you! > >> All the best, >> >> Will > > The same to you, >