From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Heime Newsgroups: gmane.emacs.help Subject: RE: [External] : Re: Passing result of macroexpand-all as argument to a function Date: Wed, 09 Aug 2023 02:53:41 +0000 Message-ID: <8jYTST4ZkiHwzpQf6qnWQ9vjFoSbMlhTJmH2ReO4KSw0O0PHGXhtGaGvsT6fugo3G-ibKDxfXErDu5mRKvFdKGhGitKSXiHKAB7pomMnt8w=@protonmail.com> References: <7UdMwafROXrUj4VaBblHwkDb-7OTPRW1sNmYNp-sgDXy8OcnRSi5lVBqSH6paHUUhAFI4k2PczFtkC6qIZVFnFRxmlB5GVn-AljwKbn_JcI=@protonmail.com> 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="27869"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Pierre Rouleau , Heime via Users list for the GNU Emacs text editor To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 09 04:54:35 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 1qTZLG-00072H-Jk for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 09 Aug 2023 04:54:34 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qTZKd-0005d7-0m; Tue, 08 Aug 2023 22:53:55 -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 1qTZKZ-0005cp-Ip for help-gnu-emacs@gnu.org; Tue, 08 Aug 2023 22:53:52 -0400 Original-Received: from mail-4318.protonmail.ch ([185.70.43.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qTZKX-0008I4-KU for help-gnu-emacs@gnu.org; Tue, 08 Aug 2023 22:53:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1691549627; x=1691808827; bh=4sGwQcxbZ05M5RDZYWMXPmuopUE6hVAs0SlrQIWbUv8=; 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; b=nxiympJJda/ndPS/5l57h55b6i1S9EQ4u/zERhdQN0TOn/HlEqCs0donWZWBZNIPr 57okCY/2eBFBGK+6620G51yJvlxwTrd2qmS83tlYt6xOPhTbBrD0XXnkEhLPTiyXHX 3Eq2Oyi6OgVuiNT2dZ10cqTBKtPTZZZMJGHoYQwxvsR4NPZ7WwXe4ZWjTz74Vj2GTj R4W2M7yHtNBZur8FrgDc3t8owZBxA1duy/PPvjVCI5cyoGRWld/4vMkMz8prqokS7y jGihOYB3el+1G2M47j8AHDGy+H7k11OvhkKwcet24nf+ZK3h8zw+ZhvsikBX8jNQyA OGV9B91znY/nA== In-Reply-To: Feedback-ID: 57735886:user:proton Received-SPF: pass client-ip=185.70.43.18; envelope-from=heimeborgia@protonmail.com; helo=mail-4318.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, 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:144704 Archived-At: ------- Original Message ------- On Wednesday, August 9th, 2023 at 2:27 PM, Drew Adams wrote: > > > > 1- What is the problem that you are trying to solve? > > >=20 > > > 2- If you want to pass something to a function and you want that > > > something > > > not evaluated, then: quote it. The function can later evaluate it if = it > > > needs to extract the result of the expression, or it can print it usi= ng > > > a > > > string formatting function. > > >=20 > > > 3- If #2 is not clear, reading a LISP tutorial will help. Investing t= ime > > > reading on LISP and Emacs Lisp will help a lot. > >=20 > > I am going to pass > > (myfunc (macroexpand-all something arg) bfname) > >=20 > > How would I define myfunc ? > >=20 > > Will (macroexpand-all something arg) be in a form of a list (list of na= mes > > and arguments) or what ? >=20 >=20 > As several have said, a Lisp macro takes a list sexp that has a symbol ca= r, that is, something that looks like a function call: (foo...), and it ret= urns a Lisp form - pretty much any kind of Lisp object you like: a string, = a symbol, a list, a vector, a character or other number. >=20 > `macroexpand-all` just expands the macro calls at all levels of its FORM = argument: the topmost sexp and any sexps inside it - all the way down. >=20 > You've already been told that if you want to pass a Lisp object to a func= tion without it being evaluated then quote it. >=20 > Since you want `macroexpand-all' to first expand your` something' form, y= ou want to quote it after evaluating the `macroexpand-all' call. How to do = that is the among the FAQiest FAQs: https://emacs.stackexchange.com/q/7481 = IOW, (myfunc` ,(macroexpand-all something arg)) Did not occur to me to quote it. Still I know what quoting means. I want to pass other variables to my function, example a a buffer name like= so (myfunc ` ,(macroexpand-all something arg) bfname) So you want to quote it, but then execute macroexpand-all What I am worried about is this. Would myfunc get confused when the code o= f=20 macroexpand-all ends and when bfname starts ? If I understand correctly, just calling would get the result from=20 (macroexpand-all something arg) but then evaluate it because the macro=20 code changes in context when used as an argument to a function. (myfunc (macroexpand-all something arg) bfname) =20 > As many have suggested to you ... the Elisp Intro manual is your friend, = as is=20 > the Elisp manual. It has a wealth of clear explanation and unlimited pati= ence. I just say things how they are. If I do not understand and the manual is o= f no help (to me of course), no amount of abuse from anyone will convince my understa= nding. If you want to help someone, one should not expect a certain result. Becau= se the result is not up to you. The result is determined by the person who receiv= es it.