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: Re: Buttons in help buffer that displays contents of variables Date: Sat, 22 Jul 2023 22:13:25 +0000 Message-ID: References: <87h6pvvh4i.fsf@gmx.net> <87cz0jvfjo.fsf@gmx.net> <-Of1ukZDnMEs_SVnir4H5K16gZyeSQzumX2oqufViGBYgx6lWFHLhnFHoUC6_0NHmrd9FQ7I5-HyOlZWKDx1Go2wVfQ9Yb0WZrTPY2ihcbo=@protonmail.com> <878rb7vctx.fsf@gmx.net> 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="38738"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Heime via Users list for the GNU Emacs text editor To: Stephen Berman Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 23 00:14:19 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 1qNKrj-0009si-8z for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 23 Jul 2023 00:14:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNKrB-0006nM-Sj; Sat, 22 Jul 2023 18:13:45 -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 1qNKrA-0006nD-E3 for help-gnu-emacs@gnu.org; Sat, 22 Jul 2023 18:13:44 -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 1qNKr8-0003y0-Lf for help-gnu-emacs@gnu.org; Sat, 22 Jul 2023 18:13:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1690064020; x=1690323220; bh=RigHbVPZqxbe7MQZs5uFMK3jkjfwEOdqOMcpdLFDY+4=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=Bg+GOi/KXZKh0rjWXOsHrJ34ubU/LpEzWnTB0S4WIGz/yxtZdycebhqA4ovELAdpb EcL4PCfPOIlCCF0r+xJCAQvqzBoogSOYuVDIJzFHSF4LzsBwv6CpU8XjwbqUwmNALN U+1gEFe9GK3mO9Po2AJ9qU9yD9L8TLGoXiJ38aiRYfW8qBjVGIXKcT/1CRTDeaYWzE 9z6EzMd67bnNXIWmjzq3aV8sJuTSd7KS6Wms/NwqEqXo3d0eOE1LEmmEbU0l04CluF i/S8FJG9sh2l++L4Fk35snuz9UZHlX3Vy3WsOd20grIC45H47visIxfj1cJ8R0HQTK /cXMwrXcbYaDQ== In-Reply-To: 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, 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:144397 Archived-At: ------- Original Message ------- On Sunday, July 23rd, 2023 at 10:02 AM, Heime = wrote: > ------- Original Message ------- > On Sunday, July 23rd, 2023 at 9:46 AM, Stephen Berman stephen.berman@gmx.= net wrote: >=20 >=20 >=20 > > On Sat, 22 Jul 2023 21:24:39 +0000 Heime heimeborgia@protonmail.com wro= te: > >=20 > > > ------- Original Message ------- > > > On Sunday, July 23rd, 2023 at 8:48 AM, Stephen Berman stephen.berman@= gmx.net wrote: > > >=20 > > > > On Sat, 22 Jul 2023 20:24:16 +0000 Heime heimeborgia@protonmail.com= wrote: > > > >=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 variabl= e inside > > > > > > > > a help buffer, but the following gives > > > > > > > >=20 > > > > > > > > (wrong-number-of-arguments ((t) nil "Function to be execute= d 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 us= e the > > > > > > argument, you can use `' as a placeholder for the required argu= ment, > > > > > > 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 Do you know what the single argument is used for ? > > > > > I do not understand the reason it expects an argument. > > > >=20 > > > > In the Emacs Lisp info manual there is the node `(elisp) Buttons', = whose first subnode is` (elisp) Button Properties', whose first entry is th= e > > > > `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=98igno= re=E2=80=99, > > > > which does nothing. > > > >=20 > > > > > Would there be > > > > > a more suitable way to print some text after pressing the button = ? > > > >=20 > > > > If you want to use a button, then I guess not, since it needs an ac= tion > > > > (or mouse-action) property to do something on pressing the button. > > > >=20 > > > > Steve Berman > > >=20 > > > In other words, insert-button needs a function with a single argument= so it can > > > pass ignore. Yes ? > >=20 > > 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 n= othing 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. > >=20 > > Steve Berman >=20 >=20 > That explains it.