all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* (Not) scrolling past the end of a buffer
@ 2012-10-19 22:34 Jorgen Schaefer
  2012-10-20  2:07 ` Stefan Monnier
  2012-10-20 16:31 ` Romain Francoise
  0 siblings, 2 replies; 6+ messages in thread
From: Jorgen Schaefer @ 2012-10-19 22:34 UTC (permalink / raw)
  To: emacs-devel

Hello!
There was a discussion back in February about Emacs scrolling past the
end of buffers, but that discussion never finished (as far as I can
tell).

http://lists.gnu.org/archive/html/emacs-devel/2012-02/msg00314.html

Emacs' scrolling behavior allows for a window to move past the end of a
buffer up to the point where the last line of a buffer is the only
thing displayed. This can be useful for editing, but it is unexpected
behavior for modes that interact with other programs.

Based on the behavior of terminals, the expectation and preference
there is that the input line would remain at the bottom edge of a
window as long as there is enough data to be displayed.

There have been a number of hacks to implement this behavior. For
example, `comint-mode' introduced the variable
`comint-scroll-show-maximum-output' to achieve just this effect, but
it's an incomplete solution as manual scrolling or splitting windows
still can cause the prompt to show up in the middle of a window. The IRC
clients ERC and Circe both implement a specific hook to do this. Both
actually used `window-scroll-functions' for this, which worked well but
is problematic because other functions on the hook rely on the view port
not to change during the running of the hook. Hence a warning to that
effect was added to the hook description and ERC was changed to use
`post-command-hook', causing quite a bit of unnecessary computation.
Eshell and rcirc both have copied the comint behavior after originally
following ERC's approach.

And from the thread linked to above, it seems that some users would like
this behavior in editing buffers as well.

Based on the apparent need for such a functionality, I actually looked
at window.c to see if I can figure out how to add it right in the
scrolling code, but my C seems to be too rusty to actually get this
done. Though a buffer-local variable that's checked from the scrolling
code seems to me to be the correct solution for this problem.


So, with `window-scroll-functions' off-limits to this kind of code,
what's the officially recommended approach for modes that want to keep
their input line at the end of a window, and not break because of
splitting a window (or manual recentering, or any manual scrolling,
or ...)?

Regards,
	-- Jorgen



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-10-23 16:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-19 22:34 (Not) scrolling past the end of a buffer Jorgen Schaefer
2012-10-20  2:07 ` Stefan Monnier
2012-10-20  9:52   ` Jorgen Schaefer
2012-10-23 16:25     ` Stefan Monnier
2012-10-20 16:31 ` Romain Francoise
2012-10-20 16:45   ` Jorgen Schaefer

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.