From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: bug#36767: 26.1; request: add more quick keys to the *Help* buffer Date: Fri, 24 Sep 2021 21:34:57 +0200 Message-ID: References: <87mtrrq7t7.fsf@gnus.org> <87eed0nsez.fsf@mail.linkov.net> <83bl83zp5h.fsf@gnu.org> <83y27nvnb4.fsf@gnu.org> <83ilyrvgda.fsf@gnu.org> <83h7ebv39d.fsf@gnu.org> <838rznusle.fsf@gnu.org> <87a6k2nlr6.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38224"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Eli Zaretskii , larsi@gnus.org, emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 24 21:36:32 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mTqzl-0009fq-Dt for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Sep 2021 21:36:30 +0200 Original-Received: from localhost ([::1]:39634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTqzk-0005y6-2c for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Sep 2021 15:36:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTqyP-00058b-TB for emacs-devel@gnu.org; Fri, 24 Sep 2021 15:35:06 -0400 Original-Received: from mail-am6eur05olkn2042.outbound.protection.outlook.com ([40.92.91.42]:30080 helo=EUR05-AM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTqyM-0002f4-Qa; Fri, 24 Sep 2021 15:35:05 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MWo5V9QOmpIoJLokDpRX44n54EvEuCbV1+1986oJ3LVuEVxQm59EeZ0B2JqqaLlLDrVPMOtfX0V8hQlf2HcbwGP/Pl+HzJHkg6DIhJqwc/6jNTAyhxw3oBGVL+SBjLiys8nqU2J0LvaaeEcORaHyIvgKyqLsj2fcxJJ4LJBM3wyuuksPjavljZeLruKWgBEbeYfT8VwZ0jwx/8DD2FVwyXJEM9qvMeF5yRCfZUjOI/cdLU63+X/m9rzTdpKmffmzjnGaS2+hl06CsMb6W0UV02Oc0IQiAKp1Dnp+8Z63oDNO4bMzssvaVtedu8XptL3mCcr1TbKbBDlZ7y9K71T2OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=DjRxfHTfUuNFa+GgAyAF8budGcpDuCyZMH8UJrLYY6E=; b=HEAStUZSUYe/+wtkbM+GNt+VCHE7r5lxsSE8ISOy8atyUzCMIQmewnpFoSAlVBRW5eOfr51Ds0aMM3JTYhqa8OHi9ITXHVyQ2depkiRURQH4612EtYobb+hQEW6OVirjuhnOik+uhHJ2DUXP3BXZ+fxsU36qYQcP4iRgA+qfHJDf0sMlozQ/NgjgIHYX4ln1C9o86NqMk0c+lvwdYVxVa7C7KCm9iFKZgU2/XqL7k78bPNKMElaCMoaW7SW7Q0S5dx2ZzqWnmDyT2qQZkNS3Lmtm5wqHT2r8YQb0edU6iKkuXMhS1ofzmMFPx00R5R0wPyVt8D5xVJAXqx8BZUfEOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DjRxfHTfUuNFa+GgAyAF8budGcpDuCyZMH8UJrLYY6E=; b=JJ5sfnce1HPP+SjkNrHFV7Dar2WfTSs/zVcuknCcPZXBXUpS2yy7gn6jgNEIPZu8HLZG4nxmhG4mGAOIiKAVagVLQxy+pWogjdoPOpE/KB5+kHV33Cs3G1xDqO3ptmrJ1vISbNMDiKo/Nfx9PeIsJ+Wrh3gtNbQjjfe9c58Jg9vFNCl6fcKEwuX4cLO6vA5emBiJ75MMYdOSCWk8vb5aVKqTEwEVfgFnrdq/L3qP8JCLJgC1U8JCQ1EUiDM2RtiyhnNcQyB+nnf91aZuCcWBcVcZrYdLTPMbjV/VLeIQD7N1xcB3AS6RjaWqP2kIvumbSmcZ2xyUhowpXUB7W9bACw== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM0PR09MB3891.eurprd09.prod.outlook.com (2603:10a6:208:19c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.15; Fri, 24 Sep 2021 19:34:58 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc%9]) with mapi id 15.20.4544.018; Fri, 24 Sep 2021 19:34:58 +0000 In-Reply-To: <87a6k2nlr6.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 24 Sep 2021 18:31:59 +0300") X-TMN: [1T6k3mU41DhAMxEK/9EO7/NwCQsTVlu4] X-ClientProxiedBy: HE1PR0901CA0057.eurprd09.prod.outlook.com (2603:10a6:3:45::25) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87bl4hdaxq.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by HE1PR0901CA0057.eurprd09.prod.outlook.com (2603:10a6:3:45::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Fri, 24 Sep 2021 19:34:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ca67b11f-86b5-4528-535c-08d97f9264bf X-MS-TrafficTypeDiagnostic: AM0PR09MB3891: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y7neDP+quc7+NA9+4VmrwrTieGN9H4xRF+37t4+7bCO+G/9wyo0tfZndfSk+AciZp5EnuHpX7O54jifNcfpbfaik7JH0ugCVzA5jxvJYa8lWf2v3QncY33dpMq1eTNrTJuGy5GnDLXgCM5QuoUwDpv4+0x9fNh4QRDH4z2gRBYehg8bPxGOahE2ZTC22d4GSp4jzGkJFVOkpmMr/RdGtLhd8zyWWukgW3fm34gzcd4WRIT83qVMrljlV5T6QZwEFafS3AI+yFr4YQS3wDyg9sNZeAWDlkjF39S3PhvWWBxGnb7H5QPR+XAaDc7M/az4iPG+fT+FI/yfPV66vxWMqLZ2se/8zBpB0/4TzuFzxrVVEcVomWHDqLshp3PYDNqtv+m1SzZk+g9ftcQ603/yHdVjpZywguH+jVUjDxoiLBWsyyZ83JrRg5PNel0Pvndhf X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Gbrk871f2k2tJqdzzH9y7DhpJkXeyZRbxJ3LMv+3ncYMhgP1tdSvdfs5RYant0GsMduKDbX/ebBcBHKRKIIkcFMUvb64AQuCM0eqyj5cxdH5J62llVP/wHFGmJ3/JFkDdoUst9rU7vzaJbfzn9Rwyg== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: ca67b11f-86b5-4528-535c-08d97f9264bf X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2021 19:34:58.4756 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR09MB3891 Received-SPF: pass client-ip=40.92.91.42; envelope-from=arthur.miller@live.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:275422 Archived-At: Juri Linkov writes: >> I came up with another idea last night and sent a patch, but I am not sure if it >> got to right place, I don't see it myself. It was an answer longer in the thread >> to Lars. >> >> This one makes it possible to run any command in *Help* buffer, not just those >> defined in help-mode.el, and those not need any patching or wrapping of existing >> commands. >> >> I don't know if it is correct place to put define-key for the global map, and I >> am not sure if C-h M-h is the right, but that's just a detail. > > This would be a nice command. But why it's limited only to help-window? > It could allow reading and running the key sequences in any next-window. Yeah, sure, you could have it for next, previous or one found via compleating-read, ot any buffer you can make current. This was meant as a quick fix to control help buffer so we don't need to switch back and forth. >> +(defun help-do-command () >> + "Run a key-sequence in \"*Help*\" buffer from other buffers. >> + >> +If *Help* buffer is not visible, the HELP-DO-COMMAND will be aborterd." >> + (interactive) >> + (if (get-buffer-window (help-buffer)) > > I meant to replace '(get-buffer-window (help-buffer))' with '(next-window)'. Next-window could be anything, it could be just as annoying as switching forth-and back, so I think it is better to have a specialized function that works only on this buffer. > >> + (let ((__key (read-key-sequence "Run command in *Help* buffer: "))) >> + (with-current-buffer (help-buffer) >> + (call-interactively >> + (key-binding >> + (kbd (edmacro-format-keys (vector last-input-event))))))) >> + (call-interactively (global-key-binding "\C-g")))) >> + >> +(define-key global-map (kbd "C-h M-h") 'help-do-command) This was a quick fix, I just came up with that idea based on what I suggested earlier, but sure it can be generalized. I think personally it is better that every mode exports a named function, like foo-do-command or something, but one where user chooses a buffer and one 'dwim' style one there are only two buffers would be good to have too. By the way, this let statement is unnecessary too, it is a leftover from refactoring.