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: Control help- and Info-mode buffers from other buffers Date: Thu, 01 Jun 2023 05:16:41 +0200 Message-ID: References: <87h6ruf09e.fsf@ledu-giraud.fr> <861qixbum2.fsf@mail.linkov.net> <86wn0opgpi.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="29372"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Manuel Giraud , emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jun 01 07:37:28 2023 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 1q4b02-0007Lm-I0 for ged-emacs-devel@m.gmane-mx.org; Thu, 01 Jun 2023 07:37:27 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4az6-0004FA-2z; Thu, 01 Jun 2023 01:36:28 -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 1q4Ynw-0006y6-QN for emacs-devel@gnu.org; Wed, 31 May 2023 23:16:48 -0400 Original-Received: from mail-db5eur02olkn2029.outbound.protection.outlook.com ([40.92.50.29] helo=EUR02-DB5-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 1q4Ynt-0002um-Pm for emacs-devel@gnu.org; Wed, 31 May 2023 23:16:48 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YpgJ8frMazgEAsAZwTOpvjYeiwHj3DfJux7jzK0tIEcZ3D+hsGPFKwzhNy41G9StapGsUEFIjzTYqCpjVw30pN2GuKgxUIl7OxBrFqpKW/80rRD/rngy7JyrH31fdmXfVbIx4LLek90Mcy0difEEeutfMZn1pSbGdWqprB80y8UIxFol8iAtlRXp8gyoJJ8RFAH1kx4Lk03nHfXPSIqPUzJ1W+YdRi4p1Glm21pWhKxD3jannhbSUpsGxP5VF4mrPj9zdtguBFABiJ0yBj9jNls5OReHHbAEyCh4PTkB3KxVMtC9PVlop3tGyQy1xKGO61efP3Zx9cGph3/InA8e8g== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nnzpX/wHHAXO1D824lP0LSAi1gzmY0YL9qxlUC0FnuQ=; b=WWhlaIlvv3uHp0Fhn9aCWSDIaKLSCLabcE4sEXRpWJ6PfyrhUv0NR/SDuBd7+wljmJ7DZLo267qGDMtFK3boqfhGmJJIHZKg9caNVYUn9l03lBwZQr+CBP39YVaVY0ZU+C/7EEamCcP+TxhCnjM6CaLKXIUiIm/gCVc+tTkQdD4Z4tImvrnc53BTmZyx9FhJbUkauwcPX0ldMtwHdat97j00eYJLicig04fxVv2YCBRSLHqQQPoo4z4VW0C2UrJeZAO6DIUjSxVb/E6BGhLd75mMl/QHShM3gaBjr/wV+1o0V0GdqF9X9RuEDQu+/GqIG3cCPwYatnuAHGNb52VV2Q== 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=nnzpX/wHHAXO1D824lP0LSAi1gzmY0YL9qxlUC0FnuQ=; b=AtI/3qnpx1zi8LVYVP0i+aUzkS/Vil7nRVUl4aPpUa+OBpN/2aJXqsy3WrVSgdZ6Q2qAvvU/8J1kxoauHE4y5oPr5ldnERuSc0qGVPbJMR2/r46ZuE3mu8W8xIQHejwQlhTlKP4fcFkusRW+EMMFeuHJY6E+zcgf/yLRvdpayCkn/afaSzXXYvGnecWqouNi5r8ZjVMeOpImFlLWGyR7s5Fe1ZoPolft3V74e3qINpY4nfiw0RnB9C+Ji1Qem7QkwuwyH1w/XXK4jsHyh2yu5gdTSYtmkwdJ89LxtBh628ICky9xqpnkt8m2c6E41U9dEjFxaIwxCLnSz/zaCJVp9Q== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by DB9PR09MB5709.eurprd09.prod.outlook.com (2603:10a6:10:308::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.24; Thu, 1 Jun 2023 03:16:43 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::6983:1def:fb14:21bf]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::6983:1def:fb14:21bf%6]) with mapi id 15.20.6455.020; Thu, 1 Jun 2023 03:16:43 +0000 In-Reply-To: <86wn0opgpi.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 31 May 2023 20:13:13 +0300") X-TMN: [wT47gXqd2TC07Yr9qJafjEd8T7zCEhe4] X-ClientProxiedBy: BE1P281CA0135.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7a::6) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <82y1l3vply.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR09MB4977:EE_|DB9PR09MB5709:EE_ X-MS-Office365-Filtering-Correlation-Id: d4ab34ca-3493-4b8c-6ccc-08db624e9f83 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IRLfHeEuzn30xy1jHPXRyz7DEqAF1bODA/dThwXW//v/DILyjB5osuttg41H+FmQ9dJ9qxylsPRUKoncdXz6JBm0HhaHZq6URIwaqO6QLqzWLHH9MuMKlrXfUOx0Bgo4zqadPpIxF7UYC49HazreYFZSoQ6/JVyhxWk31GY24Exh+LPaziBHTDKctC0CqfWgXj1cKl4QdnWPLW52gu9rigmaoWzWdWsbtL/ZCaO/qJb7FyHpGt64CVXqpF2xRFd/H73Rp/C1qAQqW0MnLpK2lJfw3UMXH+ao2hs9YIZ2Ql+DZ1DLQJkTJdikenD/eQw/s7N2GflMn+GaecP22VcaGUXfH0nW+CC6Tw/GXIF6BvPodTiJQiMltvbUmo5woVD6icaC6EHYiC1q0t/ykq2I9QKQJnvw2+2NxzvFHhwOFHi1QzwTauelNaSZLH3s3PLdyTB2MTIYa7lYkTpq/L9CiYlFR7r2HFqsnm3Uf7kPs51JgpkxPOutO9A6xAZgKqqMtBqzk1pXxyeo84YFfPg6+O+LwuQTHeKWjMn6CU1ltmzWVJZoGGdCxEQCCy8ysAY3wU0H3Awd8cw+m4hVLzR3OaaACiB9IySO5wdm+HiDh5g= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?KbYqdCL6rsOn3Qf3wDXVs6ODEBKCPr2b9v/VoF491aj4urMh2KXfPWoitnjj?= =?us-ascii?Q?dqTD0Sdi9U2udU4+j105iMeuMael0rnHvlE1vRPgJneCoUhnGv6mCgnRMrpL?= =?us-ascii?Q?xxMuLOEMK95IaNuagNTdBUoGf3ZDK2kr4vw35V1Lx/ESzbfCF7NqOYx5IDGQ?= =?us-ascii?Q?G5p1eiL/ad+f0E/lFYiBvQw2WmnxXKZpHSkD3+h1NJAwALlPqilWtcMcLKUR?= =?us-ascii?Q?d6FMPdOdWLcuP2Kd7CsNGvqweqDYDyR7q8/Azzku6nOOGQDrFXwwgsI7D96F?= =?us-ascii?Q?VuyjeWgbGgORWo6umW9/ojgfv+FUlPztQV2Y+fGQITA6yDgf+axNAfn34q2m?= =?us-ascii?Q?YOOjJ+gc7mDv4iRpcEd0XZcb43atTP2soba/HgG0yC840oXdWMrb+IgqSNSO?= =?us-ascii?Q?ZUJlAqr0sURhOppb2p2e4UtjGhAqZ11xw/i4ZwfhrvXeRERJXVETvgBHBE+7?= =?us-ascii?Q?mg6LugsPRZssw/2JXBTtZpxsoz176c0Heq4R2IeeImP5z9nXaF05zJczevAk?= =?us-ascii?Q?poEGi4kYWz+fOkYyndYGwlpIpJqF/LEV9gDnWI32/SBZopzTRrVdqVD+E1mO?= =?us-ascii?Q?qWkYTsQkIFAML9iiBjDjvsP4w6ylLzDJ1NVxQoK2xe02xCha5IkbdBEYIDpz?= =?us-ascii?Q?pa X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-64da6.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: d4ab34ca-3493-4b8c-6ccc-08db624e9f83 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 03:16:43.1721 (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: DB9PR09MB5709 Received-SPF: pass client-ip=40.92.50.29; envelope-from=arthur.miller@live.com; helo=EUR02-DB5-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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 01 Jun 2023 01:36:25 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:306474 Archived-At: Juri Linkov writes: >>> since it would be nice to have a general function >>> that will delegate key presses to any window, >> >> I think it is similar, but still a different problem then remotely executing >> commands available in other buffer. To start with there is a nice trick >> via pre/post command hooks, someone posted to me on Reddit: >> >> https://www.reddit.com/r/emacs/comments/x0r0pe/share_your_otherwindow_commands/ > > A hook-based approach looks promising. > > When such simplest prototype that demonstrates this solution > conceptually works well > > (progn > (add-hook 'pre-command-hook (lambda () (other-window 1))) > (add-hook 'post-command-hook (lambda () (other-window -1)))) > > then it could be extended by adding customization, etc. > >> It works quite well in some cases, but not in all. For example it does not work >> with Info-menu when invoked from other buffer either. > > If the code above doesn't work in all cases, this means we have a bug. You are conceptually definitely correct :), but I believe that we are in this case treating symptoms instead of the cause. The reason we would like to send input to other-window (or any window) is to be able to invoke some command in that window. Why can't we just invoke the command directly, via M-x, when anything bound to a key is an interactive command by definition? The reason is that commands are written with (or without) some assumptions. The most notorius here is that many commands are written to act in current buffer on selected window. It is not an unreasonable assumption, I am just saying that commands are ordinary lisp code that can do anything, and if they are not written with assumption to be run in some other buffer or window, than there can be problems.I am not sure I would call it a bug, this was just a natural assumption to make commands act on selected window and current-buffer, but in certain cases, it is indeed a limitation, or perhaps better to say, a noise, since it causes this extra switching between windows.