all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>,
	Emacs developers <emacs-devel@gnu.org>
Subject: Re: [Emacs-diffs] master 5f72004: Revert "Fix command repetition with lexical-binding (Bug#29334)"
Date: Mon, 8 Jan 2018 21:32:00 -0500	[thread overview]
Message-ID: <CAM-tV-844=TcDY0wuDkB-x_Hb+G7K4yYxT7tV43saTfkg2fw5Q@mail.gmail.com> (raw)
In-Reply-To: <jwvefn1zno1.fsf-monnier+emacsdiffs@gnu.org>

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

On Sun, Jan 7, 2018 at 10:36 AM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>> --- a/src/callint.c
>> +++ b/src/callint.c
>> @@ -357,9 +357,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
>>        /* Compute the arg values using the user's expression.  */
>>        specs = Feval (specs,
>>                    CONSP (funval) && EQ (Qclosure, XCAR (funval))
>> -                     ? CAR_SAFE (XCDR (funval))
>> -                     : COMPILEDP (funval) && INTEGERP (AREF (funval, COMPILED_ARGLIST))
>> -                     ? Qt : Qnil);
>> +                  ? CAR_SAFE (XCDR (funval)) : Qnil);

> Why?  This looks wrong.

Hmm, I just reverted to the previous code without actually thinking
about it. But after checking this more closely, I find that passing
non-nil LEXICAL to `eval' doesn't really do anything for compiled
functions anyway: the "lexicalness" has already been applied when
compiling. E.g., the above change has no effect on the attached tests.

[-- Attachment #2: callint-tests.el --]
[-- Type: application/octet-stream, Size: 2374 bytes --]

;;; callint-tests.el --- tests for src/callint.c -*- lexical-binding: t -*-

;; Copyright (C) 2018 Free Software Foundation, Inc.

;; This file is part of GNU Emacs.

;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;;; Code:

(require 'ert)
(require 'bytecomp)


;; NOTE: We're purposely checking the dynamic value of the symbol
;; `callint-tests-x' (it should be void), which names a *lexical*
;; variable.

(ert-deftest callint-interactive-form-binding-1 ()
  "Test that interactive form evaluation uses lexical binding."
  (let ((fun
         (lambda (a b)
           (interactive
            (list (bound-and-true-p callint-tests-x)
                  (funcall (let* ((callint-tests-x 42))
                             (lambda () callint-tests-x)))))
           (list a b))))
    (ert-info ("interp")
      (should (equal (call-interactively fun)
                     '(nil 42))))
    (setq fun (byte-compile fun))
    (ert-info ("compiled")
      (should (equal (call-interactively fun)
                    '(nil 42))))))

(ert-deftest callint-interactive-form-binding-2 ()
  "Test that interactive form evaluation uses lexical binding."
  ;; Outer lexical environment is not preserved inside interactive
  ;; forms, so this test fails.
  :expected-result :failed
  (let ((fun
         (let ((callint-tests-x 42))
           (lambda (a b)
             (interactive (list (bound-and-true-p callint-tests-x)
                                callint-tests-x))
             (list a b callint-tests-x)))))
    (ert-info ("interp")
      (should (equal (call-interactively fun)
                     '(nil 42 42))))
    (ert-info ("compiled")
      (should (equal (call-interactively (byte-compile fun))
                    '(nil 42 42))))))

;;; callint-tests.el ends here

  reply	other threads:[~2018-01-09  2:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180107024858.4583.97855@vcs0.savannah.gnu.org>
     [not found] ` <20180107024859.76DAA2020F@vcs0.savannah.gnu.org>
2018-01-07 15:36   ` [Emacs-diffs] master 5f72004: Revert "Fix command repetition with lexical-binding (Bug#29334)" Stefan Monnier
2018-01-09  2:32     ` Noam Postavsky [this message]
2018-01-09 13:11       ` Stefan Monnier

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='CAM-tV-844=TcDY0wuDkB-x_Hb+G7K4yYxT7tV43saTfkg2fw5Q@mail.gmail.com' \
    --to=npostavs@gmail.com \
    --cc=emacs-devel@gnu.org \
    --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.