From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: uzibalqa Newsgroups: gmane.emacs.help Subject: Design of interactive function with buttons in help-buffer Date: Wed, 30 Aug 2023 03:08:29 +0000 Message-ID: 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="40041"; mail-complaints-to="usenet@ciao.gmane.io" To: uzibalqa via Users list for the GNU Emacs text editor Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 30 05:09:43 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 1qbBaR-000AFc-IZ for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 30 Aug 2023 05:09:43 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbBZd-0002cJ-OU; Tue, 29 Aug 2023 23:08:53 -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 1qbBZb-0002cA-SL for help-gnu-emacs@gnu.org; Tue, 29 Aug 2023 23:08:52 -0400 Original-Received: from mail-40137.protonmail.ch ([185.70.40.137]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbBZW-00017z-QF for help-gnu-emacs@gnu.org; Tue, 29 Aug 2023 23:08:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=crkgiqd2n5esnb5il7fko7nv3e.protonmail; t=1693364921; x=1693624121; bh=iNA1brvGw7H8IDLynUpyknauoGnqgZlh9D81W4mp1DY=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=gkHzi/5D2kdDalW4uh+golKo7BXOUqyAs+Ftn7dKJWtR5Vw/13V40DEZVONo/Gly6 ra41Btt/3udwiPAofT6caQhRKHqWAt5iEiqgGHLBet/GWP0hL0SqoV8YJiMHojEMPy UHF1RBH0/vcbtQvbSfv/U12aK05ZydEMQWlkrZZDZQ3X57q/VrTrjut5mUkTK6fw2o h0NA9obMBQbr1YAmOu7wQvHmozAA8WKtOcQCQ9Qpyu0BfdF+qkq1l0tGqt7hG5AP2p +sbj9NmmTERU2tj0hrWj9mH1brzfAPxu2Un2DAAOaLNYIhdEfeikyCBRvfUSdrfszW RB9aKj4de269w== Feedback-ID: 52887082:user:proton Received-SPF: pass client-ip=185.70.40.137; envelope-from=uzibalqa@proton.me; helo=mail-40137.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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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:145022 Archived-At: I need some suggestions regarding the following code - so that I simplify i= t and enhance it. qrh-organis is the interactive call for users. =20 I pass button as argument to organis-selk, which is then passed to=20 organis-selk-f8, organis-selk-b8, and organis-selk-menu. Is such strategy = a good way or can all this be improved in its design ? (defconst organis-b8 "\n Some text \n") (defconst organis-b8 "\n Some more text \n") (defun organis-selk-f8 (button) "Function to be executed when the button is clicked." (with-help-window (help-buffer) (insert " > Graphical Organisation \n") (insert " ") (insert-button "[Next]" 'action 'organis-selk-b8 'follow-link t) (insert " *** \n") (insert organis-f8))) (defun organis-selk-b8 (button) "Function to be executed when the button is clicked." (with-help-window (help-buffer) (insert-button "[Prev]" 'action 'organis-selk-f8 'follow-link t) (insert " Frames, Windows, Buffers\n") (insert organis-b8))) (defun organis-selk-menu (button) "Function to be executed when the button is clicked." (with-help-window (help-buffer) (insert-button "[F8]" 'action 'organis-selk-f8 'follow-link t) (insert " Frames, Windows, Buffers \n") (insert-button "[B8]" 'action 'organis-selk-b8 'follow-link t) (insert " *** \n"))) (defun organis-selk (button) "Function to be executed when the button is clicked." (pcase (button-label button) ; Test button property first ("[F8]" (organis-selk-f8 button)) ("[B8]" (organis-selk-b8 button)) (_ (organis-selk-menu button))) ) (defun qrh-organis () "Prints information about frames." (interactive) (with-help-window (help-buffer) (insert-button "[F8]" 'action 'organis-selk 'follow-link t) (insert " Frames, Windows, Buffers \n") (insert-button "[B8]" 'action 'organis-selk 'follow-link t) (insert " *** \n") )) =20