From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Suggested experimental test Date: Fri, 26 Mar 2021 20:02:34 -0400 Message-ID: References: <831ba60af0cbfdd95686@heytings.org> <87mtuxj8ue.fsf@gnus.org> <9088e12cb3de3d30abf1@heytings.org> <8735wnjsum.fsf@gnus.org> <83sg4n9jei.fsf@gnu.org> <87y2efhx3e.fsf@gnus.org> <838s6f9g5d.fsf@gnu.org> <87y2efgg3w.fsf@gnus.org> <878s6fgdzu.fsf@gnus.org> <19c1ec9e-a97f-a8ab-b966-edadbc299c39@yandex.ru> <7226c389-ebd7-29fd-23b8-c2dbfbf0c1a0@yandex.ru> <45322b47-e868-d242-0972-8d517e2dcfd7@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4294"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Emacs developers , Gregory Heytings , Stefan Kangas , Lars Ingebrigtsen , Yuri Khan , Eli Zaretskii To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 27 01:03: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 1lPwQO-000105-1b for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Mar 2021 01:03:32 +0100 Original-Received: from localhost ([::1]:49608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPwQN-0000da-1Y for ged-emacs-devel@m.gmane-mx.org; Fri, 26 Mar 2021 20:03:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPwPe-00009F-3F for emacs-devel@gnu.org; Fri, 26 Mar 2021 20:02:46 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:23916) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPwPX-0001XX-Jo; Fri, 26 Mar 2021 20:02:44 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 07A45441322; Fri, 26 Mar 2021 20:02:38 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6AB0B441365; Fri, 26 Mar 2021 20:02:36 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1616803356; bh=5+0Cq7qTvtPZvKIjWR7cBu1unHvSC6amlkXhM1ckeNQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=kjGgGr4pgP8fYogjj4+WVTSEcNH/H31+5IbwNmbWXhwueClfSM6Pei/mJF5mWgSYE XNQlHvV5xSs5VQD4qDJgaXnSqtFIumLAm4VKd59l2QSv+R4AhSA29F9G/o/aHS3wtN sFW/Ppz9/zulc7zsWt3g/X61GAjTzNRN47o4TgA4yUbz4gVEjuBKRIbDFVdk5jKmcr xUMTp9vOu7rys/y/LUzySKt3ykl4mlfmzmMLL/EzUZMMbRonfBDvtZbOzrGWoieR5S +Kv9/NtnlfJX84bcwc3CjIgxWSNQJpMUG/Wl7AKfUxIfteqiTgelmymdE2dziMrO4B gApNnWjXAe2cQ== Original-Received: from alfajor (unknown [216.154.43.249]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C7870120319; Fri, 26 Mar 2021 20:02:35 -0400 (EDT) In-Reply-To: <45322b47-e868-d242-0972-8d517e2dcfd7@yandex.ru> (Dmitry Gutov's message of "Sat, 27 Mar 2021 01:34:52 +0200") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=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:267092 Archived-At: > Perhaps we could instead do something with key-translation-map (or one of > its friends) that works on existing keymaps? > > The use of 'menu-item' allows us to filter based on whether the key is first > in the sequence: > > (define-key key-translation-map (kbd "") (kbd "C-c")) > (define-key key-translation-map (kbd "C-c") > `(menu-item "" ,(kbd "") > :filter my--head-of-sequence-p)) > (global-set-key (kbd "") 'kill-ring-save) While we can use such tricks, I think what we really want is to abstract the keymap API such that we can provide keymaps whose elements are computed dynamically. There'd need to be at least 2 methods: `lookup-key`, and `map-keymap`, and adding `where-is` would probably allow better behaviors (but could introduce other problems given the way where-is currently works). One application is to create a keymap (on function-key-map) that remaps all the events of the form "modifiers + mouse-4" to "same-modifiers + scroll-up". Another would be a keymap that binds the same keys as some other keymap except it requires some additional modifier or it removes a modifier, or it capitalizes all the letters, or it transcribes all the cyrillic letters to their "equivalent" ASCII, ... We can already perform similar remappings via `key-translation-map` or `function-key-map`, but these apply everywhere whereas if we could do them inside a normal "key binding" keymap then it could be made to apply only to bindings with a particular prefix. Stefan