unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50690: Avoid double argument evaluation in vc-call
@ 2021-09-19 23:48 Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-09-21  5:18 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-09-19 23:48 UTC (permalink / raw)
  To: 50690

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]

Severity: wishlist
Tags: patch

Is there any reason why the macro vc-call should continue to evaluate
its second argument twice?  Both 'make bootstrap' and 'make check' pass
with the attached patch:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-lisp-vc-vc-hooks.el-vc-call-Eval-arg-once.patch --]
[-- Type: text/x-diff, Size: 1117 bytes --]

From 5cdd24e4eb3e1e79857d76c2b780fe7f245ad9f6 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
Date: Sun, 19 Sep 2021 22:39:20 +0100
Subject: [PATCH 2/2] * lisp/vc/vc-hooks.el (vc-call): Eval arg once.

---
 lisp/vc/vc-hooks.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 0612310640..b7760e3bba 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -256,9 +256,9 @@ vc-call-backend
 (defmacro vc-call (fun file &rest args)
   "A convenience macro for calling VC backend functions.
 Functions called by this macro must accept FILE as the first argument.
-ARGS specifies any additional arguments.  FUN should be unquoted.
-BEWARE!! FILE is evaluated twice!!"
-  `(vc-call-backend (vc-backend ,file) ',fun ,file ,@args))
+ARGS specifies any additional arguments.  FUN should be unquoted."
+  (macroexp-let2 nil file file
+    `(vc-call-backend (vc-backend ,file) ',fun ,file ,@args)))
 \f
 (defsubst vc-parse-buffer (pattern i)
   "Find PATTERN in the current buffer and return its Ith submatch."
-- 
2.33.0


[-- Attachment #3: Type: text/plain, Size: 952 bytes --]


Thanks,

-- 
Basil

In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars)
 of 2021-09-20 built on tia
Repository revision: 3c513435369826e44a53dcb12ecc14657e03c73d
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure 'CC=ccache gcc' 'CFLAGS=-Og -ggdb' --config-cache
 --prefix=/home/blc/.local --enable-checking=structs
 --with-x-toolkit=lucid --with-file-notification=yes --with-x'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
X11 XAW3D XDBE XIM XPM LUCID ZLIB

Important settings:
  value of $LANG: en_IE.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#50690: Avoid double argument evaluation in vc-call
  2021-09-19 23:48 bug#50690: Avoid double argument evaluation in vc-call Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-09-21  5:18 ` Lars Ingebrigtsen
  2021-09-21 11:53   ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-21  5:18 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 50690

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> Is there any reason why the macro vc-call should continue to evaluate
> its second argument twice?  Both 'make bootstrap' and 'make check' pass
> with the attached patch:

Your patch seems "obviously correct" to me (but it's an incompatible
change since the previous wonky behaviour was actually documented, so it
should be mentioned in NEWS).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#50690: Avoid double argument evaluation in vc-call
  2021-09-21  5:18 ` Lars Ingebrigtsen
@ 2021-09-21 11:53   ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-09-21 16:57     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-09-21 11:53 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 50690

close 50690 28.1
quit

Lars Ingebrigtsen [2021-09-21 07:18 +0200] wrote:

> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>
>> Is there any reason why the macro vc-call should continue to evaluate
>> its second argument twice?  Both 'make bootstrap' and 'make check' pass
>> with the attached patch:
>
> Your patch seems "obviously correct" to me (but it's an incompatible
> change since the previous wonky behaviour was actually documented, so it
> should be mentioned in NEWS).

Done:

Avoid double argument evaluation in vc-call macro
5b962a7ad8 2021-09-21 12:30:58 +0100
https://git.sv.gnu.org/cgit/emacs.git/commit/?id=5b962a7ad8d0acfe40a41ce139059b9c8e46f666

I wasn't sure which is the most appropriate heading for it, so I put it
under

  * Changes in Specialized Modes and Packages in Emacs 28.1
  ** Change Logs and VC

Would

  * Incompatible Lisp Changes in Emacs 28.1

be more appropriate?

Thanks,

-- 
Basil





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#50690: Avoid double argument evaluation in vc-call
  2021-09-21 11:53   ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-09-21 16:57     ` Lars Ingebrigtsen
  2021-09-21 17:17       ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-21 16:57 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 50690

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> Would
>
>   * Incompatible Lisp Changes in Emacs 28.1
>
> be more appropriate?

Yes, that's where we stash stuff like this.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#50690: Avoid double argument evaluation in vc-call
  2021-09-21 16:57     ` Lars Ingebrigtsen
@ 2021-09-21 17:17       ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 5+ messages in thread
From: Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-09-21 17:17 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 50690

Lars Ingebrigtsen [2021-09-21 18:57 +0200] wrote:

> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>
>> Would
>>
>>   * Incompatible Lisp Changes in Emacs 28.1
>>
>> be more appropriate?
>
> Yes, that's where we stash stuff like this.

Done:

; * etc/NEWS: Refile recent addition (bug#50690).
90d491ee57 2021-09-21 18:16:36 +0100
https://git.sv.gnu.org/cgit/emacs.git/commit/?id=90d491ee577399a76754ad2c873c03bc5c466eda

Thanks,

-- 
Basil





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-21 17:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-19 23:48 bug#50690: Avoid double argument evaluation in vc-call Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-21  5:18 ` Lars Ingebrigtsen
2021-09-21 11:53   ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-21 16:57     ` Lars Ingebrigtsen
2021-09-21 17:17       ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).