From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#31783: [PATCH v2] ido.el: define a special ido-fallback variable Date: Mon, 11 Jun 2018 18:28:13 +0300 Message-ID: <83h8m9qr5e.fsf@gnu.org> References: <83bmcktpef.fsf@gnu.org> <20180611082340.28727-1-junke.christophe@gmail.com> <87efhdzfbc.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1528730826 503 195.159.176.226 (11 Jun 2018 15:27:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 11 Jun 2018 15:27:06 +0000 (UTC) Cc: junke.christophe@gmail.com, 31783@debbugs.gnu.org To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 11 17:27:01 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSOij-0008UZ-PG for geb-bug-gnu-emacs@m.gmane.org; Mon, 11 Jun 2018 17:27:01 +0200 Original-Received: from localhost ([::1]:49575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSOkq-0004uj-Re for geb-bug-gnu-emacs@m.gmane.org; Mon, 11 Jun 2018 11:29:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSOkk-0004sS-0r for bug-gnu-emacs@gnu.org; Mon, 11 Jun 2018 11:29:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSOkg-0006Ev-32 for bug-gnu-emacs@gnu.org; Mon, 11 Jun 2018 11:29:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35683) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSOkf-0006Er-W4 for bug-gnu-emacs@gnu.org; Mon, 11 Jun 2018 11:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fSOkf-0001k9-QH for bug-gnu-emacs@gnu.org; Mon, 11 Jun 2018 11:29:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Jun 2018 15:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31783 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 31783-submit@debbugs.gnu.org id=B31783.15287308986647 (code B ref 31783); Mon, 11 Jun 2018 15:29:01 +0000 Original-Received: (at 31783) by debbugs.gnu.org; 11 Jun 2018 15:28:18 +0000 Original-Received: from localhost ([127.0.0.1]:43580 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSOjw-0001j7-60 for submit@debbugs.gnu.org; Mon, 11 Jun 2018 11:28:17 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52407) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSOjv-0001iw-CS for 31783@debbugs.gnu.org; Mon, 11 Jun 2018 11:28:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSOjl-000602-Vm for 31783@debbugs.gnu.org; Mon, 11 Jun 2018 11:28:09 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:46249) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSOjl-0005zy-SN; Mon, 11 Jun 2018 11:28:05 -0400 Original-Received: from [176.228.60.248] (port=2076 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fSOjl-0004kJ-CN; Mon, 11 Jun 2018 11:28:05 -0400 In-reply-to: <87efhdzfbc.fsf@gmail.com> (message from Noam Postavsky on Mon, 11 Jun 2018 08:19:03 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:147290 Archived-At: > From: Noam Postavsky > Date: Mon, 11 Jun 2018 08:19:03 -0400 > Cc: 31783@debbugs.gnu.org > > Christophe Junke writes: > > > I agree that it is simpler to rename the existing variable, and just > > add a defvar declaration. Here is a different version of the patch > > which does only this. > > > +;; Indicates which fallback command to call when ido-exit is 'fallback. > > +(defvar ido-fallback nil) > > > -(defun ido-buffer-internal (method &optional fallback prompt default initial switch-cmd) > > +(defun ido-buffer-internal (method &optional ido-fallback prompt default initial switch-cmd) > > I believe this doesn't work, function parameters are always lexically > bound. Compare > > ; -*- lexical-binding: t -*- > (setq lexical-binding t) ; for use in *scratch* > > (defvar x nil) > > (disassemble (lambda (x y) > (+ x y))) > > (let ((x 1)) > (disassemble (lambda (y) > (+ x y)))) > > So I think your first patch was fine. There's some misunderstanding here, most probably mine. Sorry; please help me understand what am I missing. The original report said that the problem was caused by using lexical-binding in ido.el, so I proposed to defvar the offending variable to make it dynamically bound, which is the boilerplate solution for all such problems. I thought that was all that was needed, and I definitely didn't suggest to rename anything. What did I miss?