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 button-label in pcase Date: Mon, 24 Jul 2023 23:51:32 +0200 Message-ID: <87lef5vuzf.fsf@gmx.net> References: <87pm4hvztc.fsf@gmx.net> 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="39886"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: uzibalqa via Users list for the GNU Emacs text editor To: uzibalqa Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jul 24 23:52:18 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 1qO3TT-000A6k-3S for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 24 Jul 2023 23:52:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qO3Su-00079c-7G; Mon, 24 Jul 2023 17:51:40 -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 1qO3Ss-00079F-Kg for help-gnu-emacs@gnu.org; Mon, 24 Jul 2023 17:51:38 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qO3Sq-0004p6-Nh for help-gnu-emacs@gnu.org; Mon, 24 Jul 2023 17:51:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1690235492; x=1690840292; i=stephen.berman@gmx.net; bh=4cKuFDuNyo8Xa7UzordK4yBi/mxnsCNMOLM0Z/xTC34=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=MDKpdB6uTXPVWbAfakq8BZzqHTfGTdFjd9srXYzvzMgBp7nynXiQgHsULU2ZPwv2ipOs/Gv TLcyVymUr4eBVAzrfa5AaEXAyL1H49Q8ZeNED4Mtbvxa5yw779xhbw+Th3GO22hy0L466zZ4W xBX39QNnGxZrxa02d8Ay5MYJLRI9WgGLokYs5hCQ4UNAWCQeY5ZI5SY4rhozRDQf8uAFBupSO brSwLbdUCq/qb3GDrNi/OaGotLDyXsmh+vR7jT2wYClERQ3x7qHEUquEfTdncGKBWbPyTWDGT aAt6oiD2CsZYdVgVfxJT6Fx/Q2LNOLEphzpw/N92VvYcCFdaTDHw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfssd ([94.134.196.126]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mk0NU-1pdh9Q2x7Q-00kOQn; Mon, 24 Jul 2023 23:51:32 +0200 In-Reply-To: (uzibalqa@proton.me's message of "Mon, 24 Jul 2023 21:35:44 +0000") X-Provags-ID: V03:K1:vhRV6paZLE6FjWnqVpsvmIfgLnTlKd1VnOcSDiF3Bo2on3k+A67 HxZXJlq+f5dLaTZzxlGws4ad4QGMJnEYXVjibHeaplvhJTxumj1gmypJBE8KU24Qp27P6AS pY2ModJ6n0Rc6DqSORu9NyCSbZpmEG3x1tlxgUl0dIAatnLOSOHsC4JRJoFX3C6pRkZlJKJ RPfBW4j1Lsd/Rj/sbo2pQ== UI-OutboundReport: notjunk:1;M01:P0:ab5kzE8xHxY=;BWX9FGW1J9vowZLx3a9WGGjMbfb Y3f8/9r1or464IJid3Qen10TZijy2Tu2oQhq2VNb3fI+7mxVecobd4Y0x0lP1DkCXYkFDKBqT UK3FhE/9uQwHGydsdcA89Ux7NhH+E9U72UHv82QkIA6dYgzbCqwkk8JQMnZgdQGDnqJpW3e/R F3l55nOXjJs1W4PeY2SGrZhw9OhY/bI9Sv6sFroZGwEHOtVv/2mk0NBCgMBMrIepbXqlzGRZS fVvUJaNLHN370FiP1BjKGIXkVcQXBEJNsgp8AT5X+4qysgiQ3lkaVC+T3TyRsHgx+ItFZYa93 w0NpcCu1+HOqlsngnwMdLbPC8d2Pe6ItJ7kZqmgNsrVYC/qRRoQ/mknVbNsHk0+9ECiKyyk72 rMDpff8IKFtO18IuDNpCKok5eWr24inGfJsngMErBNqSrPiZTRLAERKLIn8bFOnBmNVsfvNP9 09EuystMdsvq8DRdoqQ6gHGf5odX1p3Ezaht0OubdjDiaTEkXOhz+CC/VjVIDslz+xKrjhpu/ OL12DMEhUIufZ4bXerVxEnQJTCEE73mgC/UGPmwChhbWp8wpKbW0EI8X67cIwc0HojBm485EO scmyQBIB/7KkEmks6eHj+dv6HqMR0ZgXt9zy7Q8C02fc9b3C7UA6sxqGFXixZz5+NQFeW2dKu xeo4kSQTLk2D2fHW1bZ+gOup7ohE00ObTLxK4SCYtY+FXopP/C/VFPzBpNb7gpiQN/eKnPcBR 5ULfJ2gQyxhsnvXdHeHzIIOVDq5zA/PW6dmvKIWArFiid8FCrVUbi56Ca/+UkG7+DqAqDwTU Received-SPF: pass client-ip=212.227.17.20; 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:144429 Archived-At: On Mon, 24 Jul 2023 21:35:44 +0000 uzibalqa wrote: > ------- Original Message ------- > On Tuesday, July 25th, 2023 at 8:07 AM, Stephen Berman > wrote: > > >> On Mon, 24 Jul 2023 19:14:27 +0000 uzibalqa uzibalqa@proton.me wrote: >> >> > Want to print some text as a result of clicking a button. With the co= de below >> > I end up with >> > >> > (wrong-type-argument integer-or-marker-p nil) >> > buffer-substring-no-properties(nil nil) >> > button-label(#) >> > (let* ((val (button-label button))) (if (equal val '"[FA]") (let nil >> > (insert qrh-c)))) >> > (closure ((button . #)) nil (let* ((val >> > (button-label button))) (if (equal val '"[FA]") (let nil (insert >> > qrh-c)))))() >> > help--window-setup("Help" (closure ((button . #= )) >> > nil (let* ((val (button-label button))) (if (equal val '"[FA]") (let = nil >> > (insert qrh-c)))))) >> > qrh-b(#) >> > button-activate(# t) >> > push-button(3 t) >> > >> > What is going on. Is there a fix? >> > >> > (defconst qrh-c "[FA] Some Text") >> > >> > (defun qrh-b (button) >> > "Prints information about how to install emacs." >> > (with-help-window (help-buffer) >> > (pcase (button-label button) >> > ("[FA]" (insert qrh-c))) )) >> > >> > (defun qrh-a () >> > "Prints information about how to install emacs." >> > (interactive) >> > (with-help-window (help-buffer) >> > (insert-button "[FC]" >> > 'action 'qrh-b 'follow-link t) )) >> >> The error is raised because qrh-b calls with-help-window with the Help >> buffer current, but with-help-window erases the buffer, so when >> `(button-label button)' is evaluated, there is no button and this >> signals the error. > > That what was wrong then. That there was no button. When you execute your command qrh-a and then in the resulting *Help* buffer press the button, it disappears. >> If you want to use the existing Help buffer, just remove the call to >> with-help-window in qrh-b. > > >> However, Help buffers are read-only, so >> trying to insert text will raise another error. To avoid this, you can >> let-bind buffer-read-only in qrh-b. > > I do not experience the problem you mention. What error are you referri= ng to, > and how can it be triggered ? Did you remove the call the with-help-window in qrh-b and correct the match condtion (or change the string in qrh-a to match the one in qrh-b)? If so, then when you press the button in the *Help* buffer, you will get the error "Buffer is read-only: #". Steve Berman