From unknown Fri Jun 20 20:06:35 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#42870 <42870@debbugs.gnu.org> To: bug#42870 <42870@debbugs.gnu.org> Subject: Status: [PATCH] Change eshell-output-filter to match the behavior of comint-output-filter Reply-To: bug#42870 <42870@debbugs.gnu.org> Date: Sat, 21 Jun 2025 03:06:35 +0000 retitle 42870 [PATCH] Change eshell-output-filter to match the behavior of = comint-output-filter reassign 42870 emacs submitter 42870 Steven Allen severity 42870 normal tag 42870 fixed patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 15 10:58:00 2020 Received: (at submit) by debbugs.gnu.org; 15 Aug 2020 14:58:00 +0000 Received: from localhost ([127.0.0.1]:56143 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6xdA-000056-Bz for submit@debbugs.gnu.org; Sat, 15 Aug 2020 10:58:00 -0400 Received: from lists.gnu.org ([209.51.188.17]:50346) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6xd7-00004w-Vw for submit@debbugs.gnu.org; Sat, 15 Aug 2020 10:57:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6xd7-0008UL-LK for bug-gnu-emacs@gnu.org; Sat, 15 Aug 2020 10:57:57 -0400 Received: from outgoing-stata.csail.mit.edu ([128.30.2.210]:45175) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6xd1-0005Hj-Vp for bug-gnu-emacs@gnu.org; Sat, 15 Aug 2020 10:57:57 -0400 Received: from c-73-241-148-239.hsd1.ca.comcast.net ([73.241.148.239] helo=localhost) by outgoing-stata.csail.mit.edu with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1k6h7w-000R23-JF for bug-gnu-emacs@gnu.org; Fri, 14 Aug 2020 17:20:40 -0400 From: Steven Allen To: bug-gnu-emacs@gnu.org Subject: [PATCH] Change eshell-output-filter to match the behavior of comint-output-filter Date: Fri, 14 Aug 2020 14:20:38 -0700 Message-Id: <20200814212038.44371-1-steven@stebalien.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=128.30.2.210; envelope-from=steven@stebalien.com; helo=outgoing-stata.csail.mit.edu X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/15 10:19:12 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) This change (a) sets the current buffer to the process-buffer when invoking preoutput filter functions and (b) only invokes them when the process-buffer is live. Otherwise, the preoutput filter functions be invoked in whatever buffer happens to be focused, breaking hooks that read buffer-local variables. * lisp/eshell/esh-mode.el: (eshell-output-filter): Match current-buffer behavior of comint-output-filter. --- lisp/eshell/esh-mode.el | 75 +++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index d0147b345aa..8799007c596 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -690,46 +690,47 @@ eshell-output-filter "Send the output from PROCESS (STRING) to the interactive display. This is done after all necessary filtering has been done." (let ((oprocbuf (if process (process-buffer process) - (current-buffer))) - (inhibit-point-motion-hooks t) - (inhibit-modification-hooks t)) - (let ((functions eshell-preoutput-filter-functions)) - (while (and functions string) - (setq string (funcall (car functions) string)) - (setq functions (cdr functions)))) - (if (and string oprocbuf (buffer-name oprocbuf)) - (let (opoint obeg oend) - (with-current-buffer oprocbuf - (setq opoint (point)) - (setq obeg (point-min)) - (setq oend (point-max)) - (let ((buffer-read-only nil) - (nchars (length string)) - (ostart nil)) - (widen) - (goto-char eshell-last-output-end) - (setq ostart (point)) - (if (<= (point) opoint) - (setq opoint (+ opoint nchars))) - (if (< (point) obeg) - (setq obeg (+ obeg nchars))) - (if (<= (point) oend) - (setq oend (+ oend nchars))) + (current-buffer))) + (inhibit-point-motion-hooks t) + (inhibit-modification-hooks t)) + (when (and string oprocbuf (buffer-name oprocbuf)) + (with-current-buffer oprocbuf + (let ((functions eshell-preoutput-filter-functions)) + (while (and functions string) + (setq string (funcall (car functions) string)) + (setq functions (cdr functions)))) + (when string + (let (opoint obeg oend) + (setq opoint (point)) + (setq obeg (point-min)) + (setq oend (point-max)) + (let ((buffer-read-only nil) + (nchars (length string)) + (ostart nil)) + (widen) + (goto-char eshell-last-output-end) + (setq ostart (point)) + (if (<= (point) opoint) + (setq opoint (+ opoint nchars))) + (if (< (point) obeg) + (setq obeg (+ obeg nchars))) + (if (<= (point) oend) + (setq oend (+ oend nchars))) ;; Let the ansi-color overlay hooks run. (let ((inhibit-modification-hooks nil)) (insert-before-markers string)) - (if (= (window-start) (point)) - (set-window-start (selected-window) - (- (point) nchars))) - (if (= (point) eshell-last-input-end) - (set-marker eshell-last-input-end - (- eshell-last-input-end nchars))) - (set-marker eshell-last-output-start ostart) - (set-marker eshell-last-output-end (point)) - (force-mode-line-update)) - (narrow-to-region obeg oend) - (goto-char opoint) - (eshell-run-output-filters)))))) + (if (= (window-start) (point)) + (set-window-start (selected-window) + (- (point) nchars))) + (if (= (point) eshell-last-input-end) + (set-marker eshell-last-input-end + (- eshell-last-input-end nchars))) + (set-marker eshell-last-output-start ostart) + (set-marker eshell-last-output-end (point)) + (force-mode-line-update)) + (narrow-to-region obeg oend) + (goto-char opoint) + (eshell-run-output-filters))))))) (defun eshell-run-output-filters () "Run the `eshell-output-filter-functions' on the current output." -- 2.28.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 16 08:33:00 2020 Received: (at 42870) by debbugs.gnu.org; 16 Aug 2020 12:33:00 +0000 Received: from localhost ([127.0.0.1]:57023 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k7HqN-0000ti-Qr for submit@debbugs.gnu.org; Sun, 16 Aug 2020 08:33:00 -0400 Received: from quimby.gnus.org ([95.216.78.240]:36016) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k7HqI-0000tL-AW for 42870@debbugs.gnu.org; Sun, 16 Aug 2020 08:32:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=c9xCfWKq/lXXMwCEGyjzZ3jI/DlJoaQDi4wv5xQuj1w=; b=We0atpUXa040qer7CbNNsQRydR C02TCrVCsbF6/Lufa8zq5OykvqmF34P7Ep36uEmPYQCHPi4vPRpEOXkipoAIiueVsdNjr3B/97WCx 9JFvDI8fmjdj6Q++4AMUxUwaNWKBzuhmTLUgfvCA7YZ9bpFiv5sJdsOEFzbgQPFSJhck=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k7Hq3-0000e4-67; Sun, 16 Aug 2020 14:32:48 +0200 From: Lars Ingebrigtsen To: Steven Allen Subject: Re: bug#42870: [PATCH] Change eshell-output-filter to match the behavior of comint-output-filter References: <20200814212038.44371-1-steven@stebalien.com> X-Now-Playing: Kate Bush's _Never For Ever_: "Egypt" Date: Sun, 16 Aug 2020 14:32:38 +0200 In-Reply-To: <20200814212038.44371-1-steven@stebalien.com> (Steven Allen's message of "Fri, 14 Aug 2020 14:20:38 -0700") Message-ID: <87r1s6vkih.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Steven Allen writes: > This change (a) sets the current buffer to the process-buffer when > invoking preoutput filter functions and (b) only invokes them when the > process-buffer is live. Otherwise, the preoutput filter [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 42870 Cc: 42870@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Steven Allen writes: > This change (a) sets the current buffer to the process-buffer when > invoking preoutput filter functions and (b) only invokes them when the > process-buffer is live. Otherwise, the preoutput filter functions be > invoked in whatever buffer happens to be focused, breaking hooks that > read buffer-local variables. > > * lisp/eshell/esh-mode.el: (eshell-output-filter): Match > current-buffer behavior of comint-output-filter. There we a lot of unavoidable whitespace changes in the patch, so but if I read it correctly, this sounds like the correct fix, so I've applied your patch to Emacs 28. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 16 08:33:02 2020 Received: (at control) by debbugs.gnu.org; 16 Aug 2020 12:33:02 +0000 Received: from localhost ([127.0.0.1]:57026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k7HqQ-0000u4-3e for submit@debbugs.gnu.org; Sun, 16 Aug 2020 08:33:02 -0400 Received: from quimby.gnus.org ([95.216.78.240]:36030) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k7HqO-0000tV-IQ for control@debbugs.gnu.org; Sun, 16 Aug 2020 08:33:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=vMYBVzPV2/lQ/UfRGSt1KX6Vft9POjL/WTMF3IHx6Pg=; b=IUUJEUgd2i8uCVzAqPiJsCgxx3 qIY8nr5qkj93kXHmZkzQaQ6r6B2bpwot0TVdrFDnmyrYLFe7x7oecGvc4iop6To1S68ItU8WgRR7V FJ2FrKpQzaifelZ3ku6Eq0GMAYONKjttqZhcTqnAE7Zin+gS8tTPqzF9jUX6Yr3KTWVI=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k7HqG-0000eo-Q6 for control@debbugs.gnu.org; Sun, 16 Aug 2020 14:32:55 +0200 Date: Sun, 16 Aug 2020 14:32:51 +0200 Message-Id: <87pn7qvki4.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #42870 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 42870 fixed close 42870 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 42870 fixed close 42870 28.1 quit From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 16 15:43:39 2020 Received: (at 42870) by debbugs.gnu.org; 16 Aug 2020 19:43:39 +0000 Received: from localhost ([127.0.0.1]:58582 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k7OZ9-0008OQ-JD for submit@debbugs.gnu.org; Sun, 16 Aug 2020 15:43:39 -0400 Received: from outgoing-stata.csail.mit.edu ([128.30.2.210]:42220) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k7OZ5-0008OH-DI for 42870@debbugs.gnu.org; Sun, 16 Aug 2020 15:43:38 -0400 Received: from c-73-241-148-239.hsd1.ca.comcast.net ([73.241.148.239] helo=localhost) by outgoing-stata.csail.mit.edu with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1k7OZ4-000Gbc-Ub for 42870@debbugs.gnu.org; Sun, 16 Aug 2020 15:43:35 -0400 From: Steven Allen To: 42870@debbugs.gnu.org Subject: Re: bug#42870 acknowledged by developer (control message for bug #42870) In-Reply-To: References: <87pn7qvki4.fsf@gnus.org> <20200814212038.44371-1-steven@stebalien.com> Date: Sun, 16 Aug 2020 12:43:33 -0700 Message-ID: <87364midga.fsf@stebalien.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 42870 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Thanks! (FYI, `git show --word-diff` helps quite a bit) From unknown Fri Jun 20 20:06:35 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 14 Sep 2020 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator