[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Advice on troubleshooting function to "unscroll"

From: Marcin Borkowski
Subject: Re: Advice on troubleshooting function to "unscroll"
Date: Sun, 25 Jan 2015 22:35:28 +0100

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
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

reply via email to

[Prev in Thread] Current Thread [Next in Thread]