From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: acdw Newsgroups: gmane.emacs.devel Subject: =?UTF-8?Q?Re:_Suggestion_for_improving_ergonomics_of_repeat-maps:_define?= =?UTF-8?Q?-repeat-map?= Date: Wed, 08 Sep 2021 17:01:31 +0000 Message-ID: <444baed6-8fac-4dd3-a61e-3e6a89a1f7aa@www.fastmail.com> References: <87bl53f78g.fsf@posteo.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="5316"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.5.0-alpha0-1229-g7ca81dfce5-fm-20210908.005-g7ca81dfc Cc: emacs-devel@gnu.org To: "Philip Kaludercic" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 08 19:07:46 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 1mO132-00016h-R8 for ged-emacs-devel@m.gmane-mx.org; Wed, 08 Sep 2021 19:07:45 +0200 Original-Received: from localhost ([::1]:52774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mO130-0003Jl-Pw for ged-emacs-devel@m.gmane-mx.org; Wed, 08 Sep 2021 13:07:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mO0xU-0001Rf-TB for emacs-devel@gnu.org; Wed, 08 Sep 2021 13:02:01 -0400 Original-Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:57035) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mO0xQ-0000oA-HZ for emacs-devel@gnu.org; Wed, 08 Sep 2021 13:01:58 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 4DC4632000EB; Wed, 8 Sep 2021 13:01:54 -0400 (EDT) Original-Received: from imap1 ([10.202.2.51]) by compute4.internal (MEProxy); Wed, 08 Sep 2021 13:01:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acdw.net; h= mime-version:message-id:in-reply-to:references:date:from:to:cc :subject:content-type; s=fm3; bh=vbP1eR5h+0D18tK8/sa3rRbiCAfIO8l ltnMdprzHCSE=; b=AMyJfKRznrbehqrdqRv2D/hDNEP8Ej4ro39s9qSbh5Usd1j Jn+Nglfd/d0x1tCbadAeJOft/eNaFQ0Qd/Yh5mtkYq4BmFWp450IcLsD6buwdXzv GCTjjet2uqFMA0AVL2TzDUeWCv+CNOWf1HeEouKE20849USowGCsiyNiv4c3ux2d bmwCXTKg3EFyMdmPfntSxO5TrUpxD04p+qZ8dWnF6w22W4z/HFgjl40aw/YfqMkD RZsBBgb6/vIyKstH8boIIY/kp/32KeWz6dORGNMJpC24OLZeFOhmoHClPqffoBDB RRhnjzG92WWnB7vvDT0ybhHvZX2kr1l9qBexahA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=vbP1eR 5h+0D18tK8/sa3rRbiCAfIO8lltnMdprzHCSE=; b=UecsJOgiyoecNsDASl5Uys o3hMcixsPyAtXp5D4iQNrAYD2bNbC0oZlWX9xjsipJ65rRPuSZBDCA61o/vVvb60 JBFZLKNITkgNU5bGQBKDGmLBdaBPm/szCWQ7ydREZC3oeOELhHqzU65LQAan8vke E4QlMaU857S/vEedy7ZfiCg8Zvf1WTFW5kwAkC6oq2dBQpSheQ4RTlfxaFr6b/tR B8fecyfx5HEkwsCK+RlK/d98ZMUmb0SKtwUN7zL/Pcm5faL0/44yxtHPKEtd0O62 l3A5h0XaOd2RgDGwZxYrjN5wOyDdj9Ha0gStskw9DW2YzOv0ILX2fHYOsbnC6akw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudefjedguddtjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderreejnecuhfhrohhmpegrtggu ficuoegrtggufiesrggtugifrdhnvghtqeenucggtffrrghtthgvrhhnpefgtdffvdfgtd elvdfgueehjedtfeejfedvffffvdejudfhiefhueetjedvfeekvdenucffohhmrghinhep rggtugifrdhnvghtpdgsrhgvrgguphhunhhkrdgtlhhusgenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrtggufiesrggtugifrdhnvght X-ME-Proxy: Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7091C1301160; Wed, 8 Sep 2021 13:01:53 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: <87bl53f78g.fsf@posteo.net> Received-SPF: permerror client-ip=64.147.123.20; envelope-from=acdw@acdw.net; helo=wout4-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, T_SPF_PERMERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 08 Sep 2021 13:06:39 -0400 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:274375 Archived-At: On 2021-09-08 (Wednesday) at 14:54, Philip Kaludercic wrote: > > I haven't taken a detailed look at the source, but I have two > superficial questions: > > 1. Why is the name argument required? Shouldn't the macro be able to > gensym a new symbol to use for the map? > 2. Could the argument structure be flattened, so that you could write > something like > > (define-repeat-map > "c" capitalize-word > "u" upcase-word > "l" downcase-word > :continue > "f" forward-word > "b" backward-word > :enter > downcase-dwim > upcase-dwim > capitalize-dwim) > > ? > > -- > Philip Kaludercic > To answer your questions: 1. I wanted the resulting keymap to be introspectable; the macro creates a keymap named "NAME-repeat-map," i.e., "case-repeat-map," that can be C-h v'd and friends. (Now that I'm thinking about it, perhaps I should change the map's documentation property after the fact, to include the keys in the map.) 2. There's no particular reason it couldn't be flattened; I just like sexp's structure a bit better. In fact (regarding 2), there is also this syntax, which I've been thinking of as well: ~~~ (define-repeat-map map (("c" . #'capitalize-word) ("u" . #'upcase-word) ("l" . #'downcase-word)) (:continue ("f" . #'forward-word) ("b" . #'backward-word)) (:enter '(downcase-dwim upcase-dwim capitalize-dwim))) ~~~ Your proposed syntax could also work just fine with a slight refactor, which I should do anyway; another consideration is whether the `:enter' commands should also define the keys in the current-global-map, or possibly a customizable map. The other question is, does this need to be a macro, or is a function enough? -- ~ acdw acdw.net | breadpunk.club/~breadw