GNU bug report logs - #27016
possible bug in `defsetf'

Previous Next

Package: emacs;

Reported by: Rafael D Sorkin <rsorkin <at> perimeterinstitute.ca>

Date: Mon, 22 May 2017 06:40:01 UTC

Severity: minor

Tags: fixed, patch

Found in versions 24.4, 25.2

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: npostavs <at> users.sourceforge.net
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, 27016 <at> debbugs.gnu.org, Rafael D Sorkin <rsorkin <at> perimeterinstitute.ca>
Subject: bug#27016: possible bug in `defsetf'
Date: Thu, 13 Jul 2017 10:25:38 -0400
> Oh, I think I get it now.

Looks about right.  A few comments below.


        Stefan


> @@ -4577,6 +4582,7 @@ (byte-defop-compiler-1 defvar)
>  (byte-defop-compiler-1 defconst byte-compile-defvar)
>  (byte-defop-compiler-1 autoload)
>  (byte-defop-compiler-1 lambda byte-compile-lambda-form)
> +(byte-defop-compiler-1 function-put)
> 
>  ;; If foo.el declares `toto' as obsolete, it is likely that foo.el will
>  ;; actually use `toto' in order for this obsolete variable to still work

I know it's not how it's done everywhere now, but I like to put the
byte-defop-compiler-1 next to the handler function.

> @@ -4725,6 +4731,18 @@ (put 'make-variable-buffer-local
>       'byte-hunk-handler 'byte-compile-form-make-variable-buffer-local)
>  (defun byte-compile-form-make-variable-buffer-local (form)
>    (byte-compile-keep-pending form 'byte-compile-normal-call))
> +
> +(defun byte-compile-function-put (form)
> +  (pcase form
> +    (`(,_ (,(or 'quote 'function) ,(and fun (guard (symbolp fun))))
> +          ',prop ,(or `#',value (and value (guard (functionp value)))))

The value doesn't have to be `functionp` (it is in the case of
gv-expander, but it depends on the property).

> +     (let ((fplist (assq fun byte-compile-plist-environment)))
> +       (if fplist
> +           (setcdr fplist (plist-put (cdr fplist) prop value))
> +         (push (cons fun (list prop value))
> +               byte-compile-plist-environment)))))

I'd just unconditionally use `push`:

         (push (cons fun `(,prop ,value . ,fplist))
               byte-compile-plist-environment)))))




This bug report was last modified 7 years and 290 days ago.

Previous Next


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