From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jonathan via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#69914: comint-strip-ctrl-m doesn't function as documentation states Date: Sun, 03 Nov 2024 02:54:14 +0000 Message-ID: References: <86il1dz9pz.fsf@gnu.org> <865xwu50l0.fsf@gnu.org> <86a5lrf3j5.fsf@gnu.org> Reply-To: Jonathan Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3084"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69914@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 03 03:55:23 2024 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 1t7Qlu-0000cv-R4 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 03 Nov 2024 03:55:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t7Qle-0002kU-DG; Sat, 02 Nov 2024 22:55:07 -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 1t7Qlb-0002iU-Pc for bug-gnu-emacs@gnu.org; Sat, 02 Nov 2024 22:55:04 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t7Qlb-00062H-Ez for bug-gnu-emacs@gnu.org; Sat, 02 Nov 2024 22:55:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:From:Date:To:Subject; bh=+iMzmxbY2zqJjAMBc4F7w1LiVoN4XDJPj8VP7z92tRg=; b=H86p2Gm7xEr3pfhtN6BgWwJWdZ6GNizVUlXK/8rET7pbEAm29BKhGH3F7crtFFNbrp7SzKfErSnX9c2XTb3yiHOe+odDDyiQ46ylXIiV7QoQX8Cb/XvrPYy8sPuDUKVvpHJqMCio7NIBh6IsenuDCk4sm5YRb6WMadhhX5DtV9OdqRY23rxFcrDjM18QLNo3vkZQaio2CbpR50F313/x0tvzWX4ln2wpIUlJSvllX3BukktYokBw7i38YoHd+SqezAK2Ip9jzASu3IY3Ku1XCZ5I6gy65bEHAC/VfJr+jIGZMhxPjv5cAK53T78ItOi8ASRe8NVKLA8cVYm7738nNg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t7Qla-00038e-9k for bug-gnu-emacs@gnu.org; Sat, 02 Nov 2024 22:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jonathan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 Nov 2024 02:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69914 X-GNU-PR-Package: emacs Original-Received: via spool by 69914-submit@debbugs.gnu.org id=B69914.173060247012044 (code B ref 69914); Sun, 03 Nov 2024 02:55:02 +0000 Original-Received: (at 69914) by debbugs.gnu.org; 3 Nov 2024 02:54:30 +0000 Original-Received: from localhost ([127.0.0.1]:57267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t7Ql3-00038B-N3 for submit@debbugs.gnu.org; Sat, 02 Nov 2024 22:54:30 -0400 Original-Received: from mail-4317.proton.ch ([185.70.43.17]:59245) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t7Qkz-000380-7J for 69914@debbugs.gnu.org; Sat, 02 Nov 2024 22:54:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jds.work; s=protonmail2; t=1730602458; x=1730861658; bh=+iMzmxbY2zqJjAMBc4F7w1LiVoN4XDJPj8VP7z92tRg=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=O2h24BXqTBJ1139O0MqSRXa7/gjYc+Wd5s80kDGJh95aj18Gw0Fzz0KHYUol2YEAq fSxa/uCnDTdb3dVGaIuDM5jacLVg5/wLXyyEAJTAqT2JHW/8baZS2/7V2bI5kNHvod pmHBtf6btxqFWXnA5gwb9uPR+3PSHTvY1lG492X7WpJgUPl4ZJecw92idNE5PWfiY+ qJcCA1cIXc1DgEgTW3XWZtHe9jjlaHgds7KZCKtlgh9/ZUTvKWwLdSJUUCfK9L8zYv sDvsNy5dt3ULeBp0L9G0In1Fm5qcW2OERuEplxQlA7tCQPZLJgpxv2If7056RvWpqP /jpjBvSkNFqMA== In-Reply-To: <86a5lrf3j5.fsf@gnu.org> Feedback-ID: 104505699:user:proton X-Pm-Message-ID: e5f2ccd72eb48ec925d70096b438b8565caa53ce 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:294779 Archived-At: My apologies. This completely dropped off my radar as a few life events too= k precedence over the past few months and took me away from this. Things ar= e more settled now though. I do agree this appears to be a common trend among the comint filter functi= ons. I will get together a patch including a new version of =3Dcomint-strip= -ctrl-m=3D named something different of course, and updating the documentat= ion that I can track down. I do just anticipate this to take a little time as this would be my first c= ontribution to the project and I'm still learning my way around. If all thi= s is amenable to you I'll move forward with my solution and get a patch sen= t in soon.=20 On Thursday, April 18th, 2024 at 4:01 AM, Eli Zaretskii wrot= e: >=20 >=20 > Ping! Ping! Any interest in pursuing this issue further? If so, > could you please answer my questions below? >=20 > > Cc: 69914@debbugs.gnu.org > > Date: Sat, 06 Apr 2024 11:58:51 +0300 > > From: Eli Zaretskii eliz@gnu.org > >=20 > > Ping! Could you please answer my questions below? > >=20 > > > Cc: 69914@debbugs.gnu.org > > > Date: Sat, 23 Mar 2024 09:30:16 +0200 > > > From: Eli Zaretskii eliz@gnu.org > > >=20 > > > > Date: Wed, 20 Mar 2024 14:15:39 +0000 > > > > From: Jonathan via "Bug reports for GNU Emacs, > > > > the Swiss army knife of text editors" bug-gnu-emacs@gnu.org > > > >=20 > > > > There appears to either be a bug or just inaccurate documentation o= f =3Dcomint-strip-ctrl-m=3D. At the very bottom, I've included some context= about my use case by which I discovered this bug that may or may not be re= levant to you. The documentation for that function states: > > > >=20 > > > > #+begin_quote > > > > Strip trailing ^M characters from the current output group. > > > >=20 > > > > This function could be on comint-output-filter-functions or bound t= o a key. > > > > #+end_quote > > > >=20 > > > > =3Dcomint-output-filter-functions=3D states the following: > > > >=20 > > > > #+begin_quote > > > > ...These functions get one argument, a string containing the text a= s originally > > > > inserted. Note that this might not be the same as the buffer conten= ts between > > > > comint-last-output-start and the buffer's process-mark, if other fi= lter > > > > functions have already modified the buffer. > > > > #+end_quote > > > >=20 > > > > Looking at the implementation of =3Dcomint-strip-ctrl-m=3D it appea= rs that it completely ignores the =3Dstring=3D argument and instead uses = =3D(get-buffer-process (current-buffer))=3D in direct contradiction to the = documentation. > > >=20 > > > Actually, AFAICT, almost all of the filtering functions intended for > > > comint-output-filter-functions ignore its string argument. Isn't that > > > so? > > >=20 > > > > #+begin_src emacs-lisp > > > > (defun comint-strip-ctrl-m (&optional _string interactive) > > > > "Strip trailing `^M' characters from the current output group. This= function could be on` comint-output-filter-functions' or bound to a key." > > > > (interactive (list nil t)) > > > > (let ((process (get-buffer-process (current-buffer)))) > > > > (if (not process) > > > > ;; This function may be used in > > > > ;; `comint-output-filter-functions', and in that case, if > > > > ;; there's no process, then we should do nothing. If > > > > ;; interactive, report an error. > > > > (when interactive > > > > (error "No process in the current buffer")) > > > > ;;; rest omitted for brevity > > > > ))) > > > > #+end_src > > > >=20 > > > > This represents unexpected and undocumented behavior, as you antici= pate =3Dcomint-strip-ctrl-m=3D to behave like any other comint output filte= r functions. I'd like to propose 3 different possible solutions for a patch= and would like input on which is preferred as this code was originally int= roduced in 1994. I can submit a patch once a solution has been determined. > > >=20 > > > Given that almost all the filter functions behave the same (unless yo= u > > > disagree), it sounds like ignoring the string is a de-facto standard > > > behavior. So we should document that, and I guess adding a new > > > function, without deprecating the existing one, is the most reasonabl= e > > > way ahead?