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 22:33:26 +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="17360"; 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 22:46:29 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 1mTs5S-0004Dk-MM for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Sep 2021 22:46:27 +0200 Original-Received: from localhost ([::1]:40342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTs5R-0006uy-DE for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Sep 2021 16:46:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54114) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTrt7-0005k8-Ct for emacs-devel@gnu.org; Fri, 24 Sep 2021 16:33:41 -0400 Original-Received: from mail-db8eur05olkn2068.outbound.protection.outlook.com ([40.92.89.68]:46113 helo=EUR05-DB8-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 1mTrt1-0000S0-1O; Fri, 24 Sep 2021 16:33:38 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I0tVjWvcF6C1LATDV+9dlwGg/C+u7lvj5zbUq1vAm+WVnMOINsJW3JsCGTuaXmOKDEgSii16CxRZeCHgCu+g7FpxdfI+wgz4pXpodhjwLeTIcueBnL5n4phD/qbA81nZh6ZG/AFHRK/j9fGbWi5hKG/rWPf423j5WY6i5zvl3iyAbXRCaymXodzdL+Vu3ZebLvHp5AYhqJtMCZZKOV48o6au0EsxxKOvsz39KJM/oaWt0ZP0jkYk7RDIVMVB8NOUMFGtKwvLx6/XiAGH028LlNNQjNxkN31OwT7aJX+U3m4fv9nyhgtvWoLpQOyLawnAmtUGO4HYRVJxvt5cvXSSsQ== 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=qOtRxTFh/QOt3B3byf5/1nTeGtDkvQ5cNY4nfsKxBiA=; b=VQdReKIdpEJ5ojnluqmCldcDExAgj5w54G8ce5DUNv6NiSqXjfi4gVsouGNuvgH8Si+Q4Qd3n6tPtWpLkInN7qDmieuxFB8Kturl6H9vSV30l/xwNE6sySoM6cGJbdQsw9daLbXJCdEi5LNmi53QVcepEHFH6lWu1ZbcznJ1Tmh9IdDg81WSk74LaloDeyNTlA465HwBkGTt2JWKj1c8K3x247OCoBGdFJb12ZHu1dyV0r4MoS+t5E4LHh/HD+Ee3JNLQuRDm1ISTpJ98gfTtPgTIQHGPuy3v47Jn2PNcmItgsa/0TcSOed2RPKT/SV1h2znu3EVR7a/su8ls11CGw== 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=qOtRxTFh/QOt3B3byf5/1nTeGtDkvQ5cNY4nfsKxBiA=; b=PyNS+SeWhtSV+rF5PWKO//Y+nBXyemvb+TIj2biYPCnE7H1kQYr9LJAIhKwJ/hc1Iwbut0GtO4kbGDYHSfVLNvTqzMm2mpKiTUaqoASXbmMFZdaSC5Z6KgVGHqEwgkpup+IR48BSbfT367Jb5aPotjU3/WI+CoKiY7EmgYWquw04MLDSlpUMLyHg3oRVNaeLJlOeYsihSKCw9MXY2kM8fFNDgCjcvHMYCGuXSsh+VN6hKtI4MUU4KsJtvd07MkIOWV86+x1MqDvmwf42NiPIXkCy9iVS/yUTpIdKFXtjBg7bjUvPE/A7jCxl2Ev5GigDOPyijN7m7M9jZoxbV2BuAw== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM0PR09MB2354.eurprd09.prod.outlook.com (2603:10a6:208:d9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Fri, 24 Sep 2021 20:33:28 +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 20:33:28 +0000 In-Reply-To: <87a6k2nlr6.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 24 Sep 2021 18:31:59 +0300") X-TMN: [mRACxNiYagiY8mrhNxzbcfc+UlmkuNLG] X-ClientProxiedBy: HE1PR1001CA0006.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:3:f7::16) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87h7e9btnt.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by HE1PR1001CA0006.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:3:f7::16) 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 20:33:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9970c5d0-9a05-447c-2a68-08d97f9a9092 X-MS-TrafficTypeDiagnostic: AM0PR09MB2354: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zmqguXOGGpQW79LQ+NLDzEHP/uwEkc7P3lDeTvjvQ+xyeI5cwRpC/9nLtZJlZeCMduygLRrDdPXUrFXpmTwj0mw+NJ2Db1FuIPzcPNHRVHmx+BtDCsAncmgEOJcq+UF1k8eTuzscU3dZJsJAY8GTKI0OleCEMkC6W9zjMajAJvJOT6KxMQ4o83Z76t+Bxjuy6a3ntIMYwsgUCfTakxP4/NWzlrVi7Ym6hFN7QTfRa+txeaPt9da2aKPRm8GMAXwX/a96RRPNdz0N42O3vIKvK/81wPHOkHg4QBG9ffYM/glSgQji40wWrEFYMxtlG1B1nH7/2FwVG8yKlR0MvPSzBlkEakPcS3ok3ZNa9dL0zrs8BczWS0387WtEcpYRmZY4FksjWTiEIl05htUOfn04iyypI1fwMw47UE69pi56p6zDu8SlBQAGPgZHWiUYBVpr X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aiHk8qyFKuvOaUbyOC7yYAwUytDOX133YMFnwpEe7flMntkoVXCgb021gu0rnn37z60G1BRlVcCLJkdXZCm1C62rKnPZYMwJpfM6l+yZMlEJW/i1/sEWXGderaw1EysbVzGFf1KURq6pgAdWBatZQQ== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 9970c5d0-9a05-447c-2a68-08d97f9a9092 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2021 20:33:27.9722 (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: AM0PR09MB2354 Received-SPF: pass client-ip=40.92.89.68; envelope-from=arthur.miller@live.com; helo=EUR05-DB8-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:275430 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. > >> +(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)'. > >> + (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) I tried with next-window, but does it give me current-buffers window when there are no other windows? When there are two windows, it works fine. #+begin_src emacs-lisp (defun remote-control-other-window () (interactive) (let ((buffer (window-buffer (next-window)))) (if (and buffer (get-buffer-window buffer)) (progn (read-key-sequence (format "Run command in %s buffer: " (buffer-name buffer))) (with-current-buffer buffer (call-interactively (key-binding (kbd (edmacro-format-keys (vector last-input-event))))))) (keyboard-quit)))) #+end_src