From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#64584: 29.0.91; skeleton: cannot pass `str' as argument to some functions Date: Tue, 12 Sep 2023 20:20:56 +0530 Message-ID: <87ttrzjvhr.fsf@gmail.com> References: <87y1jloyao.fsf@gmail.com> <87fs3klos4.fsf@gmail.com> <87bke8kthy.fsf@gmail.com> <87y1hbk2ab.fsf@gmail.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="24501"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 64584@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 12 16:52:50 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 1qg4l0-0006Di-3v for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Sep 2023 16:52:50 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qg4kI-000296-Lp; Tue, 12 Sep 2023 10:52:06 -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 1qg4kA-00021b-TS for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 10:51: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 1qg4kA-0008Go-F9 for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 10:51:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qg4kF-0008D7-4N for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 10:52:03 -0400 Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Sep 2023 14:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 64584 X-GNU-PR-Package: emacs Mail-Followup-To: 64584@debbugs.gnu.org, visuweshm@gmail.com, visuweshm@gmail.com Original-Received: via spool by 64584-done@debbugs.gnu.org id=D64584.169453027631492 (code D ref 64584); Tue, 12 Sep 2023 14:52:02 +0000 Original-Received: (at 64584-done) by debbugs.gnu.org; 12 Sep 2023 14:51:16 +0000 Original-Received: from localhost ([127.0.0.1]:59781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qg4jU-0008Bm-By for submit@debbugs.gnu.org; Tue, 12 Sep 2023 10:51:16 -0400 Original-Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:61882) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qg4jS-0008BS-B2; Tue, 12 Sep 2023 10:51:15 -0400 Original-Received: by mail-pl1-x642.google.com with SMTP id d9443c01a7336-1c34c9cc9b9so40680035ad.3; Tue, 12 Sep 2023 07:51:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694530263; x=1695135063; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:references :message-id:date:in-reply-to:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=xVlQb+KPIyDOhZ5wltFqLcMHo7RkAZRdc06VcJUeqtE=; b=hHM+OlgA+bGPwzwKbA3liIY7qwJ+0/LmMxGZhRrFokuHzzWMQhqFU9zIkgY/Ia9XvF itrHLPJMXgByRhDK6YjlF5hN9pqrs2yXHmVZdRoncTo9awgmdXLVXoednjapisBonjE8 KwLGvOxDs4lPgFkOOzNYyBh0jdUflXyp2jQSB2y3xqgsFmNQI2bux44kJng6mja55kX1 Ydqx4CqenZlEHr70+PAj62URA73dC0BnzzElmplpZiyWshXUNu6tLamI+nsWWJ7nV4lj lNxhV020940kpXysENS0ORA351GsS2iorsedFbRvBPIv0opUQVDiGsjjj1jiyUM+Utjj KH/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694530263; x=1695135063; h=content-transfer-encoding:mime-version:user-agent:references :message-id:date:in-reply-to:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=xVlQb+KPIyDOhZ5wltFqLcMHo7RkAZRdc06VcJUeqtE=; b=Yh0K1mBZoyqpH0aXGBZQ5wdCVKLd8GPEMW3egMaHJi/Z7MbmPyaPuW1EzwoKS870fv PAVG06bgHQ126M14mA7N9pC1YcetS6ODqMFWgBXKIflzwGxTPPo6aju7S8Pr4x9G7hrw RuCn7YgxpVYFj1yUr4sbz6XFOlGGJ1eoHBAKf1zT5SrSVwtczZaf6nm9m5/JwT1xQuv1 dLzMNGB+KVCiuc0ika+MQTqJBnurGabnm46cfKruX7Rf5M2aZqFzclOyKmbdW3xm6GYV LH/04IoD/O6HxCTi9fjqnSZk6ntQxMaL233/7+1EIPy4riM4+dvFETM7gpKJQvnsFch8 AXrQ== X-Gm-Message-State: AOJu0YzKsT+qB2CwjYD8omnm5uzKmpE1v/NzdwBmBxoeliGzimKduSep g3D2mldOdlSQc03zr7l/i9Q= X-Google-Smtp-Source: AGHT+IHRiiiNV3/VozObwbWmfObrWfowq4mQ0Heb+3adaLa/adHllq+XM7NbPLEoS1v0LuWhj2nxKw== X-Received: by 2002:a17:902:dac6:b0:1c3:523b:557a with SMTP id q6-20020a170902dac600b001c3523b557amr12669386plx.4.1694530263530; Tue, 12 Sep 2023 07:51:03 -0700 (PDT) Original-Received: from localhost ([115.240.90.130]) by smtp.gmail.com with ESMTPSA id c17-20020a170903235100b001b9d335223csm8591063plh.26.2023.09.12.07.51.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 07:51:03 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Tue, 12 Sep 2023 09:08:09 -0400") 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:270189 Archived-At: [=E0=AE=9A=E0=AF=86=E0=AE=B5=E0=AF=8D=E0=AE=B5=E0=AE=BE=E0=AE=AF=E0=AF=8D = =E0=AE=9A=E0=AF=86=E0=AE=AA=E0=AF=8D=E0=AE=9F=E0=AE=AE=E0=AF=8D=E0=AE=AA=E0= =AE=B0=E0=AF=8D 12, 2023] Stefan Monnier wrote: >> 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. Ah yes, of course. I am still thinking in vague terms of macroexpansion which is leading to all the misunderstandings. >> (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. Oh yes, I called `it' first but changed it `str' "in anger". So far, I haven't been in the need of using both vz/snippet-when's `str' and skeleton's `str' so I will let the sleeping dogs lie. > [ 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 :-) ] I guess it wasn't chosen because there are other variables too (like help, v1, v2, etc.). I cannot think of any improvements to the documentation since the spawn of this bug report is rooted in a lack of understanding of how skeleton works. There is nothing to fix here except my understanding so I'm closing the bug report with this. Thank you again for your time, Stefan.