From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Heime via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: Making alist that executes multiple commands Date: Mon, 25 Nov 2024 01:05:10 +0000 Message-ID: References: <87wmgss0k6.fsf@gmx.net> <87sergrz2j.fsf@gmx.net> Reply-To: Heime 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="27533"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stephen Berman , 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 Mon Nov 25 02:06:08 2024 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 1tFNYG-0006y1-6Z for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 25 Nov 2024 02:06:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFNXW-0006zc-KS; Sun, 24 Nov 2024 20:05:22 -0500 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 1tFNXU-0006zT-Ng for help-gnu-emacs@gnu.org; Sun, 24 Nov 2024 20:05:20 -0500 Original-Received: from mail-4325.protonmail.ch ([185.70.43.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tFNXS-0007Nx-IG for help-gnu-emacs@gnu.org; Sun, 24 Nov 2024 20:05:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1732496715; x=1732755915; bh=6SGIc+Rh5gMSEuMaXWatvVlXx+nL1r/WInuSqRPOsYY=; 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:List-Unsubscribe:List-Unsubscribe-Post; b=hykNAN5/Xvz4Aebo5O0eaz2FIGefTZLNXMwBQ0C3iTlLhfVmGPjqvN76wWeIalRzW 3ZxrAL1MyAfSgxvONnDptFf2J/kE17ZVDSNotkVwtcC4sFdg2onQAVe1tlTuU6NDLK 4+aMwVxmOaxsGugwBjcXVhrcUG8W+JM5MRxBLeT3TC5ieyjPFWDo0ZMUMZoKAnj5xq ogjtRT+mKGrcO848m+oBl6M/oozUlKkmAd0KzisT5pPiFBnjRbLDmDbzeL5eJUI9zs LoeL5IknqrWLOirDs8j3OpfdgCjdETYiuY5CcrpwhBZITQNxDco3PRWAju8csPPr4S sMeDta/06gq9Q== In-Reply-To: Feedback-ID: 57735886:user:proton X-Pm-Message-ID: 87e7de7f3516aa87a3e4b22c0a82b8a7d773f3f6 Received-SPF: pass client-ip=185.70.43.25; envelope-from=heimeborgia@protonmail.com; helo=mail-4325.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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, TO_EQ_FM_DIRECT_MX=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:148383 Archived-At: On Monday, November 25th, 2024 at 11:39 AM, Heime via Users list for the GN= U Emacs text editor wrote: =20 > Sent with Proton Mail secure email. >=20 > On Monday, November 25th, 2024 at 11:28 AM, Stephen Berman stephen.berman= @gmx.net wrote: >=20 > > On Sun, 24 Nov 2024 23:13:51 +0000 Heime heimeborgia@protonmail.com wro= te: > >=20 > > > On Monday, November 25th, 2024 at 10:56 AM, Stephen Berman > > > stephen.berman@gmx.net wrote: > > >=20 > > > > On Sun, 24 Nov 2024 21:51:38 +0000 Heime via Users list for the GNU= Emacs > > > > text editor help-gnu-emacs@gnu.org wrote: > > > >=20 > > > > > What changes can I make to the following to allow me to execute m= ore > > > > > commands than just one (as in alkotr-ar and alkotr-go). > > > > >=20 > > > > > For ar I want to call functions alkotr-ar and alkotr-af > > > > >=20 > > > > > (let ( (lookup-alist > > > > > '((ar . alkotr-ar) > > > > > (go . alkotr-go)))) > > > > >=20 > > > > > (dolist (actm symbol-list) > > > > > (let ((func (cdr (assoc actm lookup-alist)))) > > > > > (if func > > > > > (funcall func) > > > > > (message "ACTM Unrecognised: %s%s" "'" actm))))) > > > >=20 > > > > Something like this: > > > >=20 > > > > (let ((symbol-list '(ar go)) > > > > (lookup-alist '((ar alkotr-ar alkotr-af) > > > > (go alkotr-go alkotr-gc)))) > > > > (dolist (actm symbol-list) > > > > (let ((fnlist (cdr (assoc actm lookup-alist)))) > > > > (while fnlist > > > > (let ((func (pop fnlist))) > > > > (if (functionp func) > > > > (funcall func) > > > > (message "ACTM Unrecognised: %s%s" "'" actm))))))) > > > >=20 > > > > Steve Berman > > >=20 > > > Have thought about this. Any criticisms about it? > > >=20 > > > '((ar . (lambda () > > > (alkotr-ar) > > > (alkotr-af))) > > >=20 > > > (go . (lambda () > > > (alkotr-go) > > > (alkotr-gc)))) > >=20 > > That seems fine if the functions take no arguments, though probably not > > as flexible as looping over a list. >=20 >=20 > Could you explain? Can't I do >=20 > (go . (lambda () > (alkotr-go go) > (alkotr-gc gc)) >=20 > > > What would you suggest for function commands requiring arguments, > > > e.g. (alkotr-ar ar) and (alkotr-af af)? > >=20 > > (funcall 'alkotr-ar ar) > > (funcall 'alkotr-ar af) >=20 >=20 > How would the above solution fit with argument incorporation within > lookup-alist? Does one use=20 (lookup-alist '( (ar (alkotr-ar arg-ar) (alkotr-af arg-af)) (go (alkotr-go arg-go) (alkotr-gc arg-gc))) ))