emacs-devel
[Top][All Lists]
Advanced

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

Problem with comint-postoutput-scroll-to-bottom


From: Mark H. Weaver
Subject: Problem with comint-postoutput-scroll-to-bottom
Date: Sat, 16 Apr 2005 13:59:38 -0400

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




reply via email to

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