From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.help Subject: Re: Using buttons Date: Sat, 29 Jun 2024 00:46:52 +0200 Message-ID: <87ikxsn0rn.fsf@gmx.net> References: <3sH6KqzeZXiJ35uUMxTMQWWtC4dYcAtBKnFtABwHKQpFtA1qyrVnbF4sGnaTm4ltbl-5gKwFRzrSWAHXsxb-KRaXCMindFHWKnzIoQBlJ00=@protonmail.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4769"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Heime via Users list for the GNU Emacs text editor To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 29 00:47:49 2024 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 1sNKNh-00010n-8e for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 29 Jun 2024 00:47:49 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNKMw-0001pU-Vw; Fri, 28 Jun 2024 18:47:03 -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 1sNKMu-0001p1-UF for help-gnu-emacs@gnu.org; Fri, 28 Jun 2024 18:47:00 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNKMt-0002ko-BV for help-gnu-emacs@gnu.org; Fri, 28 Jun 2024 18:47:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1719614813; x=1720219613; i=stephen.berman@gmx.net; bh=wK/VkrEx0X/5iZ6Uf8bshUOR2MgyPQC6of0sl3luzxw=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=QmhXNwhoFAgi293LUKEu4kajCqA04E3qLCyYIbQp+8ob37Q8bKCRpqvz0k5WDH5k qacb6TpcVFfy1OTudFqE92kaYfFq0q7FrDbuQMvfSofb84kD4f531AYzSdomMuO5i 1Xmr3Mk3zMqUvkmmY6J7wB5uENMTpCzV3QVA2VkcX9KW5A7D6Wl5RYtjGUTiS70oW qNZq0V3qoUNuXCeJ2qUurIVettCDBD0IcO0VcF34lb+g9gzsz21O+8V2kgUgXACpp xYWoRTXwtN549cmdzRe7mk8PboBlMMtEkdhwAC5tISpPVLyb0s95Nle5z2iZfbx1J 4NCbkh0VgB0d+Fx0SQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfs ([94.134.94.176]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MeU0k-1svYin05Ui-00ZqZ5; Sat, 29 Jun 2024 00:46:53 +0200 In-Reply-To: <3sH6KqzeZXiJ35uUMxTMQWWtC4dYcAtBKnFtABwHKQpFtA1qyrVnbF4sGnaTm4ltbl-5gKwFRzrSWAHXsxb-KRaXCMindFHWKnzIoQBlJ00=@protonmail.com> (Heime's message of "Fri, 28 Jun 2024 21:45:32 +0000") X-Provags-ID: V03:K1:qYiM4M4xycDR6X9xDovTO5Z3LxTasDkVWrsZ61pMXvj8c2ivOjq ioZ8QfX9hkMInEb1qg974I33bc9PJKMVUOsauQ9BaTYwuCBdQKelO/nO17bHl1IZUOyT8Lw Um9MLW+nt23EyrTNNxeitfHJDeDIw0dO5DttUKMqSF4Kx0xiq5FxIOe0Z3+qymR8EmUvvz9 q/XgVmFWRY55/f2uerm5w== UI-OutboundReport: notjunk:1;M01:P0:SoML7wdREpw=;ElwbDzb+Bk223qxARvolMaAAwZq YyErqrQiiD7Wj4avAciXd3IH0ZS1xsBeUq2N+VZX1dxWUhdGpq/eafTjhhw0ahDI6JEFMAlFP 4kXr97LXu+M8MNBl/dXC68Or1+5kwGS+gQ8fJctBb8beQsQxXRw0bh6AdamGwybg/q/hMRdPi UPrUZLPb8l6YdNPhLNL13FGCnhOEHuAYhkFd+M8bYwGZKOGaeB95Fr5ED49qZ8pcZWJw+qNc+ 4vdui1rzT0bCfU6/1EoUJ5h1CaoTnFsTPLY96MCvWXiDofWElDY/2U1MpTzpYzKY2HsWRhTaV mXAswacWvZYygjzeu3pPC1UsO/H/5KAc95lExmVFE72p9qG5XY4lK15j1GlJY/G6Nb3eUtkyP 1VRQr8O4ab74FwazQ/vBMrbfX1qXErokli0t01MgliATcySE3XAEvFHUJxJJS777Wsz8z2ubB HluGgF2Vx0W3Ey8dvr43UmZHNd4DNIS0akaHbqweCYipki5Ct0jhU41dTlZfT6OaYvf0kBKtM /hefOLBBW15Wk/YB4eFWbh53XqUL5jzlfLwGRmZ2ahXAA+6hQW7xFtgbfy3RGscMGjikcqUCt ydTXD2eGQ5AhJwjnbdAfiuRfy0lZURTYxzUwQbZrft/mGZO8C68p2uzv7PYmHEhTAHLtAPnKo PG7/YCR+I02jgKNgVa+ruSZ4mCJEEpny49kqmLgTAKN1RTSWwBGl4ECU8A9tWpFycA1o6FpMs 4SIzy1CBo8rtoo49Y+G78fUs0k1V00zqbjVR3xvgyn97TuQwZbAHniUUxCb/S76qnU3pv5GM Received-SPF: pass client-ip=212.227.15.19; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net 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_H2=-0.001, SPF_HELO_NONE=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:147020 Archived-At: On Fri, 28 Jun 2024 21:45:32 +0000 Heime wrot= e: > Have noticed that when using a button I have to define a unique function > to associate with the specific button. I cannot just use a single funct= ion, > then update the string (skrpad in this case). > > Also does the button label got to be unique, or is it just to give the b= utton > some text to display on the button ? > > (defvar skrpad "TODO-0") > > (defun montext (button) > (with-help-window (help-buffer) > (insert skrpad))) > > > (defun mondu () > > (interactive) > > (with-current-buffer (get-buffer-create "Mondu") > > (setq mon-skrpad "TODO-1") > > (insert-button "[1]" 'action 'montext) > > (setq mon-skrpad "TODO-2") > > (insert-button "[2]" 'action 'montext))) Try this: (defun mondu () (interactive) (let* ((skrpad (list "TODO-1" "TODO-2")) (montext (lambda (button) (with-help-window (help-buffer) (insert (pop skrpad)))))) (with-current-buffer (get-buffer-create "Mondu") (insert-button "[1]" 'action (lambda (b) (funcall montext b))) (insert-button "[2]" 'action (lambda (b) (funcall montext b)))))) Steve Berman