From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Heime Newsgroups: gmane.emacs.help Subject: Functions behaving according to button presses Date: Mon, 28 Aug 2023 18:11:04 +0000 Message-ID: <9pPuCpfhgOsgqakOyxuaK6ysqw46y4PFCrxJ2UbbDa1A7RAOgrJr7oavohUYjsYh0SQzkKsdR7j_jbbBVY4aKps2aLUMsaXS1yG3uzbkeoU=@protonmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29693"; mail-complaints-to="usenet@ciao.gmane.io" To: Heime via Users list for the GNU Emacs text editor Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 28 20:12:05 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 1qagib-0007T8-AS for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 28 Aug 2023 20:12:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qaghz-0007SS-2g; Mon, 28 Aug 2023 14:11:27 -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 1qaghx-0007S4-Jj for help-gnu-emacs@gnu.org; Mon, 28 Aug 2023 14:11:25 -0400 Original-Received: from mail-40138.protonmail.ch ([185.70.40.138]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qaghu-0001ca-MY for help-gnu-emacs@gnu.org; Mon, 28 Aug 2023 14:11:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1693246279; x=1693505479; bh=IendE/1XL1a5WARECT2MZFyjLShPhe1Yazl8K3cLk3I=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=hBi7QD2gWPh+16vZqmKBWlI1RobRbaz/XIXQcLlC7c520BpvM7bNNBg2SqkROFlCk HtUy/rXAUa2WCC5nNAIx5/gsto2Na5rdNkC0nTHBeGzH0W6zf5PDHWVUikJH5plpav tUCJ9PPZslD4e98I3QldLwBjqTUXYC3Gevx1L2ob/B1dDPvmaM+6GIrZkjEHucLhL9 aTg0ZWN+nO+ELu3NyJTg83pkbgnSYwQ59gM3T9Qu8aU6qa9Wuro8xxVhBEmACmMqzL TzNcg59Guq/6vCrbYvjPwSY5E5gFo+Uad8ODWOmjvkm/TjRhL4QA1zFZEaBz0qAZeA JAGiXhLbUPVmg== Feedback-ID: 57735886:user:proton Received-SPF: pass client-ip=185.70.40.138; envelope-from=heimeborgia@protonmail.com; helo=mail-40138.protonmail.ch 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_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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:144992 Archived-At: Have noticed that I can have a function like this, which I can use with elisp code, using for example=20 (insert-button "[Next]" 'action 'action-snapshot 'follow-link t) The above will also work with any button property name like "[Next]". Alternatively I can execute only the "[B5]" part using (insert-button "[B5]" 'action 'action-snapshot 'follow-link t) Or call it interactively with 'M-x action-snapshot'. In such case, the function would execute '(insert "that")'. (defun action-snapshot (&optional button) (pcase (button-label button) ("[B5]" (insert "this")) (_=20 (insert "that")))) Is the aforementioned description correct. Is there anything else, alterna= tive ways of using function that react according to button clicks ?