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: Complications with using buttons for inserting text Date: Tue, 29 Aug 2023 01:08:52 +0000 Message-ID: <0qLx4NgyIgddTGUIyCUsinPoyFhBXfrSWyJpMZDUdNT2dsy40Wv0D0ATLn2Z4GTOUTrNXFV1kLnPXAeCIv-8cro7fOAVDvNZ1YvBgM48QOo=@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="17429"; 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 Tue Aug 29 03:09:49 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 1qanEq-0004KH-Ry for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 29 Aug 2023 03:09:48 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qanEC-0006vX-6X; Mon, 28 Aug 2023 21:09:08 -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 1qanEA-0006vO-Ii for help-gnu-emacs@gnu.org; Mon, 28 Aug 2023 21:09:06 -0400 Original-Received: from mail-4318.protonmail.ch ([185.70.43.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qanE8-0004gw-0r for help-gnu-emacs@gnu.org; Mon, 28 Aug 2023 21:09:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1693271341; x=1693530541; bh=382zZJKoHYDLnqMCnek0CaOcK6HmuWml2ZKsrTHIHDo=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=vEGTTjb76N8nhfmn1G8clLucv2QxRyK+wLG6JJBeFMNSNFiiCjkgN2GzZXpNpgoBh 3SGT0L4dfL9i0n8/RAsuIsgsMSd3GjHQiCAOAWdy3BPK/fY9VR/77h15dnv2CFSRTX hOVL+EbAll1mefZ7DEsG91ZwimTRqPlx/307/q8X8UoUAQm3cFj5vvYqd6FtDUwY7+ 5/mOzL4gTHYIwA1ZENSeMMuMjBAsm2YxWTDqupWVJY/rJP19k9+0KUw0JeNtvjpXwi HjeAFr/dwykbpEHe7ZoCGkp2+lR/OpSG8WE+1WNpLdR7JHqx9ukLWhS5wo8BRhlZSO L2KGlNyJ1wkQw== Feedback-ID: 57735886:user:proton Received-SPF: pass client-ip=185.70.43.18; envelope-from=heimeborgia@protonmail.com; helo=mail-4318.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:145006 Archived-At: Most likely, I have complicated things too much, and would like some critic= ism=20 about it, with possible improvements. I have made the following design for displaying buttons ("[F5]" and "[B5]")= =20 to show some text using (insert this-text) and (insert that-text). The button "[Next]" displays the next piece of text, whilst the button "[*]" displays both buttons "[F5]" and "[B5]". I call the functionality via two interactive functions, 'qrh-maces-snapshot= ' (which displays only the snapshot related text) and 'qrh-maces' (which disp= lays a separate "action-release" and action-snapshot). The interactive function 'qrh-maces' has the possibility of either calling 'action-snapshot' or 'qrh-maces-snapshot' for the same thing. (defun action-snapshot-f5 (button) (insert-button "[Next]" 'action 'action-snapshot-b5 'follow-link t) (insert this-text) )) (defun action-snapshot-b5 (button) (insert-button "[Next]" 'action 'action-snapshot-f6 'follow-link t) (insert that-text) )) (defun action-snapshot (button) (pcase (button-label button) ("[F5]" (insert-button "[Next]" 'action 'action-snapshot-b5 'follow-link t) (insert this-text)) ("[B5]" (insert-button "[Next]" 'action 'action-snapshot-f6 'follow-link t) (insert that-text)) ("[*]" (insert-button "[F5]" 'action 'action-snapshot-f5 'follow-link t) (insert-button "[B5]" 'action 'action-snapshot-b5 'follow-link t)) )) (defun qrh-maces-snapshot (&optional button) (interactive) (insert-button "[F5]" 'action 'action-snapshot 'follow-link t) (insert-button "[B5]" 'action 'action-snapshot 'follow-link t)) (defun qrh-maces () (interactive) (insert-button "[*]" 'action 'action-release 'follow-link t) (insert-button "[*]" 'action 'action-snapshot 'follow-link t) (insert-button "[*]" 'action 'qrh-maces-snapshot 'follow-link t))