NOTE: This package is obsolete as of v24. Use the built-in option
Emacs conveniently allows one to work on different parts of the same buffer
at the same time, but the rules governing buffer display are, for some
people's editing habits, less than ideal. Suppose for example that one is
editing two parts of buffer buf in windows win-1 and
win-2, switches briefly to another buffer in win-2, then
returns to editing buf in win-2. This latter window will now
display the same part of buf as win-1, rather than the portion
that one was just recently editing in it. The package
creates persistent values of
window-start, so that in
cases like that just described win-2 will return to its previous
position in buf.
In some cases, as when another Lisp program wants to move point in a buffer
and then display that buffer in a window, it makes sense for Per-Window-Point
not to position point in that window. (For example, when looking up a
function definition via
describe-function, point is moved to the function
definition before the library that defines the function is displayed; we then
don't want to move point away from the definition when the library is
displayed.) The package is reasonably intelligent in identifying situations
in which it should defer to other Lisp programs. It also provides several
hooks so that the user can define other types of exception.
Installation and Usage
To install, place the package file in your load path and put
(require 'per-window-point) in your .emacs. To toggle Per-Window-Point on and off, use the command
Three variables provide control over whether pwp-mode should reposition a buffer that has been displayed before in a window:
pwp-no-reposition-names: If a buffer name is an element of this list, then Per-Window-Point will not position it. The default value is nil.
pwp-no-reposition-regexps: If a buffer name matches one of the regular expressions in this list, Per-Window-Point will not position it. The default value is
pwp-reposition-tests: A list of functions. When a buffer is displayed in a window, Per-Window-Point calls each function in this list with two arguments, the buffer and the window in question. If any function returns nil, Per-Window-Point does not reposition. The default value is nil.
A Note on v24
The buffer display routines were substantially rewritten for v24, and this package hasn't been fully tested with with that version.