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:20:52 +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="19538"; 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:22:20 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 1mTri7-0004wR-9B for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Sep 2021 22:22:20 +0200 Original-Received: from localhost ([::1]:48918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTri5-0000fP-QS for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Sep 2021 16:22:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTrgq-0008Hw-41 for emacs-devel@gnu.org; Fri, 24 Sep 2021 16:21:00 -0400 Original-Received: from mail-oln040092068044.outbound.protection.outlook.com ([40.92.68.44]:24736 helo=EUR02-HE1-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 1mTrgm-0000PA-Uj; Fri, 24 Sep 2021 16:20:59 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RH/kLYZ8uJ8B7yma0f0U+47o4vz1veEnGrFozpK8ylHB3uc8HU6zdQER+MTahmMeH0WLGOr53uf7PPZU3kMgggofkhRon5qucKbRJh/FciV+wYF+DyuAOrAm3K8LKogGtn13fSJoo+MN1OQGaljFDrJ5aHCWX1foiFMakRPf2kNdsJeNmPmYerCUqpuHtGnUwOiWVKrpmzZEghDLNu6aQh+fw+UBjq8PeuC9SwukODgkMCtqCsw+RZKNJ6ykk1HAtpnNxYgqQfD2nUUpJ2Go93LqOnC18pqC2QFalMw9Yldv9Mv2DjE6nR7RKzGHaDyubkNsFdvTUBQYwnjyt7WiRQ== 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=QhiQFbE/JfkSCIYeQ9UKcLMysvxWm0pVZuV9alh222s=; b=II72uDP4kfj0D9lgaSVQDnXcswaFOetBO/tjPZhN3E6SHGV60uyb/4WpAKIfISPPB9xlfF13VMh2q+k4gYVH3x8cF6RmXnDhPtQ9IdaD/sX2jXio+d7rmBGh5WF+/d17ZS3IlzpQZwL3WNbkTGfe60e58Z0zFIOE9IOSnyZy4S9oKFu2uYZSjMO0F/yRPBnJq8b0+0pFaCZ8JHGbe4D9ZlVVTi9P4mrN+juZwiH8P8Dq6BM3WiQnWlf8F4uQgL7vmXTpkqpAqzWnnQy9szJlZlVG1EfhG6EInTCVs0TDwgXXD/7UAYpyft94K3hffXBj7PD2KscdiGMFTWPN6y63Mw== 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=QhiQFbE/JfkSCIYeQ9UKcLMysvxWm0pVZuV9alh222s=; b=lhw6UqlhwEQtULFbwYSEdTx6mFxRV0VvXD4C8Z6xql9Elq+dR0j/7iGKYX84MApWziZaJQGF2iEgXc2ppXaBQ4hyIs7E8DK6NlPt2BfQKNC3Uxn4iS4fzjqpAUBRkliwhBD0vwGxkGpKCLVhs+DTnhaXBWa9xf0RLxxVhBShtENuYXNN8uytQBEmzyYpovlJOHCO0XHZ7l52x6AfeiLXwKWBpsiT19/iFAIaVvrXwnJ2Al1TnuYsjWTAjlxnja+PeLKChqZOaqWQw1K+GdB5X8zp5IIN/VITRGLtFFbmRNhpulTRe+qBEC3Sn/jJEm2x4orGBzCO4B1dxTDVqTz8qw== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM0PR09MB4466.eurprd09.prod.outlook.com (2603:10a6:20b:160::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Fri, 24 Sep 2021 20:20:53 +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:20:53 +0000 In-Reply-To: <87a6k2nlr6.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 24 Sep 2021 18:31:59 +0300") X-TMN: [bqHO3m4jAUESbWCTJ91RpvZyiQt4utns] X-ClientProxiedBy: AM6P191CA0040.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::17) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87o88hbu8r.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AM6P191CA0040.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14 via Frontend Transport; Fri, 24 Sep 2021 20:20:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ab792bf5-6cf1-4f87-5348-08d97f98ceb9 X-MS-TrafficTypeDiagnostic: AM0PR09MB4466: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 56Ri1pQ2qQ8JTJKkIeRpjB79dLds4E+hQaAtGrujgJuhLZ3dhYjbDMRuyRsMh0UlVH/PqdDCM3WB4Hm3XmTUEf6+qLc7g5dEd6WVM2BxapAwg+J/vmkjz8N5bY1Qmr+AYwc+JkeY5hv/lzc4R8am+FfwU1RBMm0DyEAR6yFx8ITGopOsuqi/wovpedCCNgVHqrXx4g0hYdQS22DfvFWlbV/+1IboesDVohE528F4Nq5xlG87mrcaEE55Q4MFK7ZRb8xF7lRv6DLMZewMtB30hGCv2aWGK94k2OTolyMSnXm1nUCqubRVKydBti1RHURqGtDbUniGG+KA5bnkcoX31gjYGTjySq+FZr36Y/3sjvdH+vsgnedARg+FegLE1LpGvG3QT35FOIBDcMo0mEXJt8IpFXTDM8oJQe9M+QV+KxCMkKSxeEcnLXOBFZuO9Zlh X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rg6DJ0WbxmLAE5meSJ2fTKRuYWooD5sUqrWi5khfqBQKVS1k+0KoIT4u4K/aPsiP2Tew6W5j7DsG6/s7pB2ciNyHrTdvxltUaXKfEtlEQQPnzw4BAyYr8MEkY0riaZJPid8A6hP730mISdKGrw6SRQ== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: ab792bf5-6cf1-4f87-5348-08d97f98ceb9 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:20:53.3378 (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: AM0PR09MB4466 Received-SPF: pass client-ip=40.92.68.44; envelope-from=arthur.miller@live.com; helo=EUR02-HE1-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:275427 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) What I meant in last mail was something like this: #+begin_src emacs-lisp (defun remote-control (buffer-or-buffer-name) (let ((buffer (if (stringp buffer-or-buffer-name) (get-buffer buffer-or-buffer-name)))) (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)))) (defun help-remote-me () (interactive) (remote-control (help-buffer))) #+end_src 'remote-control' is one that does all the work. There could be remote-control-other-window-dwim similar as for dired. It is limited to visible windows, I think it would be easy to make misstakes if operatin on unvisible windows. Also note while this has utility, it can be a bit confusing. Anything that moves cursor around will be confusing since cursor is not moving in remote window, so visual feedback is not always there. If it would be interesting to develop furhter, where would it belong? Windmove.el or elswehere?