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: Buttons in help buffer that displays contents of variables Date: Sat, 22 Jul 2023 23:46:50 +0200 Message-ID: <878rb7vctx.fsf@gmx.net> References: <87h6pvvh4i.fsf@gmx.net> <87cz0jvfjo.fsf@gmx.net> <-Of1ukZDnMEs_SVnir4H5K16gZyeSQzumX2oqufViGBYgx6lWFHLhnFHoUC6_0NHmrd9FQ7I5-HyOlZWKDx1Go2wVfQ9Yb0WZrTPY2ihcbo=@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="37985"; 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 Jul 22 23:47:47 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 1qNKS2-0009hn-QO for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 22 Jul 2023 23:47:46 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNKRI-0003Tf-N8; Sat, 22 Jul 2023 17:47:00 -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 1qNKRE-0003TF-7q for help-gnu-emacs@gnu.org; Sat, 22 Jul 2023 17:46:56 -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 1qNKRC-0003ZZ-Bl for help-gnu-emacs@gnu.org; Sat, 22 Jul 2023 17:46:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1690062411; x=1690667211; i=stephen.berman@gmx.net; bh=nCJYCVK3D60rgY5q26IlHHSw1WcCaQZ5UaMOPfIIQ+4=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=fex65ojvgEgkhq7yp/AdrfEsX+hTrsuGIZNrmhvchpR/8hkMV3UoEYDqGRcqtqtaOuDjjmw T9Do1iHU6OiLEoZvdauAY1CdBcoJvIPKZlode4euWsW/tZZqelDe+4i1RdPKO7ldf0rt2de64 ktvQVMgkHR4W7T+TRzZJlE/oTHIooTGbU6MnRy90WEmg+oXSSDIsHrUGvNsEp/RzTE1vBqncY bhlSx8P1HiZo4eTqi7GBuAqpdBe7+KYbKGMlFHSbz/JpVOGn6b69aR69s3OvscUl9Mrp3Lh3V ORUCzgQMs6nYun1dsEcnv06Ex6OFhEdl78j3aYcPJ6yNKEaqYTcA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfssd ([94.134.196.80]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MRTN9-1qZeEJ3su5-00NUo3; Sat, 22 Jul 2023 23:46:50 +0200 In-Reply-To: <-Of1ukZDnMEs_SVnir4H5K16gZyeSQzumX2oqufViGBYgx6lWFHLhnFHoUC6_0NHmrd9FQ7I5-HyOlZWKDx1Go2wVfQ9Yb0WZrTPY2ihcbo=@protonmail.com> (Heime's message of "Sat, 22 Jul 2023 21:24:39 +0000") X-Provags-ID: V03:K1:I+nTSmx2i0a3fNu6J3SXx6VvrWYQnlzbqqsonqh9R3Wko2d4JnD rq8YNsNff3vZFwyS3dbmKkukfWfTSikzYi/f5Ul61DeIT8Ddhey0l3zvS4/qv0V0Ulen0yE KQYCKXAsmpYM3f1nfR9y0wyLUWrODuYibrfzCbU0lg3wFTp/X4qBh7mA301LAEqFtEj1du+ 9ZVEru9WYbKj0/UncgOUQ== UI-OutboundReport: notjunk:1;M01:P0:nzbZWCaXA84=;wViZKu3fpETNDXchI8m9tJxyuWS P5hBd+YaniMeuKfvn6sAQyW+HRG/V4hNKhwSu4KY+qrOKGj0rweyzrs4YMAnJR/FG1AdQNo8g U+L6hfJpH1q5tDtwjtVQZ5L3llY5htRwDTmXRV/HbPa20ECpxykF+W/0ycsEgwrVG3Wvao2i8 nU7B8zarSBwaZePPn0mURnEu8LbR/O9TQXlHtXnVUjSmxXw2WRPfz0prAy1AZ0AqLsuPm6eaP 6ehKbJ0QLuXyujo6oMg6qUglbz0vkqCBtsCVaxdkKEQbFf5IlzmxHXwtQ1CebHkYEdxUifK2a lezLgybOVQOzwkvGRzExsyBjj32R+4KGLl1AMYbxckXLiz0z1iWyn3Bvo7FyrBFK96atWqE2R KbeNa4iX4/SgIct70mtNRotoagFyGO00CmPiIotJgPmLclf+/z4pmOmnUqwChQE5I3EClpdmA /JOvDWh4qXN3Tx+ErNfWEsXhD3wP6z1V6eGJZB/G3hqUhnHKpsDctYw32de7hSii3ZpdvNdHu /zG3Aj8bKqpQtRQLmzrGxpRDW1V7i6URulzo5BWokuBei2YcQDtnexUB08l2RmhaVVKHO0xPd k+iltlMBbTVrn7yG9vNLqtWcfRfMHhZmvupuhKevbGUXtjtJiS8TdcbCyrjnMxMhOQ6Hq9iBm aX3BBMd3fAjBWmgopGQpgSLm/FZYBa1XWlrWKNQsT3ddPS80yy+9QStRic/7tjqteZE7/qjMc OGvV4IPKmWwNQ7pCV9dZcrBOkytLx4dXpwmoTRfPvumb2JkKgsmI9PM3E3m0q2sAaq+k7BkI 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, T_SCC_BODY_TEXT_LINE=-0.01 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:144395 Archived-At: On Sat, 22 Jul 2023 21:24:39 +0000 Heime wrote: > ------- Original Message ------- > On Sunday, July 23rd, 2023 at 8:48 AM, Stephen Berman wrote: > > >> On Sat, 22 Jul 2023 20:24:16 +0000 Heime heimeborgia@protonmail.com wrot= e: >>=20 >> > ------- Original Message ------- >> > On Sunday, July 23rd, 2023 at 8:14 AM, Stephen Berman >> > stephen.berman@gmx.net wrote: >> >=20 >> > > On Sat, 22 Jul 2023 19:18:03 +0000 Heime heimeborgia@protonmail.com = wrote: >> > >=20 >> > > > ------- Original Message ------- >> > > > On Sunday, July 23rd, 2023 at 2:40 AM, Heime >> > > > heimeborgia@protonmail.com wrote: >> > > >=20 >> > > > > I want to use a button to display the contents of a variable ins= ide >> > > > > a help buffer, but the following gives >> > > > >=20 >> > > > > (wrong-number-of-arguments ((t) nil "Function to be executed when >> > > > > the button >> > > > > is clicked..." (interactive) (message "Button clicked!")) 1) >> > > > > my-action(#) >> > > >=20 >> > > > Why does pressing the button give me such error ? >> > > >=20 >> > > > > (defconst myvar "Text of Front A") >> > > > >=20 >> > > > > (defun my-action () >> > > > > "Function to be executed when the button is clicked." >> > > > > (interactive) >> > > > > (message "%s" myvar)) >> > > > >=20 >> > > > > (defun qrh () >> > > > > "Some description." >> > > > >=20 >> > > > > (interactive) >> > > > >=20 >> > > > > (with-help-window (help-buffer) >> > > > > (insert-button "Front A" 'action 'my-action 'follow-link t))) >> > >=20 >> > > The error says the function my-action expects one argument, but you >> > > defined it with an empty argument list. If you don't want to use the >> > > argument, you can use `' as a placeholder for the required argument, >> > > which will be ignored by the byte compiler: >> > >=20 >> > > (defun my-action () >> > > "Function to be executed when the button is clicked." >> > > (interactive) >> > > (message "%s" myvar)) >> > >=20 >> > > Steve Berman >> >=20 >> > I do not understand the reason it expects an argument. >>=20 >>=20 >> In the Emacs Lisp info manual there is the node `(elisp) Buttons', whose >> first subnode is` (elisp) Button Properties', whose first entry is the >> `action' property: >>=20 >> =E2=80=98action=E2=80=99 >> The function to call when the user invokes the button, which is >> passed the single argument BUTTON. By default this is =E2=80=98ignore=E2= =80=99, >> which does nothing. >>=20 >> > Would there be >> > a more suitable way to print some text after pressing the button ? >>=20 >>=20 >> If you want to use a button, then I guess not, since it needs an action >> (or mouse-action) property to do something on pressing the button. >>=20 >> Steve Berman > > In other words, insert-button needs a function with a single argument so = it can > pass ignore. Yes ? No. `ignore' is the function that is the default value of the `action' property of `insert-button', so if you want pressing the button to do nothing you can just evaluate e.g. `(insert-button "Front A")'. But if you want pressing the button to do something, you have to pass the `action' property to `insert-button' with a suitable function of one argument as its value. Steve Berman