From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Mark H. Weaver" Newsgroups: gmane.emacs.devel Subject: Problem with comint-postoutput-scroll-to-bottom Date: Sat, 16 Apr 2005 13:59:38 -0400 Message-ID: NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1113674333 8425 80.91.229.2 (16 Apr 2005 17:58:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 16 Apr 2005 17:58:53 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 16 19:58:52 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DMrZ4-0000LF-VY for ged-emacs-devel@m.gmane.org; Sat, 16 Apr 2005 19:58:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DMrco-0006tG-VS for ged-emacs-devel@m.gmane.org; Sat, 16 Apr 2005 14:02:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DMrcg-0006sv-V2 for emacs-devel@gnu.org; Sat, 16 Apr 2005 14:02:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DMrcf-0006sL-64 for emacs-devel@gnu.org; Sat, 16 Apr 2005 14:02:25 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DMrcf-0006rI-2L for emacs-devel@gnu.org; Sat, 16 Apr 2005 14:02:25 -0400 Original-Received: from [66.92.68.221] (helo=world.peace.net) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1DMrbo-0007iH-WE for emacs-devel@gnu.org; Sat, 16 Apr 2005 14:01:33 -0400 Original-Received: from pool-68-163-189-62.bos.east.verizon.net ([68.163.189.62] helo=strings) by world.peace.net with asmtp (Exim 3.35 #1 (Debian)) id 1DMrae-0002k5-00; Sat, 16 Apr 2005 14:00:20 -0400 Original-Received: from mhw by strings with local (Exim 4.50) id 1DMrZy-0003D9-MP; Sat, 16 Apr 2005 13:59:38 -0400 Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:36041 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:36041 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