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: Sun, 24 Nov 2024 23:39:59 +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="16781"; 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 Mon Nov 25 00:40:40 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 1tFMDX-0004Dd-Tg for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 25 Nov 2024 00:40:39 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFMD5-0004es-3Y; Sun, 24 Nov 2024 18:40:11 -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 1tFMD3-0004eA-Cw for help-gnu-emacs@gnu.org; Sun, 24 Nov 2024 18:40:09 -0500 Original-Received: from mail-43166.protonmail.ch ([185.70.43.166]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tFMD0-0006Ff-L8 for help-gnu-emacs@gnu.org; Sun, 24 Nov 2024 18:40:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1732491604; x=1732750804; bh=3CRzL1abOQg4qk2SW9fo0JsZMgthTAvvnIPK6oKocvA=; 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=HZGuzQPDqaEG8p/R79sSLl/6kHVIrpCJkUpUAEUIYoCUKB+/or9iNgvi87+vvi9Ng SoEALxXYgLZlunysdwqa9gjGfMCp0uYfQSJSYuUYNaYpKU5pATCaRyI0oobwSulGI6 0xnINpT1dYRsiKucxcwkhzTB1Lsz/C3B8nJxnMBtvc/XUOKPBPEvtPWtKLbSB6tdld tdFVNRP2ouSF5CqnN11qpf8uLPrIl8p1YDMBuhAAZN2oQbZ8wHRrv9EnETGCrmfrDB 1C0ZHA0lIwV6V7UT5VngNIYazReR9guB2jpX9J/Ar2FsWiQo1NclqPUAUt0QuQwv8B xYZ/nWvB21HOQ== In-Reply-To: <87sergrz2j.fsf@gmx.net> Feedback-ID: 57735886:user:proton X-Pm-Message-ID: a1fd693f409017e688e9f52060ea677fe60103b0 Received-SPF: pass client-ip=185.70.43.166; envelope-from=heimeborgia@protonmail.com; helo=mail-43166.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 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:148382 Archived-At: Sent with Proton Mail secure email. On Monday, November 25th, 2024 at 11:28 AM, Stephen Berman wrote: > On Sun, 24 Nov 2024 23:13:51 +0000 Heime heimeborgia@protonmail.com wrote= : >=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 E= macs > > > text editor help-gnu-emacs@gnu.org wrote: > > >=20 > > > > What changes can I make to the following to allow me to execute mor= e > > > > 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 >=20 > That seems fine if the functions take no arguments, though probably not > as flexible as looping over a list. Could you explain? Can't I do=20 (go . (lambda () (alkotr-go go) (alkotr-gc gc)) > > What would you suggest for function commands requiring arguments, > > e.g. (alkotr-ar ar) and (alkotr-af af)? >=20 >=20 > (funcall 'alkotr-ar ar) > (funcall 'alkotr-ar af) =20 How would the above solution fit with argument incorporation within lookup-alist?