GNU bug report logs - #17630
24.3.91; gv expander for a few places are incorrect

Previous Next

Package: emacs;

Reported by: Leo Liu <sdl.web <at> gmail.com>

Date: Thu, 29 May 2014 11:38:01 UTC

Severity: normal

Found in version 24.3.91

Done: Leo Liu <sdl.web <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17630 in the body.
You can then email your comments to 17630 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org:
bug#17630; Package emacs. (Thu, 29 May 2014 11:38:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo Liu <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org. (Thu, 29 May 2014 11:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.91; gv expander for a few places are incorrect
Date: Thu, 29 May 2014 19:36:22 +0800
Hi Stefan,

These are incorrect:

(gv-define-simple-setter window-buffer set-window-buffer)
(gv-define-simple-setter window-display-table set-window-display-table 'fix)
(gv-define-simple-setter window-dedicated-p set-window-dedicated-p)
(gv-define-simple-setter window-hscroll set-window-hscroll)
(gv-define-simple-setter window-point set-window-point)
(gv-define-simple-setter window-start set-window-start)

The getter allows optional WINDOW arg but the setter requires WINDOW
arg. For example:

  (setf (window-buffer) (get-buffer "abc")) expands incorrectly to
  (set-window-buffer (get-buffer "abc"))

They should probably all be re-defined using gv-define-setter.

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17630; Package emacs. (Thu, 29 May 2014 13:19:02 GMT) Full text and rfc822 format available.

Message #8 received at 17630 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 17630 <at> debbugs.gnu.org
Subject: Re: bug#17630: 24.3.91; gv expander for a few places are incorrect
Date: Thu, 29 May 2014 09:18:13 -0400
> The getter allows optional WINDOW arg but the setter requires WINDOW
> arg. For example:

>   (setf (window-buffer) (get-buffer "abc")) expands incorrectly to
>   (set-window-buffer (get-buffer "abc"))

> They should probably all be re-defined using gv-define-setter.

Indeed.  Tho maybe a better fix is to get rid of the asymmetry between
the getter and the setter.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17630; Package emacs. (Fri, 30 May 2014 03:47:02 GMT) Full text and rfc822 format available.

Message #11 received at 17630 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 17630 <at> debbugs.gnu.org
Subject: Re: bug#17630: 24.3.91; gv expander for a few places are incorrect
Date: Fri, 30 May 2014 11:46:18 +0800
On 2014-05-29 09:18 -0400, Stefan Monnier wrote:
> Indeed.  Tho maybe a better fix is to get rid of the asymmetry between
> the getter and the setter.

Yes but the situation is both odd and logical. Due to the naming of the
setter the WINDOW arg naturally should appear first. For example:

  (set-window-parameter PARAMETER VALUE &optional WINDOW)

is less clear. Making the WINDOW arg required in the getter has
downsides as well.

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17630; Package emacs. (Fri, 30 May 2014 16:22:02 GMT) Full text and rfc822 format available.

Message #14 received at 17630 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 17630 <at> debbugs.gnu.org
Subject: Re: bug#17630: 24.3.91; gv expander for a few places are incorrect
Date: Fri, 30 May 2014 12:20:49 -0400
> Yes but the situation is both odd and logical. Due to the naming of the
> setter the WINDOW arg naturally should appear first. For example:
>   (set-window-parameter PARAMETER VALUE &optional WINDOW)
> is less clear. Making the WINDOW arg required in the getter has
> downsides as well.

Indeed.  So I guess the better fix is to use gv-define-setter, indeed.
BTW, IIRC these setter definitions come straight from the old CL code,
so this bug has been with us for a while.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17630; Package emacs. (Sat, 31 May 2014 03:05:02 GMT) Full text and rfc822 format available.

Message #17 received at 17630 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 17630 <at> debbugs.gnu.org
Subject: Re: bug#17630: 24.3.91; gv expander for a few places are incorrect
Date: Sat, 31 May 2014 11:04:07 +0800
On 2014-05-30 12:20 -0400, Stefan Monnier wrote:
> Indeed.  So I guess the better fix is to use gv-define-setter, indeed.
> BTW, IIRC these setter definitions come straight from the old CL code,
> so this bug has been with us for a while.

Indeed, though the return value of (setf (window-buffer ...) ...) is a
regression.

The fix is trivial. Do you mind installing it in emacs-24?

=== modified file 'lisp/emacs-lisp/gv.el'
--- lisp/emacs-lisp/gv.el	2014-02-21 19:01:19 +0000
+++ lisp/emacs-lisp/gv.el	2014-05-31 02:50:44 +0000
@@ -340,13 +340,16 @@
 (gv-define-simple-setter process-filter set-process-filter)
 (gv-define-simple-setter process-sentinel set-process-sentinel)
 (gv-define-simple-setter process-get process-put)
-(gv-define-simple-setter window-buffer set-window-buffer)
-(gv-define-simple-setter window-display-table set-window-display-table 'fix)
-(gv-define-simple-setter window-dedicated-p set-window-dedicated-p)
-(gv-define-simple-setter window-hscroll set-window-hscroll)
 (gv-define-simple-setter window-parameter set-window-parameter)
-(gv-define-simple-setter window-point set-window-point)
-(gv-define-simple-setter window-start set-window-start)
+(gv-define-setter window-buffer (v &optional w)
+  `(progn (set-window-buffer ,w ,v) ,v))
+(gv-define-setter window-display-table (v &optional w)
+  `(progn (set-window-display-table ,w ,v) ,v))
+(gv-define-setter window-dedicated-p (v &optional w)
+  `(set-window-dedicated-p ,w ,v))
+(gv-define-setter window-hscroll (v &optional w) `(set-window-hscroll ,w ,v))
+(gv-define-setter window-point (v &optional w) `(set-window-point ,w ,v))
+(gv-define-setter window-start (v &optional w) `(set-window-start ,w ,v))
 
 (gv-define-setter buffer-local-value (val var buf)
   (macroexp-let2 nil v val




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17630; Package emacs. (Sat, 31 May 2014 14:33:01 GMT) Full text and rfc822 format available.

Message #20 received at 17630 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 17630 <at> debbugs.gnu.org
Subject: Re: bug#17630: 24.3.91; gv expander for a few places are incorrect
Date: Sat, 31 May 2014 10:32:46 -0400
> The fix is trivial. Do you mind installing it in emacs-24?

I think it's OK, go ahead.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17630; Package emacs. (Sat, 31 May 2014 14:38:01 GMT) Full text and rfc822 format available.

Message #23 received at 17630 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 17630 <at> debbugs.gnu.org
Subject: Re: bug#17630: 24.3.91; gv expander for a few places are incorrect
Date: Sat, 31 May 2014 10:37:12 -0400
> +(gv-define-setter window-buffer (v &optional w)
> +  `(progn (set-window-buffer ,w ,v) ,v))

Actually, this is wrong.  C-h f gv-define-setter says:

   The first arg in ARGLIST (the one that receives VAL) receives an
   expression which can do arbitrary things, whereas the other arguments
   are all guaranteed to be pure and copyable.

So using ,v twice will cause havoc in things like

   (setf (window-buffer foo) (pop buffer))


-- Stefan




Reply sent to Leo Liu <sdl.web <at> gmail.com>:
You have taken responsibility. (Sat, 31 May 2014 15:49:02 GMT) Full text and rfc822 format available.

Notification sent to Leo Liu <sdl.web <at> gmail.com>:
bug acknowledged by developer. (Sat, 31 May 2014 15:49:03 GMT) Full text and rfc822 format available.

Message #28 received at 17630-done <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 17630-done <at> debbugs.gnu.org
Subject: Re: bug#17630: 24.3.91; gv expander for a few places are incorrect
Date: Sat, 31 May 2014 23:47:43 +0800
Fixed in 24.4.

On 2014-05-31 10:37 -0400, Stefan Monnier wrote:
> So using ,v twice will cause havoc in things like
>
>    (setf (window-buffer foo) (pop buffer))

The curse of multiple evaluation. I think I have corrected this.

Thanks,
Leo




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 29 Jun 2014 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 16 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.