From: Will Monroe <wtmonroe.ls@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Advice on troubleshooting function to "unscroll"
Date: Sun, 25 Jan 2015 15:57:41 -0600 [thread overview]
Message-ID: <54C566D5.60609@gmail.com> (raw)
In-Reply-To: <slrnmcaodi.bar.joost.m.kremers@j.kremers4.news.arnhem.chello.nl>
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 <some-test>)
> ... )
>
> can be written as
>
> (unless <some-test>
> ...)
>
> 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
>
>
next prev parent reply other threads:[~2015-01-25 21:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.18583.1422219396.1147.help-gnu-emacs@gnu.org>
2015-01-25 21:35 ` Advice on troubleshooting function to "unscroll" Joost Kremers
2015-01-25 21:57 ` Will Monroe [this message]
2015-01-25 20:52 Will Monroe
2015-01-25 21:35 ` Marcin Borkowski
2015-01-25 21:43 ` Will Monroe
2015-01-25 21:55 ` Marcin Borkowski
2015-01-25 22:01 ` Will Monroe
2015-01-25 21:45 ` Marcin Borkowski
2015-01-25 22:03 ` Will Monroe
2015-01-25 22:09 ` Marcin Borkowski
2015-01-25 22:45 ` Drew Adams
2015-01-25 22:56 ` Will Monroe
2015-01-25 23:15 ` Marcin Borkowski
2015-01-26 0:03 ` Drew Adams
2015-01-26 0:16 ` Marcin Borkowski
2015-01-26 1:06 ` Drew Adams
2015-01-26 1:17 ` Will Monroe
2015-01-26 1:21 ` Marcin Borkowski
2015-01-26 1:33 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54C566D5.60609@gmail.com \
--to=wtmonroe.ls@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.