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: Fri, 25 Aug 2023 09:05:42 +0300 Message-ID: <83v8d3odvt.fsf@gnu.org> References: <87ttsoqfbn.fsf@jeremybryant.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29883"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65511@debbugs.gnu.org, monnier@iro.umontreal.ca To: Jeremy Bryant Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 25 08:06: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 1qZPxa-0007X3-6Z for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 25 Aug 2023 08:06:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZPxH-00070b-FZ; Fri, 25 Aug 2023 02:05:59 -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 1qZPxF-00070O-Ny for bug-gnu-emacs@gnu.org; Fri, 25 Aug 2023 02:05:57 -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 1qZPxF-0006GT-AW for bug-gnu-emacs@gnu.org; Fri, 25 Aug 2023 02:05:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qZPxJ-0002mC-M2 for bug-gnu-emacs@gnu.org; Fri, 25 Aug 2023 02:06: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: Fri, 25 Aug 2023 06:06: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.169294355510660 (code B ref 65511); Fri, 25 Aug 2023 06:06:01 +0000 Original-Received: (at 65511) by debbugs.gnu.org; 25 Aug 2023 06:05:55 +0000 Original-Received: from localhost ([127.0.0.1]:39001 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZPxA-0002lp-BZ for submit@debbugs.gnu.org; Fri, 25 Aug 2023 02:05:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39346) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZPx8-0002lY-Ec for 65511@debbugs.gnu.org; Fri, 25 Aug 2023 02:05:51 -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 1qZPww-0006Eg-2R; Fri, 25 Aug 2023 02:05:39 -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=FZE3W+pLITNs4uBntoPJnR2jhbbxe57YV9bmJzrX38w=; b=fK8SGIU/GsYi MZQOV+CLRDtR2SLvTmZT7AYUP2i+3mFV+5WS4Edb/Klo9NVwRFJHNeoYYSQUQIxtSu4bDUHi34NhE DiKWJ039PEfJPRyw/4RjSVwhMDB7GN8POF//hXCoR3s5lxdfObHHZIux8nGmgGHnXHx7Pv+iTcaaY EgkwbDcsOgP/V9YkAajMYmIPr/7B3FN2yyNn3l/wzgndSci+B/NVgMg8lnUM/ulrPH1DD5SvTa0BF dofaqU96jJe7yYvs78Zml4wVT2gxmHSYQPscd4jtBAqABinJH0CrYWikJxfra53eVtki3NTpxOaVf BsP9c0zdpzb5NsLxd1TSYg==; In-Reply-To: <87ttsoqfbn.fsf@jeremybryant.net> (message from Jeremy Bryant on Thu, 24 Aug 2023 22:46:28 +0100) 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:268389 Archived-At: > From: Jeremy Bryant > Date: Thu, 24 Aug 2023 22:46:28 +0100 > > The command copy-next-command-output copies the output of the next > command, and having used it for several months, I would like to suggest > this for Emacs core. It doesn't appear to be part of Emacs. I > typically bind this C-c u. > > This code was provided by Stefan on this list or emacs-devel, so the > author should be changed accordingly (I haven't modified Stefan's code, > just used it). > > Thoughts welcome as this is my first patch suggestion. It could also be > put in a package in ELPA. I have signed the paperwork. Thanks. On the formal level, this needs a NEWS entry and a suitable change for the user manual. Also, please always accompany changes by a commit log message formatted according to our conventions (see CONTRIBUTE and the examples shown by "git log"). Reading the code, I'm worried by adding/removing hooks without suitable unwind-protect protection: what if some code signals an error or the user hits C-g before this code runs to completion? We need to make sure these hooks are cleaned up properly in those cases. 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? 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? if not, how does this command prevent that? And finally, this feature only works with commands whose output goes to *Messages*, right? If so, there are commands which show messages in other ways, and at the very least the doc string should mention that caveat. Bonus points for adding ways of capturing those other kinds of output as well.