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 22:48:11 +0200 Message-ID: <87cz0jvfjo.fsf@gmx.net> References: <87h6pvvh4i.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="2085"; 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 22:48:55 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 1qNJX4-0000IX-Ts for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 22 Jul 2023 22:48:54 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNJWW-0002UD-1h; Sat, 22 Jul 2023 16:48:20 -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 1qNJWU-0002Tx-Qa for help-gnu-emacs@gnu.org; Sat, 22 Jul 2023 16:48:18 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNJWS-0006g2-2X for help-gnu-emacs@gnu.org; Sat, 22 Jul 2023 16:48:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1690058892; x=1690663692; i=stephen.berman@gmx.net; bh=J+6C6u3LTo937wiwpbLHc9ewe6HzGM8U9BOaK+5iZBQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=DtJrVRCBndLtZD2QRl9G0gPT+oXr882RpU9F3YqN5mBcutQJ4Opnc4Nlmn5J/U0uF/UdO+1 VBamZgtWnBoPK9eRyK4voChAFdKBZNoADp80PwqSXGt86Iwm9sN/EN+U37gDZioxeH/mNDaNE JGG3LYneXFUKkguqDyFQJ5cqHxlClPSZtClXzvxgzo46m7jQev7ZrZhQQ91DImFBnzSuIoNps l++91hIaROWqTIvusLZhOtmfq0nM7fcKlDBuSGuv+KacYAVyKiZTEVqtC3JyG3NV9DK6k3BSN 8/2LMiS63RBroAKFUzqyzBY5s4LOoC6kV7pmzm4Bs4MSHLgi8ncA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfssd ([94.134.196.80]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MxDou-1pzD400TQO-00xbog; Sat, 22 Jul 2023 22:48:12 +0200 In-Reply-To: (Heime's message of "Sat, 22 Jul 2023 20:24:16 +0000") X-Provags-ID: V03:K1:DOo6XIDEB3moVqGkgcihlj3XRH4VHsG7Su+0eY+ySUrOJqz4fPx rQgfxPqPs7PR6Fnclw391UHVsgeJw2ZwQ0KuBU3v98dmqfUB7NLJpUS+O/6I3r4VjXHt0ys Sy1ytcYkO2u2nfICYSatt7O27UJ8yGVotJlAbM8uK4chvRRjLXdJEzxFufIlKeqdmLtuhqf wUAKOSZIc7/gVBGcKJDkQ== UI-OutboundReport: notjunk:1;M01:P0:7HhSGqlefqE=;/na55Wv6tEtnqgFjOPRn+rNYFAb i3soWr6TGfahr+e6EtO/3j1I+1CHKI/XS3ZXbostH2cWga22Ndb7bdUTKBuvVEkfzLzgST+5O lYjdD+KmUslpw2vync6Vh0EEL7bUAPTJZUInEOpxSw4T1gQFr1PDizYOk9PsS2//dU8r0K4d0 IOSzTpEDN37RfB7pCCU1JKpni1qT+2LzZO7E8gTmMtTdkAx92v0P4CaagUfd/fm3TTZvHXaxu 18PMHGaOOvyDOMUweiPAYKb9PafhyROp9oyAhnF0X2AIkjJ2L38Z07cocEsVBPD0qLiRc5IsR lG5wDVNyaIZXkrV22KaMPoElrqXg77ophg/6TvvyKuy8er9UyUBUSl+esTSZjVrlkRDrDZkov 78IBuGp2MGOFwH4eKiBGl8/DRPgFw2uNTZ+YnXjYNuKgDia0ZbojcSR/UcOUF1ZLh+l3EYuG6 kFbi9J6Gl2owiwFjp8OjNQ8hwagwjc+fIH359THoAqp6Acb6RlQVvUud8V5vB7DN0gJPin24Z X9+UK+GLo5+n0G5YPFkCs9ZmmZKb5lVLGDZWzeBbE+gSBjAddL29gyOFlXhF5Glnxmx2di1yW aQ4J/0ZSnNPHGvdO2Htl9FZWfEhtS0J5a7iVSlOTa6ZSGX/aJWUtRLDHPA/N9eV3MIxq2Pr50 CAqL0gFzN3JRdbt70nzZoSF+4/0I3qBwwPTxK6H237FTG9VaNZHrH6kI7mls87yhL+ydq+KNN DM7gSCORXWsahFtl5+JggQrg9pBbI9ln9zI2TshTg7apatsvwKI2WM71aJ+XEXIdJJeMqHxT Received-SPF: pass client-ip=212.227.17.21; 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, 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:144393 Archived-At: On Sat, 22 Jul 2023 20:24:16 +0000 Heime wrote: > ------- Original Message ------- > On Sunday, July 23rd, 2023 at 8:14 AM, Stephen Berman wrote: > > >> On Sat, 22 Jul 2023 19:18:03 +0000 Heime heimeborgia@protonmail.com wrot= e: >>=20 >> > ------- Original Message ------- >> > On Sunday, July 23rd, 2023 at 2:40 AM, Heime heimeborgia@protonmail.co= m wrote: >> >=20 >> > > I want to use a button to display the contents of a variable inside >> > > a help buffer, but the following gives >> > >=20 >> > > (wrong-number-of-arguments ((t) nil "Function to be executed when th= e 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 >>=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 > > I do not understand the reason it expects an argument. 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: =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. > Would there be > a more suitable way to print some text after pressing the button ? 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. Steve Berman