all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 27718@debbugs.gnu.org, Alex <agrambot@gmail.com>
Subject: bug#27718: 26.0.50; (cl-typep instance-ab 'class-a) gives wrong answer when compiled
Date: Sat, 22 Jul 2017 13:51:22 -0400	[thread overview]
Message-ID: <87tw248in9.fsf@users.sourceforge.net> (raw)
In-Reply-To: <jwvinimexvn.fsf-monnier+emacsbugs@gnu.org> (Stefan Monnier's message of "Fri, 21 Jul 2017 09:19:58 -0400")

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

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> So maybe rather than hijack function-get/put in bug#27016, we should
> introduce a new "definitional put" with a corresponding `get`, and then
> use that here as well as in function-put/get.
>
> Maybe we could simply change put&get directly without introducing
> yet-another slightly different get/put?

Something like this?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 2850 bytes --]

From 7645c7ff5078aa0bc937969fb1550b0f794d793e Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 22 Jul 2017 13:46:58 -0400
Subject: [PATCH] Let `put' take effect during compilation (Bug#27718)

* lisp/emacs-lisp/bytecomp.el: Use `byte-compile-function-put' to
handle `put' as well.
* src/fns.c (Fget): Consult `byte-compile-plist-environment'.
* lisp/subr.el (function-get): Let `get' take care of consuling
`byte-compile-plist-environment'.
---
 lisp/emacs-lisp/bytecomp.el |  1 +
 lisp/subr.el                |  7 +------
 src/fns.c                   | 10 ++++++++++
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 4dda3bdc2b..3fead4229e 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -4719,6 +4719,7 @@ (defun byte-compile-form-make-variable-buffer-local (form)
   (byte-compile-keep-pending form 'byte-compile-normal-call))
 
 (put 'function-put 'byte-hunk-handler 'byte-compile-function-put)
+(put 'put 'byte-hunk-handler 'byte-compile-function-put)
 (defun byte-compile-function-put (form)
   (pcase form
     ((and `(,op ,fun ,prop ,val)
diff --git a/lisp/subr.el b/lisp/subr.el
index 3e4a3dedf5..42b4e1c211 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2971,12 +2971,7 @@ (defun function-get (f prop &optional autoload)
 if it's an autoloaded macro."
   (let ((val nil))
     (while (and (symbolp f)
-                (null (setq val (or (plist-get
-                                     (alist-get
-                                      f (bound-and-true-p
-                                         byte-compile-plist-environment))
-                                     prop)
-                                    (get f prop))))
+                (null (setq val (get f prop)))
                 (fboundp f))
       (let ((fundef (symbol-function f)))
         (if (and autoload (autoloadp fundef)
diff --git a/src/fns.c b/src/fns.c
index d849618f2b..655422aa0f 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1987,6 +1987,14 @@ DEFUN ("get", Fget, Sget, 2, 2, 0,
   (Lisp_Object symbol, Lisp_Object propname)
 {
   CHECK_SYMBOL (symbol);
+  Lisp_Object plist_env = find_symbol_value (Qbyte_compile_plist_environment);
+  if (CONSP (plist_env))
+    {
+      Lisp_Object propval = Fplist_get (CDR (Fassq (symbol, plist_env)),
+                                        propname);
+      if (!NILP (propval))
+        return propval;
+    }
   return Fplist_get (XSYMBOL (symbol)->plist, propname);
 }
 
@@ -5125,6 +5133,8 @@ syms_of_fns (void)
   DEFSYM (Qkey_or_value, "key-or-value");
   DEFSYM (Qkey_and_value, "key-and-value");
 
+  DEFSYM (Qbyte_compile_plist_environment, "byte-compile-plist-environment");
+
   defsubr (&Ssxhash_eq);
   defsubr (&Ssxhash_eql);
   defsubr (&Ssxhash_equal);
-- 
2.11.1


  reply	other threads:[~2017-07-22 17:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-15 21:50 bug#27718: 26.0.50; (cl-typep instance-ab 'class-a) gives wrong answer when compiled npostavs
2017-07-21 12:23 ` npostavs
2017-07-21 13:19   ` Stefan Monnier
2017-07-22 17:51     ` npostavs [this message]
2017-07-24 15:30       ` Stefan Monnier
2017-07-24 19:44         ` Stefan Monnier
2017-07-25 16:34           ` Noam Postavsky
2017-07-25 21:21             ` Stefan Monnier
2017-08-05  1:06               ` npostavs
2017-08-05 12:49                 ` Stefan Monnier
2017-08-08  1:16                   ` npostavs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tw248in9.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=27718@debbugs.gnu.org \
    --cc=agrambot@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.