From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#65511: [PATCH] copy-next-command-output suggestion Date: Tue, 05 Sep 2023 14:14:48 +0300 Message-ID: <83jzt450t3.fsf@gnu.org> References: <87ttsoqfbn.fsf@jeremybryant.net> <83v8d3odvt.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6745"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jb@jeremybryant.net, 65511@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 05 13:16:13 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 1qdU2X-0001Xj-BM for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 05 Sep 2023 13:16:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qdU2N-0004I0-9v; Tue, 05 Sep 2023 07:16:03 -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 1qdU2L-0004HW-Hv for bug-gnu-emacs@gnu.org; Tue, 05 Sep 2023 07:16:01 -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 1qdU2L-0003zd-9N for bug-gnu-emacs@gnu.org; Tue, 05 Sep 2023 07:16:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qdU2L-0000Ei-LL for bug-gnu-emacs@gnu.org; Tue, 05 Sep 2023 07:16:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Sep 2023 11:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65511 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 65511-submit@debbugs.gnu.org id=B65511.1693912535871 (code B ref 65511); Tue, 05 Sep 2023 11:16:01 +0000 Original-Received: (at 65511) by debbugs.gnu.org; 5 Sep 2023 11:15:35 +0000 Original-Received: from localhost ([127.0.0.1]:54436 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdU1v-0000Dy-9M for submit@debbugs.gnu.org; Tue, 05 Sep 2023 07:15:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34114) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdU1t-0000Dk-A7 for 65511@debbugs.gnu.org; Tue, 05 Sep 2023 07:15:33 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qdU1m-0003pj-77; Tue, 05 Sep 2023 07:15:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=H9ON7nVo5RkWIjsW9TyfbKzL8Tq1iUj1G+Juw2cuzmw=; b=i6bx8n1+XaHs rJsAy+wHlwF5NRTXJa8FDCZg4hviDx+w3H7RlNyyz6pIxW2WtSlsa7fuPbliLzXzcUxBkkoz2WONF GuT32dhZ8CtnBRDVcN2V2begQJb063xKs5kFIzVB6AhKyCRqWL0/qFkSnWsY7KF6k+oOf4D62UAP5 T6nqwfQ4BbbhbNxawXIS1Dfn03y82LDeaVScDRJkUEpdhm7KPDwOsFd1/4bCPrR3lT9EoTydTxxHB 0Y0QTyWcRufdIwz5yyt6JL1PkILpBRHK5l8aa+mOzOGQchbfFdQFM1gJSaThllEHAUY0SxL+QjNyT 3iEOzBpygA+i9o1s5W3axQ==; In-Reply-To: (message from Stefan Monnier on Mon, 04 Sep 2023 18:17:44 -0400) 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:269343 Archived-At: > From: Stefan Monnier > Cc: Jeremy Bryant , 65511@debbugs.gnu.org > Date: Mon, 04 Sep 2023 18:17:44 -0400 > > > I also wonder whether we should bind interprogram-cut-function to nil > > around the call to kill-new, since this stuff probably should be put > > in the clipboard, right? > > I don't understand: binding it to nil would *prevent* it from making it > to the clipboard, whereas I don't see why we shouldn't obey > `select-enable-clipboard` and `select-enable-primary` here. Sorry, I meant to say that this stuff should NOT be put into the clipboard. Which is why I suggested to bind interprogram-cut-function to nil. > > Also, what happens if some process-filter or process-sentinel or timer > > fire during the time these hooks are in effect: will the stuff added > > to the kill-ring include their output as well? > > Yes. > Not sure we should try to do something about it. Maybe just document it? > BTW, the reason why I haven't pushed to include it in Emacs is that I'm > not really satisfied with the UI: in most cases I don't know beforehand > that I want to capture a command's output, so a "postfix command" > (i.e. one we can run after the fact) would be much preferable. > > It might not be that hard to do: tho: just push markers in *Messages* at > the beginning/end of every command (unless there have been no messages > since the last push), make sure we throw away those markers that reach > `point-min`, and then add a `copy-last-command-output` command that uses > those markers to extract the last message using those markers. > The tricky part will be to find the right message when messages are > emitted (e.g. by the completion UI) while the user types > `M-x copy-last-command-output RET`. Maybe we should indeed try to come up with such an alternative implementation. > +@cindex{copy-next-command-output} > + You can also capture the messages of a command by running the > +command @code{copy-next-command-output} beforehand, which will put them > +in the kill ring. That "them" is ambiguous. Better say "those messages" or somesuch. > --- a/etc/NEWS > +++ b/etc/NEWS > @@ -162,6 +162,8 @@ displayed on the mode line when 'appt-display-mode-line' is non-nil. > > * Editing Changes in Emacs 30.1 > > +** New command 'copy-next-command-output' to capture echo area messages ^ Period missing there. > + ;; - Within a minibuffer: commands run in the minibuffer should not affects ^^^^^^^ "affect"