From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: transient questions Date: Tue, 14 Mar 2023 01:05:46 +0100 Message-ID: <87pm9cp2te.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20211"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.8.14; emacs 29.0.60 To: gnu-emacs-help@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 14 01:59:24 2023 Return-path: Envelope-to: geh-help-gnu-emacs@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 1pbt0b-00050y-R2 for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 14 Mar 2023 01:59:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbszx-0007HS-Ik; Mon, 13 Mar 2023 20:58:41 -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 1pbszv-0007H5-MH for help-gnu-emacs@gnu.org; Mon, 13 Mar 2023 20:58:39 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pbszv-0006Jw-E5 for help-gnu-emacs@gnu.org; Mon, 13 Mar 2023 20:58:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by fencepost.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pbszv-0002Ku-7Q for gnu-emacs-help@gnu.org; Mon, 13 Mar 2023 20:58:39 -0400 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pbszt-0006GT-4u for gnu-emacs-help@gnu.org; Mon, 13 Mar 2023 20:58:38 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B205B5C0061 for ; Mon, 13 Mar 2023 20:57:34 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 13 Mar 2023 20:57:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm2; t=1678755454; x=1678841854; bh=MtkJzZBW1E2pywHgiITb3iC1S V4ilc0acIdtb/lymTY=; b=EamvKO8hm1dJi0d+b+GP5uE7pmuL+qUx4UbsY80gJ aFqlwiVD2PK0pmiv5mHugu180G53rbikkw4leqThY3ID9mwZDtsNSdVWdoOAZe75 R2W3FtQzB7//Q2pw0z5LU7qLReD2daOJVn//JLDpnhi+QPGIDjQnCYaTj63lh0HS FZV4FPSFqgYewbzyI4aOWTCkpGJ/Ynh3qPFsPFgEDqeiyRk926Zdl7ZBycssfO/X iDl3Um3Ux2Igyu3fhhSEQwU/HQIkj8gXD9SPgl8R5TwKMaMxX/wNFY0Conr3MNCd 2Bn7JZNLqwC9frb+mskYd/ssJgrbIUqTwJwqB0OWOTzSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1678755454; x=1678841854; bh=MtkJzZBW1E2pywHgiITb3iC1SV4ilc0acId tb/lymTY=; b=ZDMiujTn0/4TX+gLWsdQWFJNqQqajWMrVbc4ilaYQyAlxUmsipT 21HD1noZMA+bfOO/Qos6GebA4LjS+quE9TPwIXXy8y/LbbOxqLAo8nBiP4v+75Nh bK+zRVNbCNo6xsohH1qgloU9xLl7pKF4fWB7yL01rmuGMF+TmYWZ3ix8XhxAoxzM yW7Eax2xlxRKDJuJzmYZLm9p3VfOk06z1K3WGA2jCevwelPzEArRRmj5+WXdJGDQ ST1kx/uPnGEAG1/RUboDVP41QHtfvFAjJbszrExwDQoxZo3T/sBmrIv5YITn++o6 +6i49t25Ym2J6uibEHhW7yYTrNVxqOiUBsw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvddvhedgvdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpegfhffvufffkfggtgesthdtredttd ertdenucfhrhhomheplfhoohhsthcumfhrvghmvghrshcuoehjohhoshhtkhhrvghmvghr shesfhgrshhtmhgrihhlrdhfmheqnecuggftrfgrthhtvghrnhepudeufedttefgleekhe eihfegtdelvdeutddvvedukedtieffiefhgfdvhfdtudefnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhoohhsthhkrhgvmhgvrhhssehfrg hsthhmrghilhdrfhhm X-ME-Proxy: Feedback-ID: ie15541ac:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 13 Mar 2023 20:57:33 -0400 (EDT) Received-SPF: pass client-ip=66.111.4.28; envelope-from=joostkremers@fastmail.fm; helo=out4-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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:143019 Archived-At: Hi all, I'm in the process of translating my hydras to transient, mainly to learn a bit about how transients work, and I'm running into something I don't get. I've concocted the following: ``` (transient-define-prefix jk-move-transient () :transient-non-suffix #'transient--do-leave [:class transient-row ("SPC" "" scroll-up-command :transient t) ("C-v" "" scroll-up-command :transient t) ("" "" scroll-down-command :transient t) ("M-v" "" scroll-down-command :transient t) ("" "" scroll-up-line :transient t) ("" "" scroll-down-line :transient t) ("" "" scroll-right :transient t) ("" "" scroll-left :transient t) ("b" "(Un)set bookmark" bm-toggle :transient t) ("g" "Top of buffer" beginning-of-buffer :transient t) ("G" "End of buffer" end-of-buffer :transient t) ("l" "Goto line" consult-goto-line) ("m" "Goto mark" consult-mark) ("n" "Next bookmark" bm-next) ("o" "Outline" consult-outline) ("t" "Previous bookmark" bm-previous) ("z" "Avy line" avy-goto-line)]) ``` >From how I understand the manual, the line :transient-non-suffix #'transient--do-leave Should allow non-suffix keys to exit the transient and be executed. That doesn't seem to work, though. When I type a non-suffix key, the command bound to it does get executed, (I can move the cursor with C-n, C-p, etc.), but the transient stays active. So I'm wondering what I'm misunderstanding here and if there's a way to get what I want. (Which is that any key not bound in the transient exits the transient and gets executed.) Secondly, I was wondering if there's a way to call a transient suffix directly, have it executed and activate the transient. In a hydra, you can bind not only the body of the hydra but also its heads to keys. The hydra on which the transient above is modelled, is this: ``` (defhydra jk-move-hydra (:hint nil) "Jump" ("SPC" scroll-up-command) ("C-v" scroll-up-command) ("" scroll-down-command) ("M-v" scroll-down-command) ("" scroll-up-line) ("" scroll-down-line) ("" scroll-right) ("" scroll-left) ("b" bm-toggle "(Un)set bookmark") ("g" beginning-of-buffer "Top of buffer") ("G" end-of-buffer "End of buffer") ("l" consult-goto-line "Goto line") ("m" consult-mark "Goto mark") ("n" bm-next "Next bookmark") ("o" consult-outline) ("t" bm-previous "Previous bookmark") ("z" avy-goto-line "Avy line")) (bind-key "C-v" #'jk-move-hydra/scroll-up-command) (bind-key "M-v" #'jk-move-hydra/scroll-down-command) (bind-key "M-g" #'jk-move-hydra/body) (bind-key "M-G" #'jk-move-hydra/end-of-buffer) ``` I've bound `M-g` to the body of the hydra (the prefix, in transient parlance), but also a few other keys to heads (suffixes, in transient parlance). With this setup, `C-v` will execute `jk-move-hydra/scroll-up-command` (i.e., `scroll-up-command`) plus activate the hydra. Is something similar possible with transients? I haven't been able to find anything like it, but perhaps I'm just not looking in the right place. TIA -- Joost Kremers Life has its moments