unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Problem with comint-postoutput-scroll-to-bottom
@ 2005-04-16 17:59 Mark H. Weaver
  0 siblings, 0 replies; only message in thread
From: Mark H. Weaver @ 2005-04-16 17:59 UTC (permalink / raw)


I've discovered a problem in comint.el, which results in at least two
user-visible bugs.  Although I have some experience working in Scheme,
I'm very new to hacking elisp, so please excuse me if the terminology
below is incorrect.

The problem is that comint-postoutput-scroll-to-bottom (normally
included in comint-output-filter-functions) makes decisions based on
the location of point, and in some cases moves point.  This logic
assumes that point is where the user thinks point is, i.e. where the
cursor is visible on the screen.

Unfortunately, none of that logic works, because at the time the
comint-output-filter-functions are called from comint-output-filter,
point has been temporarily moved to the process mark.

Furthermore, after the comint-output-filter-functions are called,
comint-output-filter moves point back to the process mark, thus
discarding any movement done by comint-postoutput-scroll-to-bottom.


So far, I've found two user-visible bugs caused by this problem:

* comint-move-point-for-output does not work.  For example, when this
  variable is set to t or 'all, the point should be moved to the end
  when new output arrives.  This doesn't work at all, because it is
  comint-postoutput-scroll-to-bottom which moves point, but
  coming-output-filter immediately discards that change by moving
  point back to the process mark.

* Consider the case when comint-move-point-for-output is nil,
  comint-scroll-show-maximum-output is t, and point is somewhere in
  the middle of the buffer.  In this case, whenever new output
  arrives, (recenter -1) is called, which is most annoying.
  comint-postoutput-scroll-to-bottom tries to prevent this, by
  recentering only if point is at the end of the buffer, but since
  point has been temporarily moved by coming-output-filter, this logic
  doesn't work.


Below is one possible way to fix the user-visible problems, but it may
not be the best fix, and may even break established conventions for
comint-output-filter-functions.  My Emacs knowledge is not sufficient
to confidently propose a proper fix.

     Mark


*** comint.el	15 Apr 2005 21:41:13 -0400	1.315
--- comint.el	16 Apr 2005 13:16:43 -0400	
***************
*** 1701,1708 ****
  	      ;; Interpret any carriage motion characters (newline, backspace)
  	      (comint-carriage-motion comint-last-output-start (point)))
  
  	    (run-hook-with-args 'comint-output-filter-functions string)
! 
  	    (goto-char (process-mark process)) ; in case a filter moved it
  
  	    (unless comint-use-prompt-regexp-instead-of-fields
--- 1701,1709 ----
  	      ;; Interpret any carriage motion characters (newline, backspace)
  	      (comint-carriage-motion comint-last-output-start (point)))
  
+ 	    (goto-char saved-point)
  	    (run-hook-with-args 'comint-output-filter-functions string)
! 	    (set-marker saved-point (point-marker))
  	    (goto-char (process-mark process)) ; in case a filter moved it
  
  	    (unless comint-use-prompt-regexp-instead-of-fields

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-16 17:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-16 17:59 Problem with comint-postoutput-scroll-to-bottom Mark H. Weaver

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).