From: Joost Kremers <joost.m.kremers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Advice on troubleshooting function to "unscroll"
Date: 25 Jan 2015 21:35:46 GMT [thread overview]
Message-ID: <slrnmcaodi.bar.joost.m.kremers@j.kremers4.news.arnhem.chello.nl> (raw)
In-Reply-To: mailman.18583.1422219396.1147.help-gnu-emacs@gnu.org
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.
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".
[...]
> 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.
HTH
--
Joost Kremers joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
next parent reply other threads:[~2015-01-25 21:35 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 ` Joost Kremers [this message]
2015-01-25 21:57 ` Advice on troubleshooting function to "unscroll" Will Monroe
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=slrnmcaodi.bar.joost.m.kremers@j.kremers4.news.arnhem.chello.nl \
--to=joost.m.kremers@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.