emacs-devel
[Top][All Lists]
Advanced

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

scroll-restore.el


From: Richard Stallman
Subject: scroll-restore.el
Date: Thu, 21 Feb 2008 17:29:24 -0500

I think this is trying to implement too many different features, and
we don't want them all.  I would rather implement just the feature of
restoring point after you scroll back to the previous screen, in a
simple way.

In general, it is best to avoid `pre-command-hook' whenever a finer
tool can be used, and likewise `post-command-hook'.

    ;; Note: We can't use `point-before-scroll' for our purposes because
    ;; that variable is buffer-local.

WHY isn't `point-before-scroll' enough?

Would it be enough just for the feature of restoring point?

                                       We need a variable that recorded
    ;; `window-point' before a sequence of scroll operations.  Also
    ;; `point-before-scroll' is not handled by mwheel.el and some other
    ;; commands that do implicit scrolling.

I presume we can fix `point-before-scroll' to DTRT in those cases.  In
general, if a primitive feature isn't suitable for the job it is meant for,
let's make it suitable, rather than do the job in a heavy-handed way.

If we want a few commands to do a certain thing, then it is a bad idea
to use `post-command-hook' to check for them.  Instead we should
change those commands to do it, whatever IT is.  We can add a new
specific hook, and run it from commands and features that scroll.

People often choose `post-command-hook' rather than change C code.
But when we design changes to install in Emacs, we should not design
them based on the premise of "avoid changing the C code."




reply via email to

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