From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= Newsgroups: gmane.emacs.devel Subject: Re: Entering emojis Date: Fri, 29 Oct 2021 11:32:49 +0200 Message-ID: <87pmroi3b2.fsf@gmail.com> References: <87cznths5j.fsf@gnus.org> <87ee87cwju.fsf@gnus.org> <83sfwmwubd.fsf@gnu.org> <875ytid54b.fsf@gnus.org> <877ddx5j9k.fsf@gmail.com> <878ryd5j5c.fsf@gnus.org> <874k915igp.fsf@gnus.org> <87y26d42qf.fsf@gmail.com> <87mtmt42lf.fsf@gnus.org> <87o87941ae.fsf@gmail.com> <87h7d03jvz.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29565"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Oct 29 12:23:47 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 1mgP34-0007Uq-J8 for ged-emacs-devel@m.gmane-mx.org; Fri, 29 Oct 2021 12:23:46 +0200 Original-Received: from localhost ([::1]:45390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mgP32-0006A3-U5 for ged-emacs-devel@m.gmane-mx.org; Fri, 29 Oct 2021 06:23:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgOFq-0002YL-CA for emacs-devel@gnu.org; Fri, 29 Oct 2021 05:32:56 -0400 Original-Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:38554) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mgOFo-0003QT-G0 for emacs-devel@gnu.org; Fri, 29 Oct 2021 05:32:54 -0400 Original-Received: by mail-wr1-x429.google.com with SMTP id u18so15251965wrg.5 for ; Fri, 29 Oct 2021 02:32:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Bf9NvA0q+WzXTXQq3DtmMYpQiZ2Lq/QgrF3f+lNO/N8=; b=W+LXoSwZJhEjpGqMLI7rqn9MIXfSGr+mOLwe7eCqHFvkGPnl+tYYNVLInYyp1yZ9MR lcDTK511b7MdnAe2KsB1uTrtLu6q+dYbN9daLWRX6UMXncz603nWsgjOjIU1q908QzNQ TXSozZG7IGRmBKtXosWG4QcqTYJ3l1O0WfFuErLg5jhPSWaSWY0AUQpLbDnl1FZmqGgD SfcfKR0VrOgbmdwlSgmT8CE0x+DO6RneGBm7VhEkmPuvy3Vgp4BAY9w5nVuxtnKeDbUs 0wgrfz/ZWuWmKJwNb52MuWP1f85lOzLglAMkV9Egvnt4DUF58BPsKPzmjpheTA2a68pq hBRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Bf9NvA0q+WzXTXQq3DtmMYpQiZ2Lq/QgrF3f+lNO/N8=; b=qG5ssNjkyZLvq9hPg/3hw9e6qv+7gD6GpC1PF48O139HREMBorNdH4ZZdzgI9FTCu7 kRNwDVpYODTwyIg4j0wwM5Jx7n6SxA4hjUVbmjw+ZRill40dHPV/LM+AQ2O1RQa0vRPG zqJvfS38ljg0Cc4l0pxfmIKYKi9htC1CUpGqcSX8YxuZUTlfaCPomENWwriObK+ejjBq i0Xo2dgwlqZ80qpJS/2cIcCrGX1GDAR2AxIoP6MshlIgcQVz2OS4tcpB32Gn4Z+M/GcD 8XUm+a+LGuJraNrHrbm4d/jldqAdydEfPugfu/jykO3+6GGZAoqjItsnO+ntzmAPgGC6 1ddw== X-Gm-Message-State: AOAM531/2w86JkAreCbxa0X8z68A+dimZj3S1jzoZIQkr/Wnl1tR6BoE oBV9fGdC5BNJozcLA285K8Bycx62B0Q= X-Google-Smtp-Source: ABdhPJxiec4WbxQXKW9f2zm3EFQE6ch3e8XGnZex+7dTa5MgZzxXdlfGZbLHOgqh9pBTSWrw0WO2WA== X-Received: by 2002:a5d:4882:: with SMTP id g2mr12427358wrq.399.1635499970972; Fri, 29 Oct 2021 02:32:50 -0700 (PDT) Original-Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id p4sm5181789wre.29.2021.10.29.02.32.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Oct 2021 02:32:50 -0700 (PDT) In-Reply-To: <87h7d03jvz.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 28 Oct 2021 23:43:44 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=kevin.legouguec@gmail.com; helo=mail-wr1-x429.google.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, 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:278175 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Lars Ingebrigtsen writes: > I've never used transient before this, so I don't quite understand what > you're saying here. =F0=9F=A4=A8 I have used transient a lot in the context of magit, where each transient command gets a bunch of "arguments" that you can save permanently, thereby saving you the trouble of giving common options such as "--graph", "--decorate" and the like everytime you want to run "git log". Here, lemme try something=E2=80=A6 *bangs head on keyboard for an hour* OK, see attached. With M-x emoji-pick, you can now - hit "-s" to pick your favourite skin tone, - hit "C-x C-s" to save it (to ~/.emacs.d/transient/values.el), - insert emoji, - on subsequent M-x emoji-pick, you no longer need to pick a skin tone, - you can still hit "-s" occasionally to unset the tone, and a second time to pick a different one, - you get minibuffer history with M-p. Note that I have never written transients in my life before (not with that level of complexity anyway), so I'm sure my implementation is all manners of uncouth. --=-=-= Content-Type: text/x-emacs-lisp; charset=utf-8 Content-Disposition: attachment; filename=transient-arguments.el Content-Transfer-Encoding: quoted-printable (defun emoji-pick-read-affixation (names) (mapcar (lambda (name) (list name (char-to-string (char-from-name (concat "EMOJI MODIFIER FITZPATRICK TYPE-" name))))) names)) (defun emoji-pick-read-tone (prompt initial-input history) (let* ((names '("1-2" "3" "4" "5" "6")) (str (completing-read prompt (lambda (string pred action) (if (eq action 'metadata) `(metadata (affixation-function . ,'emoji-pick-read-affixation)) (complete-with-action action names string pred))) nil t initial-input history))) (char-to-string (char-from-name (concat "EMOJI MODIFIER FITZPATRICK TYPE-" str))))) (transient-define-infix emoji-pick:--skin-tone () :description "Skin tone" :class 'transient-option :shortarg "-s" :argument "" :prompt "Skin tone: " :reader 'emoji-pick-read-tone) (transient-define-prefix emoji-pick () ["Variations" (emoji-pick:--skin-tone)] [["Emoji" ("s" "=F0=9F=A4=B7" emoji-shrug) ("y" "=F0=9F=91=8D" emoji-yes)]] (interactive) (transient-setup 'emoji-pick)) (defun emoji-shrug (variation) (interactive (or (transient-args 'emoji-pick) (list nil))) (insert ?=F0=9F=A4=B7) (when variation (insert variation))) (defun emoji-yes (variation) (interactive (or (transient-args 'emoji-pick) (list nil))) (insert ?=F0=9F=91=8D) (when variation (insert variation))) --=-=-=--