From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#64584: 29.0.91; skeleton: cannot pass `str' as argument to some functions Date: Tue, 12 Sep 2023 09:08:09 -0400 Message-ID: References: <87y1jloyao.fsf@gmail.com> <87fs3klos4.fsf@gmail.com> <87bke8kthy.fsf@gmail.com> <87y1hbk2ab.fsf@gmail.com> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17010"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 64584@debbugs.gnu.org To: Visuwesh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 12 16:13:43 2023 Return-path: Envelope-to: geb-bug-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 1qg499-0004ES-GS for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Sep 2023 16:13:43 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qg38W-0002Mx-80; Tue, 12 Sep 2023 09:09:00 -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 1qg38V-0002Mm-1i for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 09:08:59 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qg38U-0003LT-Ii for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 09:08:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qg38Y-0004I4-3F for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 09:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Sep 2023 13:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64584 X-GNU-PR-Package: emacs Original-Received: via spool by 64584-submit@debbugs.gnu.org id=B64584.169452410616447 (code B ref 64584); Tue, 12 Sep 2023 13:09:02 +0000 Original-Received: (at 64584) by debbugs.gnu.org; 12 Sep 2023 13:08:26 +0000 Original-Received: from localhost ([127.0.0.1]:56464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qg37x-0004HC-Rg for submit@debbugs.gnu.org; Tue, 12 Sep 2023 09:08:26 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:37252) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qg37u-0004Gx-8W for 64584@debbugs.gnu.org; Tue, 12 Sep 2023 09:08:24 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id EF74580762; Tue, 12 Sep 2023 09:08:11 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1694524090; bh=TH0UjUDpSKVapUQ8VvYzbE5JvnjFKGzOyaZFMzXzTMg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=XpA0ZCzSSm8LBFWCDZAidxl3Kceo+k9CjLZkJ7398rGUpADVNlaswaMmn3mSWTzfm BowhQO4Tn7kWqMIiPvXj33+Jt0zr/i30O/ufYcA/KqLbnQcz5GBbty1jypu4amWz8W yAQy3MKCDr0iacHgjX3MqNNytEBztBhKK1QjQDVl5fkFOHX2bZHap+hLEaKimHCWWr j6ZFr+XOixTxY/Q1wIxEpb3FHgq50zEcInPDG0zsBEqjW9+ZDFMcpCR5+bEBuKZeHF nszLbkY3bVWbtnI+DwV9taBMS1kAd8XeRsjma6FnJISeTdjkJ7G6EA5fuEv31Hk+G3 ddZU/o085pxbQ== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id B825F804F6; Tue, 12 Sep 2023 09:08:10 -0400 (EDT) Original-Received: from pastel (unknown [104.247.229.91]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 972681203DD; Tue, 12 Sep 2023 09:08:10 -0400 (EDT) In-Reply-To: <87y1hbk2ab.fsf@gmail.com> (Visuwesh's message of "Tue, 12 Sep 2023 17:54:12 +0530") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270178 Archived-At: > Yes, but here it basically does nothing unfortunately. I am not sure if > > 'str > > should have the side effect of setting that variable. The above skeleton expression means "eval the variable `str` and throw away the result". The only effect it can have is to signal an error if the variable `str` is not bound. > (defmacro vz/snippet-when (form &rest body) > "Evaluate BODY if FORM returns non-nil or non-empty string." > (declare (indent 1) (debug (form body))) > `(let ((str ,form)) > (if (and str (equal str "")) > "" > ,@body))) FWIW, this style of macro is usually called "anaphoric macro" and the convention is to use the identifier `it` rather than `str` in them. It would help avoid a confusion between skeleton's `str` and your macro's variable. [ And, yes, arguably, `define-skeleton` could be considered as an anaphoric macro as well which should use `it` instead of `str`, bringing back the confusion :-) ] Stefan