Stefan Kangas <stefankangas@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 65511) by debbugs.gnu.org; 13 Feb 2025 08:04:03 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 13 03:04:03 2025 Received: from localhost ([127.0.0.1]:40116 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tiUCZ-000107-50 for submit <at> debbugs.gnu.org; Thu, 13 Feb 2025 03:04:03 -0500 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]:59586) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>) id 1tiUCW-0000zS-Kq for 65511 <at> debbugs.gnu.org; Thu, 13 Feb 2025 03:04:01 -0500 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5dec996069aso911410a12.2 for <65511 <at> debbugs.gnu.org>; Thu, 13 Feb 2025 00:04:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739433834; x=1740038634; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=jLWh3Ef4Ms+k87EGuJIRG2B/L8FH3K1qZixa9XB1jNE=; b=j2lbgdCZdW1arDtpNQZl+9frrHroManpusXK7v00oLTrsVhhFQKPpbRb+UxD8hABO8 xTwg2Vl90/laHSZLDeNpIB6dQazgVC/hqLX6OSVgB7K7YpAhqf3x+g7QxJE8SUEAioZ+ GaNf1XRLAG4DfL9vSc64efKa+xXuBQH9ux7FtdtOgGxolQ3SuQskNoa4lQIfmk9ejEqe hSVh591hH+CzS789Lkc4LdXDThmETMQb09px1pUbLfoPHSjlAjEj+UT4/3AW2FPsGPO5 Vu9bcZ8SHozitCSIM/akHsHbSyYzax/9iUjNZ2k1F5/w+SiMqalaNVnSH3t4wzHwoDB4 aKlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739433834; x=1740038634; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jLWh3Ef4Ms+k87EGuJIRG2B/L8FH3K1qZixa9XB1jNE=; b=tATWz5IvouP+0Is8EaDc0AmQjcbwfiM861jGLILZ7Jl5egSavCPREJgG1awRbIWSd1 0hBCCPG4RN1kugj6PMh1Rg02tpTciGRDEycaOwWRTtfmiH3P/y9PjkJYOxgaLl9sSBew muXA2RWh9CtcvLaP3xxn8KtdoRaTBCNFMHLVSKBrxRNKqhM3g1Nwk2b6c/mCxJMDDaEt JJ5gnfbUBqVDjNU9/OAn8Bme9LluAsooRNNkJ+4mFikTbBXyQ/2UJvT8Azx6vo+7rNV0 wyVebDOvNi4CUITnUKv9+oSfdfQD1Q5DWbsZC7KYk8t2RIvFJ4AaIrppGoww4AHE0PNU DF+A== X-Forwarded-Encrypted: i=1; AJvYcCWjrTTIpoh4s6KuSIr4xwSNWKfsnTsyLa8515LGfxJhqDSW4Om3WAaDWL/HPo58BvD1gI564w==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzdEuB3Tw68mxwpufwKKogRbC3dqo/0hTPJyIz/YBGkt/wKpyV6 buML2tLXXrJYaWNeZ2IF1QCnT4HQr26LtGP57F3kZQINU5Uq/xhmqVybaI3MUstcwK6ST5+etR4 LwIRQVAHlfgfAJDNRRwVQ7KctuFY= X-Gm-Gg: ASbGnctIeaSJubRpAjZAaV7TkIg8mXdYm1HfrodufuP3HoneLMCoYknS/kPAM1pAYya 1k/XlP8S5gW9IirpuVcXXH2hjDjdtjQx8F+2BFzlvswcjkW2jYV4UIsDXKH39gxGApAx2bF2NxB w= X-Google-Smtp-Source: AGHT+IF4zR/Liu/iKNBVdofdf8QNeBiFEXbMOhKkyWCIKxQxCXkr6+DDZwLfic/eOaJOn4sfDo9vOJVwyA2Ce8qQAFo= X-Received: by 2002:a05:6402:35c4:b0:5de:39fd:b2f5 with SMTP id 4fb4d7f45d1cf-5deadd7b82bmr4648351a12.1.1739433834377; Thu, 13 Feb 2025 00:03:54 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 13 Feb 2025 00:03:53 -0800 From: Stefan Kangas <stefankangas@HIDDEN> In-Reply-To: <87cyywqxjs.fsf@HIDDEN> References: <87ttsoqfbn.fsf@HIDDEN> <83v8d3odvt.fsf@HIDDEN> <jwvjzt5mxg5.fsf-monnier+emacs@HIDDEN> <83jzt450t3.fsf@HIDDEN> <jwvzg20kbqu.fsf-monnier+emacs@HIDDEN> <87cyywqxjs.fsf@HIDDEN> MIME-Version: 1.0 Date: Thu, 13 Feb 2025 00:03:53 -0800 X-Gm-Features: AWEUYZnkOGFHP2NeKBbOFbSU8Atz2idiR7hOvWRZQ3Ba0smk5q8cMU70DOmWnqo Message-ID: <CADwFkm=xga181aVW65=mQHwyUpn4JGNyv6+5r0q_j__h=G74Gg@HIDDEN> Subject: Re: bug#65511: [PATCH] copy-next-command-output suggestion To: Jeremy Bryant <jb@HIDDEN> Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65511 Cc: Eli Zaretskii <eliz@HIDDEN>, Stefan Monnier <monnier@HIDDEN>, 65511 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Jeremy Bryant <jb@HIDDEN> writes: > Yes, I will work on this. > > Stefan Monnier <monnier@HIDDEN> writes: > >>>> 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. >> >> Jeremy, do you want to take a crack at it? Jeremy, were you able to make any progress here?
bug-gnu-emacs@HIDDEN
:bug#65511
; Package emacs
.
Full text available.Received: (at 65511) by debbugs.gnu.org; 13 Nov 2023 23:02:28 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 13 18:02:28 2023 Received: from localhost ([127.0.0.1]:59488 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r2fwp-0006S1-V4 for submit <at> debbugs.gnu.org; Mon, 13 Nov 2023 18:02:28 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:33664) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1r2fwn-0006Rk-NS for 65511 <at> debbugs.gnu.org; Mon, 13 Nov 2023 18:02:26 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 3A0F5100068; Mon, 13 Nov 2023 18:01:38 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1699916497; bh=4/JwLKYunO4Uh97+XDQOepiwFIkdoaE2fmFMa9TQFhw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=FEb6BtAmCcYUJ6n52LVOCAv6LEuU0l5683uH3Vpi9PuUQzFgXSqJE22EH8uSkPcSJ bBBJeA7xxsnjsoFcx49c5E/eU1i2ftx7M38iaTFZaK1y9fzHkniKpztG1jnKbiT9HT 4+QG5evx0Q4hOA6px2N55V7KSDCfQ2O18f8OV/ghx9J5CHVO5jTt0kA94hhItUQD7p XvZnzRDT5zgE3ZYVbG6+BMcu9VCFX0h2Asm0bw5sXa5L86mIConS6T8trEUOArb0cA IgUDhQUo5cD8oXvjxefdeI9e4SzX72yqadBNBYPByu4vPaikXIY9FrvdCJyevtHEzR 4Cr+w15W0IwQA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 94D5F100033; Mon, 13 Nov 2023 18:01:37 -0500 (EST) Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8740C12040A; Mon, 13 Nov 2023 18:01:37 -0500 (EST) From: Stefan Monnier <monnier@HIDDEN> To: Jeremy Bryant <jb@HIDDEN> Subject: Re: copy-last-command-output Help needed regarding Bug #65511 In-Reply-To: <87r0l2v7os.fsf@HIDDEN> (Jeremy Bryant's message of "Mon, 06 Nov 2023 22:23:39 +0000") Message-ID: <jwvjzql8dts.fsf-monnier+emacs@HIDDEN> References: <87r0l2v7os.fsf@HIDDEN> Date: Mon, 13 Nov 2023 17:59:10 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.164 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain KAM_NUMSUBJECT 0.5 Subject ends in numbers excluding current years T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65511 Cc: 65511 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > I have tried to work on bug #65511 but got confused with markers (even > after reading the manual.) > > This was an attempt to write copy-last-command-output as a symmetrical > version of copy-next-command-output > > The below is my test code but it doesn't work yet. Any hint about what "doesn't work"? > (defun copy-last-command-output () > "Copy last command output." > (interactive) > (with-current-buffer "*Messages*" > ;; TODO: isolate those messages not arising from completion UI What do you mean by this TODO? > (copy-region-as-kill (marker-position output-marker-beg) > (marker-position output-marker-end)) > (message "Output is:")) > ) The `message` call looks odd. Did you mean to add further info after the `:`? > (defun output-marker-pre () > "Hook for pre." > (with-current-buffer "*Messages*" > (let ((buffer-read-only nil)) Better bind `inhibit-read-only` instead of `buffer-read-only`. Also beware that *Messages* may have been killed (it's OK if the command doesn't work in this case, but the pre/post hooks should avoid signaling a never-ending stream of errors). > (defun output-marker-post () > "Hook for post." > (with-current-buffer "*Messages*" > (let ((buffer-read-only nil)) > (setq output-marker-end (point-marker)) > (message "End:%s" (marker-position output-marker-end)) > ;; (insert "post- marker\n") Any reason why you can't just use `point-max` instead of `output-marker-end`? Stefan
bug-gnu-emacs@HIDDEN
:bug#65511
; Package emacs
.
Full text available.Received: (at 65511) by debbugs.gnu.org; 5 Sep 2023 18:34:30 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 05 14:34:30 2023 Received: from localhost ([127.0.0.1]:59164 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qdasg-000368-Ds for submit <at> debbugs.gnu.org; Tue, 05 Sep 2023 14:34:30 -0400 Received: from p3plsmtp15-06-2.prod.phx3.secureserver.net ([173.201.193.44]:41992 helo=p3plwbeout15-06.prod.phx3.secureserver.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <jb@HIDDEN>) id 1qdasa-00035q-Jm for 65511 <at> debbugs.gnu.org; Tue, 05 Sep 2023 14:34:29 -0400 Received: from mailex.mailcore.me ([94.136.40.143]) by :WBEOUT: with ESMTP id dasSq49HaWvQ1dasTqBNxF; Tue, 05 Sep 2023 11:34:18 -0700 X-CMAE-Analysis: v=2.4 cv=WJi64lgR c=1 sm=1 tr=0 ts=64f774aa a=EhJYbXVJKsomWlz4CTV+qA==:117 a=nzDM7VRi/FXkTBRroS9HBg==:17 a=yM0T0u6Ik-0A:10 a=zNV7Rl7Rt7sA:10 a=iRZporoAAAAA:8 a=iwcO_j08PQhEzcRzodEA:9 a=NOBgFS-JBQ2l-kSd6-zu:22 X-SECURESERVER-ACCT: jb@HIDDEN X-SID: dasSq49HaWvQ1 Received: from [152.37.91.204] (helo=hexa3.local.com) by smtp05.mailcore.me with esmtpa (Exim 4.94.2) (envelope-from <jb@HIDDEN>) id 1qdasZ-0001PE-5Y; Tue, 05 Sep 2023 19:34:23 +0100 References: <87ttsoqfbn.fsf@HIDDEN> <83v8d3odvt.fsf@HIDDEN> <jwvjzt5mxg5.fsf-monnier+emacs@HIDDEN> <83jzt450t3.fsf@HIDDEN> <jwvzg20kbqu.fsf-monnier+emacs@HIDDEN> User-agent: mu4e 1.8.13; emacs 29.1 From: Jeremy Bryant <jb@HIDDEN> To: Stefan Monnier <monnier@HIDDEN> Subject: Re: bug#65511: [PATCH] copy-next-command-output suggestion Date: Tue, 05 Sep 2023 19:33:30 +0100 In-reply-to: <jwvzg20kbqu.fsf-monnier+emacs@HIDDEN> Message-ID: <87cyywqxjs.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Mailcore-Auth: 278589627 X-Mailcore-Domain: 1689493 X-123-reg-Authenticated: jb@HIDDEN X-Originating-IP: 152.37.91.204 X-CMAE-Envelope: MS4xfMrXHLBZ+waA13iakCt3BXFFHGu1G3gR4BYm+zTZI6XmP51/ZlYG11qZn75Fz91XM3dtBbnTOauOSRx5H3tr6FRzKByQW0Q65QHF4cVQiG57QGkvxPkC jcWZLfV+lehn314eza1UdFx7VaR7wRKVgHy4qSzQrVXM/xFwg91xuCxNwt8Do2Tz8JhW+Gg53TD1JNzQCrdfWl9T/iOmksiVzWM= X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65511 Cc: Eli Zaretskii <eliz@HIDDEN>, 65511 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Yes, I will work on this. Stefan Monnier <monnier@HIDDEN> writes: >>> 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. > > Jeremy, do you want to take a crack at it? > > > Stefan
bug-gnu-emacs@HIDDEN
:bug#65511
; Package emacs
.
Full text available.Received: (at 65511) by debbugs.gnu.org; 5 Sep 2023 13:10:36 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 05 09:10:36 2023 Received: from localhost ([127.0.0.1]:55017 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qdVpE-0002uI-07 for submit <at> debbugs.gnu.org; Tue, 05 Sep 2023 09:10:36 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:62792) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1qdVpC-0002u0-8k for 65511 <at> debbugs.gnu.org; Tue, 05 Sep 2023 09:10:34 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 7069780642; Tue, 5 Sep 2023 09:10:28 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1693919427; bh=pjVK2Fshv6XzumHN03ON1gw4auHaIKgluAZ2seFrW2M=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=YIVV/r6z+2Bfwq4aP9ySuRyj6E5co22pExn8T/6tY130Li+TDdvuri+5348qkX2v2 S5ax9qlZP1uVnHmxCL8+xmNrz0bBxgf9hykY531aTCADViykX+eJnp8lYYNr/n6kFr BJhGkjXffLovJZBxy/GZmENb9OVNm2R+dg3ZJ8PLqEXPfopIX90KuIpdMpH4ZBhLY6 iFb/4VvAdMhY6v3pCyaY/LgE4ssE4Uz7emEYBZzUEsuJ+JTCVeXFAxO5BbXMRym/s+ paNrOFIIwB4vEUqZNESf2G8nEBiv9Yxx2b9B/rcjPwTQzCQZ20P4r3NrkqL1T5JlqI 3tQxP3C+MBzMg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 36C0C80172; Tue, 5 Sep 2023 09:10:27 -0400 (EDT) Received: from pastel (69-165-136-223.dsl.teksavvy.com [69.165.136.223]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0FA291202C2; Tue, 5 Sep 2023 09:10:27 -0400 (EDT) From: Stefan Monnier <monnier@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#65511: [PATCH] copy-next-command-output suggestion In-Reply-To: <83jzt450t3.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 05 Sep 2023 14:14:48 +0300") Message-ID: <jwvzg20kbqu.fsf-monnier+emacs@HIDDEN> References: <87ttsoqfbn.fsf@HIDDEN> <83v8d3odvt.fsf@HIDDEN> <jwvjzt5mxg5.fsf-monnier+emacs@HIDDEN> <83jzt450t3.fsf@HIDDEN> Date: Tue, 05 Sep 2023 09:10:25 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.033 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65511 Cc: jb@HIDDEN, 65511 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) >> 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. Jeremy, do you want to take a crack at it? Stefan
bug-gnu-emacs@HIDDEN
:bug#65511
; Package emacs
.
Full text available.Received: (at 65511) by debbugs.gnu.org; 5 Sep 2023 11:15:35 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 05 07:15:35 2023 Received: from localhost ([127.0.0.1]:54436 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qdU1v-0000Dy-9M for submit <at> debbugs.gnu.org; Tue, 05 Sep 2023 07:15:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34114) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1qdU1t-0000Dk-A7 for 65511 <at> debbugs.gnu.org; Tue, 05 Sep 2023 07:15:33 -0400 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 <eliz@HIDDEN>) 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==; Date: Tue, 05 Sep 2023 14:14:48 +0300 Message-Id: <83jzt450t3.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Stefan Monnier <monnier@HIDDEN> In-Reply-To: <jwvjzt5mxg5.fsf-monnier+emacs@HIDDEN> (message from Stefan Monnier on Mon, 04 Sep 2023 18:17:44 -0400) Subject: Re: bug#65511: [PATCH] copy-next-command-output suggestion References: <87ttsoqfbn.fsf@HIDDEN> <83v8d3odvt.fsf@HIDDEN> <jwvjzt5mxg5.fsf-monnier+emacs@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65511 Cc: jb@HIDDEN, 65511 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Stefan Monnier <monnier@HIDDEN> > Cc: Jeremy Bryant <jb@HIDDEN>, 65511 <at> 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"
bug-gnu-emacs@HIDDEN
:bug#65511
; Package emacs
.
Full text available.Received: (at 65511) by debbugs.gnu.org; 4 Sep 2023 22:18:01 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 04 18:18:01 2023 Received: from localhost ([127.0.0.1]:52878 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qdHtQ-0004h8-I5 for submit <at> debbugs.gnu.org; Mon, 04 Sep 2023 18:18:01 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:48919) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1qdHtN-0004gu-1E for 65511 <at> debbugs.gnu.org; Mon, 04 Sep 2023 18:17:58 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 888FF10006B; Mon, 4 Sep 2023 18:17:51 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1693865866; bh=+FQpQEkW7489HEz0sUINXaUgZfMxVICVbIc+AVQXHuk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=b6Uzn066CQuW03SEUK2Tpn2Gyl0rV0tH8TWziR/T4krat0pWD0l9oqPk/VH2fUE7s CC0UGRSSOTSDvbqJfScYVnQuU8VxAZUBr2Oyk+dfY+r0CH89TRpj88q40nnh4b7FJ5 FZqgRn1ZbxPiLdtcUD8nSReLMKsaHsr2gXau7n8rY4UJ0OlHpDTB7gOiaPTBz+/6aA xwMxklfbbUUCC0FmDRt/9J/6hrlaI+/jIROH/fSEmGdCc82vKraB0JlJVWlhjf6bwI iQyN9/SAcEdxSEUHgchWzuyv4Dymp/docdrGoDKGqpI+HOcq4t7z8JeWEKEKxI/UvL Mf/L0p5V/j65A== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id F32F4100046; Mon, 4 Sep 2023 18:17:45 -0400 (EDT) Received: from pastel (69-165-136-223.dsl.teksavvy.com [69.165.136.223]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B59231201E6; Mon, 4 Sep 2023 18:17:45 -0400 (EDT) From: Stefan Monnier <monnier@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#65511: [PATCH] copy-next-command-output suggestion In-Reply-To: <83v8d3odvt.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 25 Aug 2023 09:05:42 +0300") Message-ID: <jwvjzt5mxg5.fsf-monnier+emacs@HIDDEN> References: <87ttsoqfbn.fsf@HIDDEN> <83v8d3odvt.fsf@HIDDEN> Date: Mon, 04 Sep 2023 18:17:44 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.117 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65511 Cc: Jeremy Bryant <jb@HIDDEN>, 65511 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > 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. This is a prefix command, like `C-u`, `C-x 8 u`, and a few more: it runs to completion before it does anything useful, since its mode of operation is to arrange for the next command to be run slightly differently. The way it tries to make sure to disable itself "soon" is to use `pre/post-command-hooks` in a way that should hopefully ensure it won't linger longer than desired. It's not as definite as I'd like either, but it's the best way I could come up with so far. I think that if we want to make it better, then we should seriously look at improving our command-loop to provide better built-in support for prefix commands. The patch below includes a longer comment explaining the various possible states,, which should hopefully help convince oneself that it should work acceptably. > 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. > 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. > And finally, this feature only works with commands whose output goes > to *Messages*, right? Yup. > 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. Agreed. 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`. Stefan diff --git a/doc/emacs/screen.texi b/doc/emacs/screen.texi index 5e9e89e6b11..4e65bc1105f 100644 --- a/doc/emacs/screen.texi +++ b/doc/emacs/screen.texi @@ -146,6 +146,11 @@ Echo Area this limit, one line is deleted from the beginning whenever a new message line is added at the end. +@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. + @xref{Display Custom}, for options that control how Emacs uses the echo area. diff --git a/etc/NEWS b/etc/NEWS index fbb13254e64..d5bd372ecfb 100644 --- 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 + --- ** New global minor mode 'kill-ring-deindent-mode'. When enabled, text being saved to the kill ring will be de-indented by diff --git a/lisp/simple.el b/lisp/simple.el index 05a3c4b93d6..2fc1b2dad96 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5877,6 +5877,67 @@ copy-region-as-kill (setq deactivate-mark t) nil) +(defun copy-next-command-output () + "Prefix command to add the output of the next command to the `kill-ring`. +\"Output\" here refers to text emitted in the echo area, and currently this +is limited to those messages which also appear in the *Messages* buffer." + (interactive) + (let ((md (minibuffer-depth)) + (marker (with-current-buffer "*Messages*" + (point-max-marker)))) + ;; We consider the following states: + ;; - The command (and potentially a few other prefix commands) has just + ;; been run, `post-command-hook' is unaffected yet and `pre-command-hook' + ;; and `prefix-command-*' hooks are set. + ;; - The next command is about to be executed: we already run + ;; `pre-command-hook'. All the hooks are set. + ;; - We just finished running the next command: `post-command-hook' + ;; should then hopefully remove all the hooks. + ;; - Within a minibuffer: commands run in the minibuffer should not affects + ;; hooks since they are either "within" another prefix command + ;; (such as `C-x 8 u') or within the command we want to affect. + ;; We do (re)set the `marker', OTOH so as to try and skip the messages + ;; that occur while we're inside the minibuffer. + (cl-labels ((pre () + (unless (> (minibuffer-depth) md) + (add-hook 'post-command-hook #'post) + (prepare))) + (prepare () + (with-current-buffer "*Messages*" + (move-marker marker (point-max)))) + (preserve () + (unless (> (minibuffer-depth) md) + (remove-hook 'post-command-hook #'post) + (add-hook 'pre-command-hook #'pre))) + (echo () + (unless (> (minibuffer-depth) md) + "[copy-output]")) + (post () + (if (> (minibuffer-depth) md) + ;; Prepare, in case there's no pre-command-hook before + ;; the next post-command-hook. E.g. in the case of + ;; execute-extended-command. + (prepare) + (remove-hook 'pre-command-hook #'pre) + (remove-hook 'post-command-hook #'post) + (remove-hook 'prefix-command-preserve-state-hook + #'preserve) + (remove-hook 'prefix-command-echo-keystrokes-functions + #'echo) + (prefix-command-update) + (with-current-buffer (marker-buffer marker) + (when (< marker (point-max)) + (kill-new (buffer-substring marker (point-max))))) + (set-marker marker nil)))) + (add-hook 'prefix-command-preserve-state-hook #'preserve) + (add-hook 'prefix-command-echo-keystrokes-functions #'echo) + ;; (message "BEFORE: prefix-arg=%S current-prefix-arg=%S" + ;; prefix-arg current-prefix-arg) + (prefix-command-preserve-state) + ;; (message "AFTER: prefix-arg=%S current-prefix-arg=%S" + ;; prefix-arg current-prefix-arg) + ))) + (defun kill-ring-save (beg end &optional region) "Save the region as if killed, but don't kill it. In Transient Mark mode, deactivate the mark.
bug-gnu-emacs@HIDDEN
:bug#65511
; Package emacs
.
Full text available.Stefan Kangas <stefankangas@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 65511) by debbugs.gnu.org; 25 Aug 2023 06:05:55 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 25 02:05:55 2023 Received: from localhost ([127.0.0.1]:39001 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qZPxA-0002lp-BZ for submit <at> debbugs.gnu.org; Fri, 25 Aug 2023 02:05:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39346) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1qZPx8-0002lY-Ec for 65511 <at> debbugs.gnu.org; Fri, 25 Aug 2023 02:05:51 -0400 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 <eliz@HIDDEN>) 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==; Date: Fri, 25 Aug 2023 09:05:42 +0300 Message-Id: <83v8d3odvt.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Jeremy Bryant <jb@HIDDEN> In-Reply-To: <87ttsoqfbn.fsf@HIDDEN> (message from Jeremy Bryant on Thu, 24 Aug 2023 22:46:28 +0100) Subject: Re: bug#65511: [PATCH] copy-next-command-output suggestion References: <87ttsoqfbn.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65511 Cc: 65511 <at> debbugs.gnu.org, monnier@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Jeremy Bryant <jb@HIDDEN> > 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.
bug-gnu-emacs@HIDDEN
:bug#65511
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 24 Aug 2023 21:52:02 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 24 17:52:02 2023 Received: from localhost ([127.0.0.1]:38792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qZIFG-0005vt-4I for submit <at> debbugs.gnu.org; Thu, 24 Aug 2023 17:52:02 -0400 Received: from lists.gnu.org ([2001:470:142::17]:49568) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <jb@HIDDEN>) id 1qZIFE-0005vM-HB for submit <at> debbugs.gnu.org; Thu, 24 Aug 2023 17:52:01 -0400 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 <jb@HIDDEN>) id 1qZIF5-0005AK-1F for bug-gnu-emacs@HIDDEN; Thu, 24 Aug 2023 17:51:51 -0400 Received: from p3plsmtp26-03-2.prod.phx3.secureserver.net ([216.69.139.28] helo=p3plwbeout26-03.prod.phx3.secureserver.net) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <jb@HIDDEN>) id 1qZIF2-0001r0-IK for bug-gnu-emacs@HIDDEN; Thu, 24 Aug 2023 17:51:50 -0400 Received: from mailex.mailcore.me ([94.136.40.142]) by :WBEOUT: with ESMTP id ZIEvqU55QxrDfZIEwqBRil; Thu, 24 Aug 2023 14:51:42 -0700 X-CMAE-Analysis: v=2.4 cv=Sawyytdu c=1 sm=1 tr=0 ts=64e7d0ee a=s1hRAmXuQnGNrIj+3lWWVA==:117 a=nzDM7VRi/FXkTBRroS9HBg==:17 a=yM0T0u6Ik-0A:10 a=UttIx32zK-AA:10 a=GDFeYmemqq2GeCUdHdoA:9 a=4ZrrpnpWAAAA:8 a=UMla8V_BtvULFz0MKFEA:9 a=1Cd5MWGGBJJ9eP861nmr:22 X-SECURESERVER-ACCT: jb@HIDDEN X-SID: ZIEvqU55QxrDf Received: from [152.37.91.204] (helo=hexa3.local.com) by smtp13.mailcore.me with esmtpa (Exim 4.94.2) (envelope-from <jb@HIDDEN>) id 1qZIEy-0002zi-GH; Thu, 24 Aug 2023 22:51:44 +0100 User-agent: mu4e 1.8.13; emacs 29.1 From: Jeremy Bryant <jb@HIDDEN> To: bug-gnu-emacs@HIDDEN, Stefan Monnier <monnier@HIDDEN> Subject: [PATCH] copy-next-command-output suggestion Date: Thu, 24 Aug 2023 22:46:28 +0100 Message-ID: <87ttsoqfbn.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Mailcore-Auth: 278589627 X-Mailcore-Domain: 1689493 X-123-reg-Authenticated: jb@HIDDEN X-Originating-IP: 152.37.91.204 X-CMAE-Envelope: MS4xfDLhtM6Ax++75Dh7xSNYGkDlVndqEyYk2cVQ0Md9iHy1nahYKCePuPQmpUkBV/5cQeCeeaDv9tpw0MXhvRvHWtvnzYd9fjcOk2WQXw0HTe5Xx8FQm2lu jdZwxddPjhpu8kVIveaPaEr1PNIE8Sl1lryLfu3TfLPcqo07nKvd4IofigAmjolcMnGO2HPr34dM6rpl1W0xwf1BtYPpsHKmmoc= Received-SPF: pass client-ip=216.69.139.28; envelope-from=jb@HIDDEN; helo=p3plwbeout26-03.prod.phx3.secureserver.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Hello, Emacs maintainers. 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 in advance Jeremy --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-output-of-next-command-to-the-kill-ring.patch Content-Description: patch From 4b797454bbf09556bfb23cbd01cae3e424da29d7 Mon Sep 17 00:00:00 2001 From: Jeremy Bryant <jb@HIDDEN> Date: Thu, 24 Aug 2023 22:42:29 +0100 Subject: [PATCH] Add output of next command to the kill ring --- lisp/misc.el | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/lisp/misc.el b/lisp/misc.el index e8b38fad42e..5bd3c720206 100644 --- a/lisp/misc.el +++ b/lisp/misc.el @@ -327,6 +327,53 @@ list-dynamic-libraries (display-buffer buffer) nil) +(defun copy-next-command-output () + "Prefix command to add the output of the next command to the `kill-ring`." + (interactive) + (let ((md (minibuffer-depth)) + (marker (with-current-buffer "*Messages*" + (point-max-marker)))) + (cl-labels ((pre () + (unless (> (minibuffer-depth) md) + (add-hook 'post-command-hook #'post) + (prepare))) + (prepare () + (with-current-buffer "*Messages*" + (move-marker marker (point-max)))) + (preserve () + (unless (> (minibuffer-depth) md) + (remove-hook 'post-command-hook #'post) + (add-hook 'pre-command-hook #'pre))) + (echo () + (unless (> (minibuffer-depth) md) + "[copy-output]")) + (post () + (if (> (minibuffer-depth) md) + ;; Prepare, in case there's no pre-command-hook before + ;; the next post-command-hook. E.g. in the case of + ;; execute-extended-command. + (prepare) + (remove-hook 'pre-command-hook #'pre) + (remove-hook 'post-command-hook #'post) + (remove-hook 'prefix-command-preserve-state-hook + #'preserve) + (remove-hook 'prefix-command-echo-keystrokes-functions + #'echo) + (prefix-command-update) + (with-current-buffer (marker-buffer marker) + (when (< marker (point-max)) + (kill-new (buffer-substring marker (point-max))))) + (set-marker marker nil)))) + (add-hook 'prefix-command-preserve-state-hook #'preserve) + (add-hook 'prefix-command-echo-keystrokes-functions #'echo) + ;; (message "BEFORE: prefix-arg=%S current-prefix-arg=%S" + ;; prefix-arg current-prefix-arg) + (prefix-command-preserve-state) + ;; (message "AFTER: prefix-arg=%S current-prefix-arg=%S" + ;; prefix-arg current-prefix-arg) + ))) + + (provide 'misc) ;;; misc.el ends here -- 2.40.1 --=-=-=--
Jeremy Bryant <jb@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#65511
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.