From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Christophe Junke Newsgroups: gmane.emacs.bugs Subject: bug#31783: [PATCH v2] ido.el: define a special ido-fallback variable Date: Mon, 11 Jun 2018 14:54:52 +0200 Message-ID: References: <83bmcktpef.fsf@gnu.org> <20180611082340.28727-1-junke.christophe@gmail.com> <87efhdzfbc.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000003e30b4056e5d432a" X-Trace: blaine.gmane.org 1528721655 24669 195.159.176.226 (11 Jun 2018 12:54:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 11 Jun 2018 12:54:15 +0000 (UTC) Cc: 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 14:54:11 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 1fSMKo-0006Ig-VY for geb-bug-gnu-emacs@m.gmane.org; Mon, 11 Jun 2018 14:54:11 +0200 Original-Received: from localhost ([::1]:48647 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSMMw-0000kA-6z for geb-bug-gnu-emacs@m.gmane.org; Mon, 11 Jun 2018 08:56:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSMMg-0000im-Nb for bug-gnu-emacs@gnu.org; Mon, 11 Jun 2018 08:56:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSMMc-0006OC-Qq for bug-gnu-emacs@gnu.org; Mon, 11 Jun 2018 08:56:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35021) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSMMc-0006O4-MU for bug-gnu-emacs@gnu.org; Mon, 11 Jun 2018 08:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fSMMc-0002av-FG for bug-gnu-emacs@gnu.org; Mon, 11 Jun 2018 08:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Christophe Junke Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Jun 2018 12:56:02 +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.15287217299920 (code B ref 31783); Mon, 11 Jun 2018 12:56:02 +0000 Original-Received: (at 31783) by debbugs.gnu.org; 11 Jun 2018 12:55:29 +0000 Original-Received: from localhost ([127.0.0.1]:42915 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSMM5-0002Zw-AB for submit@debbugs.gnu.org; Mon, 11 Jun 2018 08:55:29 -0400 Original-Received: from mail-ot0-f172.google.com ([74.125.82.172]:40284) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSMM4-0002Zi-Fg for 31783@debbugs.gnu.org; Mon, 11 Jun 2018 08:55:28 -0400 Original-Received: by mail-ot0-f172.google.com with SMTP id w9-v6so18112549otj.7 for <31783@debbugs.gnu.org>; Mon, 11 Jun 2018 05:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=LzmCSLPRIloSQxxlzzidM8+CuAens+lqc4bCxjtX8F8=; b=Yr9eN4TFC1T/y3Ztxmxso1OJuK49g22dBMeS/K7/ZU9NTeRURptYIxxYiad7ZOQQ0C Ky+fbvEJ6N2meBSTC/a+OKX4k7fHKLjyCGov815K2w1U7HLDiJNBuNnHt1v8MxiGNHou f8oVc/e8nK1f4HKhD0Nh6dcR1KFqxlY415FHvBFZ9X4hpVWoaGvhHgH4NVfXm0Yd9Dik TtTHlV7QHxbL2CQGjSFOi5BYNtafy45fwM6IGGCqWIRYMnc9GZ76OJZDqvYsvhSo7OuJ ElruA6gP000j/KcAkM0ECUGt5C9VlRmx0vZ73PbMfr6j1YSr+aONitxg6Kvjpr20rUBN hgGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=LzmCSLPRIloSQxxlzzidM8+CuAens+lqc4bCxjtX8F8=; b=OeHZjIbhL2TskCaRCmCydYFCFNf0d07b/D5jh5R6pJietkAO9vkMH6+2MrKxVdLVQu ndPUhRmMMPm665vIZXxARHwf402ypGOOyR4GIiMJb7GWo2qe9kd8GyQ/FiBEpK7Qg+ee nIyOK1QIyVV2B3Chd/vz+4WtU9jodYFEI7NGtAd6GC1sOmYYYS3KPklNkIl6ws+9q3ks XUam0xncP4vGQ8ADZ7q38pQ7hcIhU8sDtdNuYmD2p1+pGU5ZuwuWB1hQsUlFPE1uSKxI z5bVsgt+BZyT0JQZ+LkTPrNTn422qaty/1BgesRENiR/sodEARaK5vIdZnV6DR9YkIDB TmNQ== X-Gm-Message-State: APt69E2Drqysm0SqB4ge9YozNBZ+g33EG+hWom8F22+JSM4Utb5JVYM1 GmHhzr5th7mD7kULRDlFfvK6D9/malDiDjnQjdQ= X-Google-Smtp-Source: ADUXVKKM2NRaT8SWb4QLlu8uXbuP88gkIeaZTxJLhXgMy1ePKfuOqjne+WQ9Y7WOg+G2wjZ5FutEdTp67sz7CvqLKxg= X-Received: by 2002:a9d:7208:: with SMTP id u8-v6mr9205272otj.200.1528721722714; Mon, 11 Jun 2018 05:55:22 -0700 (PDT) Original-Received: by 2002:a8a:13c3:0:0:0:0:0 with HTTP; Mon, 11 Jun 2018 05:54:52 -0700 (PDT) In-Reply-To: <87efhdzfbc.fsf@gmail.com> 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:147283 Archived-At: --0000000000003e30b4056e5d432a Content-Type: text/plain; charset="UTF-8" > I believe this doesn't work, function parameters are always lexically bound. Indeed, there is even a warning from disassemble about the lexical argument shadowing the dynamic one. Thank you for noticing that. > So I think your first patch was fine. Fine. To recap, the first patch also redefines "ido-fallback-command" so that it accepts an optional parameter (the fallback command). Is that ok for you? The idea was to let Ido be exited with a custom fallback command through a function, and without requiring other packages to set a variable directly. Thank you. On Mon, Jun 11, 2018 at 2:19 PM, Noam Postavsky wrote: > merge 31783 31707 > quit > > 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. > --0000000000003e30b4056e5d432a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
=C2=A0> I believe this doesn't work, function param= eters are always lexically bound.

Indeed, there is even = a warning from disassemble about the lexical argument shadowing the dynamic= one.

Thank you for noticing that.

<= /div>
>=20 So I think your first patch was fine.

Fine.

To recap, the first patch = also redefines "ido-fallback-command" so that it accepts an optio= nal parameter (the fallback command).
Is that ok for y= ou? The idea was to let Ido be exited with a custom fallback command throug= h a function, and without requiring other packages to set a variable direct= ly.


Thank you= .



<= br>
On Mon, Jun 11, 2018 at 2:19 PM, Noam Postavs= ky <npostavs@gmail.com> wrote:
merge 31783 31707
quit

Christophe Junke <junke.ch= ristophe@gmail.com> 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 'fal= lback.
> +(defvar ido-fallback nil)

> -(defun ido-buffer-internal (method &optional fallback prompt defa= ult 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.=C2=A0 Compare

=C2=A0 =C2=A0 ; -*- lexical-binding: t -*-
=C2=A0 =C2=A0 (setq lexical-binding t) ; for use in *scratch*

=C2=A0 =C2=A0 (defvar x nil)

=C2=A0 =C2=A0 (disassemble (lambda (x y)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(+ x y= )))

=C2=A0 =C2=A0 (let ((x 1))
=C2=A0 =C2=A0 =C2=A0 (disassemble (lambda (y)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(+ x y))))

So I think your first patch was fine.

--0000000000003e30b4056e5d432a--