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: Making alist that executes multiple commands Date: Mon, 25 Nov 2024 00:28:52 +0100 Message-ID: <87sergrz2j.fsf@gmx.net> References: <87wmgss0k6.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="20681"; 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 Mon Nov 25 00:29:55 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 1tFM39-0005AP-1K for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 25 Nov 2024 00:29:55 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFM2G-0002S2-1S; Sun, 24 Nov 2024 18:29:00 -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 1tFM2E-0002Rg-7q for help-gnu-emacs@gnu.org; Sun, 24 Nov 2024 18:28:58 -0500 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 1tFM2C-0004rx-AM for help-gnu-emacs@gnu.org; Sun, 24 Nov 2024 18:28:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1732490933; x=1733095733; i=stephen.berman@gmx.net; bh=RviNNSPQbJabN/EZPcpoEZB+MnOgGmQKm3fKOZkBtoU=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=C2d5+DiRqc/RBb+Y6xx49N/9urthE77ZgYh3QFp4G6K01WyHroezCxh1aNrRQR2D kXrCGRa58m9NKZh1acOLAp7CO4NEbdTGrip9FduNaQd8f9QvLTuTlP9xK3LoKdy7B MOfk/0RYKnGmygrNg6LQh55dl0IPpfy4sNdX5fGCP5PANVUyAmvtoe5HK3Yl9mSHB jHzenXXf8ZaewXJjZXBYZAMH2lEamlNjAFikrHh7vVHYR2i9dJBuJ4XIuAIH3k4Fj Pldx/yBnZ06LWyzbn1rsFSV7QCVZrGxQeiu/rGehdgT1qSi333Uh12KptBqVMM0KT DLGGlOuxZp3dpuVytg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfssd ([94.134.95.109]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mlw3X-1twLws05Mx-00jo3q; Mon, 25 Nov 2024 00:28:53 +0100 In-Reply-To: (Heime's message of "Sun, 24 Nov 2024 23:13:51 +0000") X-Provags-ID: V03:K1:LCGL5nP1ymRp+qgGxoWY19Mt7FJriEXSNUBUzMoZ/r4vrSL+BFf ZaqiFJuw+dq667sgkEJLLdeNJS43EzMv+vjI4lvyDh5SUW+w88YkDr5mIlqFVYxlxNCCzr0 K4bbBQBzg10KsTPn5LWzsQqEvOJmPasyAkItl6rDEDkjrhKuK3vouhZ0erfPUGSvj96XTca uZrX53ScjQfH5m+DjU86Q== UI-OutboundReport: notjunk:1;M01:P0:8Nv387RbnV8=;+JkbwUObWz/IPdVcMrKOqWtmGQH yOeLsTRU4bZFeZLWdBTXHStJySZ7N0pzdkFpIlagm1IX0WA09PpsZCk66l7b7Hg7afZHmFTbQ e8BlMQRxpY5cPrlFb5p51INNaOyIxfKC6l8PbB+LSyB3o48NUvCf4p+jwSkj9cEtZL4e5b/GX Q+Bss4R4Utut0lEw6Lt8WLEO+hfnzyn6DSyhSu1uAp8jedrZVkCFeGtjrLh5vBH82qkU/mXUr T/ZqzPZs0IrdB71NroGKLNupeUfQz2kjsyPmVpJd3gnvp+YnMnMEwm8mO2iThoaW6/Da4Qoaa c1qHMsX+edvM/LZ+96iUiP0mudxEnTb8jtu7EcbQa7kzDbFT8K3mIc5d/gSRXCl9GI/O8U/O3 t/0tP9ZpFO1bNPSuuA+3zzuM4B1CFPs9t+lE5gpeeQQLqjDrHGhufoDLRhtCgaX66o53uYvTw bLr02SlC5DSbma/egv1FFkHFu8lfAKb8za+r6Nwv+hHN5E66Qr3tbVDizdkOw0PwHflqI1iP9 qNzI5WKaWMrS191Wa0ysoQ389wX+bo9XVPv3T+2tFSLFIRjD/96Mx0oWW2EJqTzoZ+qy34zH9 nktkjKLMX9s4w3pW/wfi7abTQz4f62QjnYGZRkFHF53vuAfzePvp3GXkTR7juiVmH9eDWdqUa CQEAzgvPRUxLiVjOKQmOqDxmoOzRQtWWFuw7l3XwA9vcnQooQJ4MBiM+kF6tV071cxGyMEoto Xv1uDr1499MTUFDeOaCZHzEbrpwzBpG7EmwlvVEpKL8KvQE0iE6ACnt0up0qRAnaoZsE8v3v 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=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:148381 Archived-At: On Sun, 24 Nov 2024 23:13:51 +0000 Heime wrot= e: > On Monday, November 25th, 2024 at 10:56 AM, Stephen Berman > wrote: > >> On Sun, 24 Nov 2024 21:51:38 +0000 Heime via Users list for the GNU Ema= cs >> text editor help-gnu-emacs@gnu.org wrote: >> >> > What changes can I make to the following to allow me to execute more >> > commands than just one (as in alkotr-ar and alkotr-go). >> > >> > For ar I want to call functions alkotr-ar and alkotr-af >> > >> > (let ( (lookup-alist >> > '((ar . alkotr-ar) >> > (go . alkotr-go)))) >> > >> > (dolist (actm symbol-list) >> > (let ((func (cdr (assoc actm lookup-alist)))) >> > (if func >> > (funcall func) >> > (message "ACTM Unrecognised: %s%s" "'" actm))))) >> >> >> Something like this: >> >> (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))))))) >> >> Steve Berman > > Have thought about this. Any criticisms about it? > > '((ar . (lambda () > (alkotr-ar) > (alkotr-af))) > > (go . (lambda () > (alkotr-go) > (alkotr-gc)))) That seems fine if the functions take no arguments, though probably not as flexible as looping over a list. > What would you suggest for function commands requiring arguments, > e.g. (alkotr-ar ar) and (alkotr-af af)? (funcall 'alkotr-ar ar) (funcall 'alkotr-ar af) Steve Berman