From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Rah Guzar via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61602: [PATCH]: comint-mode redirection Date: Thu, 11 May 2023 19:45:09 +0200 Message-ID: <87pm763gfy.fsf@zohomail.eu> References: <873573ryft.fsf@zohomail.eu> Reply-To: Rah Guzar Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12860"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.10.3; emacs 29.0.90 To: 61602@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 11 19:52:18 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pxASf-00037u-Sv for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 May 2023 19:52:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pxAST-0002td-6o; Thu, 11 May 2023 13:52:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pxASR-0002t2-12 for bug-gnu-emacs@gnu.org; Thu, 11 May 2023 13:52:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pxASQ-00040J-OZ for bug-gnu-emacs@gnu.org; Thu, 11 May 2023 13:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pxASQ-00006K-E8 for bug-gnu-emacs@gnu.org; Thu, 11 May 2023 13:52:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <873573ryft.fsf@zohomail.eu> Resent-From: Rah Guzar Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 May 2023 17:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61602 X-GNU-PR-Package: emacs Original-Received: via spool by 61602-submit@debbugs.gnu.org id=B61602.168382747532689 (code B ref 61602); Thu, 11 May 2023 17:52:02 +0000 Original-Received: (at 61602) by debbugs.gnu.org; 11 May 2023 17:51:15 +0000 Original-Received: from localhost ([127.0.0.1]:53304 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxARb-0008Ul-Op for submit@debbugs.gnu.org; Thu, 11 May 2023 13:51:15 -0400 Original-Received: from sender11-pp-o91.zoho.eu ([31.186.226.249]:25194) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxARV-0008Tp-Ek for 61602@debbugs.gnu.org; Thu, 11 May 2023 13:51:10 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1683827462; cv=none; d=zohomail.eu; s=zohoarc; b=TMPrF3g318lz7nxBD9+Bfae7f0uphWbFPXbbNxeSPH9xwm75uNVHd2Fybwl6qVPrr1SUb4RWlNV2WSX61hqfUVr0kclN+4MabG3kmbtALa8VtbFQtA1iSNP+3AYQO8uC1K9iJmjb5wFxKyDwgOpDx/fHoO9qJ+Zg3LXu4quMwM0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1683827462; h=Content-Type:Date:From:MIME-Version:Message-ID:Subject:To; bh=rbKnMRv7GHMsDmLtyBfMQXFJiqN+/uge4afIY12WaM4=; b=lTgYJQPf3pfkoMzk8eIPe519/PnYGYxJFocuU02rzZs5LJuTF8vjGLH8VZmK5ee5+Gks52hNHngXmX4DJEwZMNdjAjzgEUiNumP4dFotXThpRoZL9U7Z4VBgEcRHlGhpVnQGVVm5+KUiH0G6XWW3bNKhuYyX/X4/HFtvPAXa2JA= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=zohomail.eu; spf=pass smtp.mailfrom=rahguzar@zohomail.eu; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1683827462; s=zoho; d=zohomail.eu; i=rahguzar@zohomail.eu; h=From:From:To:To:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Type:Message-Id:Reply-To:Cc; bh=rbKnMRv7GHMsDmLtyBfMQXFJiqN+/uge4afIY12WaM4=; b=pjnv5fy8lSg0af+2txenQCIbnhKGHnXKU23sJ2fizXb5oQma6GdKz4sTEouZzZMJ qhp/ay4biutwqhFki3ndrps5eZnN5qLRad9VQqrFjr6IkwT3Rs3BdqFZkRblQ1DFTnV 3EkHpNDkGY4SNBbTU8N3QjRhB7/2mc61XLXi71B0= Original-Received: from localhost (81-231-79-170-no600.tbcn.telia.com [81.231.79.170]) by mx.zoho.eu with SMTPS id 1683827459756253.98424089008245; Thu, 11 May 2023 19:50:59 +0200 (CEST) X-Zoho-Virus-Status: 1 X-ZohoMailClient: External X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261585 Archived-At: --=-=-= Content-Type: text/plain Dear Emacs Maintainers, A while back I sent a patch that addresses the points in this bug report. I have since received the confirmation that I have completed the copyright paperwork, so I am bringing it to your attention again. This is my first time contributing so please let me know if I should do somethings differently or if changes are needed. Thanks, Rah Guzar --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=comint-redirect.patch diff --git a/lisp/comint.el b/lisp/comint.el index 682b555a33c..98f4d315d64 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -161,7 +161,10 @@ comint-prompt-regexp Defaults to \"^\", the null string at BOL. This variable is only used if the variable -`comint-use-prompt-regexp' is non-nil. +`comint-use-prompt-regexp' is non-nil. The exception to +this is redirection. Many commands including +`comint-redirect-send-command-to-process' use it as +`comint-redirect-finished-regexp'. Good choices: Canonical Lisp: \"^[^> \\n]*>+:? *\" (Lucid, franz, kcl, T, cscheme, oaklisp) @@ -3637,7 +3640,12 @@ comint-redirect-output-buffer (defvar comint-redirect-finished-regexp nil "Regular expression that determines when to stop redirection in Comint. When the redirection filter function is given output that matches this regexp, -the output is inserted as usual, and redirection is completed.") +the output is inserted as usual, and redirection is completed. +This is an internal variable set by `comint-redirect-setup' and setting it +directly has no effect.") + +(defvar comint-redirect-hook nil + "Hook run when a redirection finishes.") (defvar comint-redirect-insert-matching-regexp nil "If non-nil, the text that ends a redirection is included in it. @@ -3833,11 +3841,13 @@ comint-redirect-send-command ;;;###autoload (defun comint-redirect-send-command-to-process - (command output-buffer process echo &optional no-display) + (command output-buffer process echo &optional no-display finished-regexp) "Send COMMAND to PROCESS, with output to OUTPUT-BUFFER. With prefix arg, echo output in process buffer. -If NO-DISPLAY is non-nil, do not show the output buffer." +If NO-DISPLAY is non-nil, do not show the output buffer. +If FINISHED-REGEXP is non-nil it is used as `comint-redirect-finished-regexp' +instead of `comint-prompt-regexp'." (interactive "sCommand: \nBOutput Buffer: \nbProcess Buffer: \nP") (let* (;; The process buffer (process-buffer (if (processp process) @@ -3858,7 +3868,7 @@ comint-redirect-send-command-to-process (comint-redirect-setup output-buffer (current-buffer) ; Comint Buffer - comint-prompt-regexp ; Finished Regexp + (or finished-regexp comint-prompt-regexp) ; Finished Regexp echo) ; Echo input ;; Set the filter. --=-=-=--