From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: Gnus using lexical-binding Date: Wed, 10 Feb 2021 10:24:18 +0000 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: References: <87sg6iea57.fsf@tcd.ie> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23274"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Feb 10 11:25:52 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9mgw-0005x0-36 for ged-emacs-devel@m.gmane-mx.org; Wed, 10 Feb 2021 11:25:50 +0100 Original-Received: from localhost ([::1]:45218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9mgv-0004GI-0H for ged-emacs-devel@m.gmane-mx.org; Wed, 10 Feb 2021 05:25:49 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9mfd-00039y-4k for emacs-devel@gnu.org; Wed, 10 Feb 2021 05:24:29 -0500 Original-Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:53711) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9mfZ-00005F-3S for emacs-devel@gnu.org; Wed, 10 Feb 2021 05:24:28 -0500 Original-Received: by mail-wm1-x334.google.com with SMTP id j11so1346149wmi.3 for ; Wed, 10 Feb 2021 02:24:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lifelogs.com; s=google; h=from:to:cc:subject:organization:references:mail-copies-to:date :in-reply-to:message-id:user-agent:mime-version; bh=9Fhen61fGUbd+cmDeqZ3GROz+p99V/Z3ui3lEoIYuPM=; b=PTMwvd3Kf+HxK4GYr5WaLZdbiATsXVb0M9kjnduQVsi11cq1wJ7QU9Q2s0jKTpZctj 7qRaYMWyPPXKa8SCpxbfGFSanz0iz3IKuNIyLZKz+5+jOjinjY5BGyjeyZm0i8KQtCN6 wXXV9qV/Tzzm4m6pvZ5RSEtAdQiVlI2G9cjrs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:organization:references :mail-copies-to:date:in-reply-to:message-id:user-agent:mime-version; bh=9Fhen61fGUbd+cmDeqZ3GROz+p99V/Z3ui3lEoIYuPM=; b=rpw41z4DE1TDOtJwIRKz4BpDzHWBYTJvG8NLXvsLqXcSpJ8boSR7aMAgS5VN6cGUHJ KIp8ohec38VTFfpoky4+65FTQs+/+myTinZrIaoIZ/a1+O+ZsDkDdhYoJO0Ed4FF81dU GmCxvqWddJtN8CY+KykN4Ys13ajzxmj/UwrU4fhu+PADzbJeeo5Zb5zfKEZRuLKUOXTv ZEKy3S0ek5I9Zx9TRTpQcF0kZc3hdvwFm1YShgPUDYmCvmXny+dgqFEh9KeMFcPoy5ct PL7LpyTukde/4MtOzDw5E7s67o2yhCkxxRHzvPmHE+As/takbziFhs9/k394oMwIraeL IrNg== X-Gm-Message-State: AOAM5304INX2l3te1RNLa7pXhbW7ik8rLHmtkpaQFxqn8yDiQY0ETVxj 5SZM1bYAJDowoj4UhYPNihUiXmFPUKzSiQFg X-Google-Smtp-Source: ABdhPJxpDA467UNC01nTtDikr9HP4Y7LOXStWle449d6IMxy0vk1/y1AuHOgnNNBfjyX0RunrWHTkQ== X-Received: by 2002:a1c:7d53:: with SMTP id y80mr2297818wmc.187.1612952659876; Wed, 10 Feb 2021 02:24:19 -0800 (PST) Original-Received: from flea ([90.214.236.164]) by smtp.gmail.com with ESMTPSA id z1sm2239147wru.70.2021.02.10.02.24.18 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 02:24:19 -0800 (PST) X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Copies-To: never In-Reply-To: (Stefan Monnier's message of "Mon, 08 Feb 2021 19:10:48 -0500") Received-SPF: none client-ip=2a00:1450:4864:20::334; envelope-from=tzz@lifelogs.com; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:264266 Archived-At: On Mon, 08 Feb 2021 19:10:48 -0500 Stefan Monnier wrote: >> The confusing thing here is that the eval lexical environment >> is correct. SM> It's correct but it's lexical, so those vars can't be seen from functions SM> called from `gnus-topic-line-format-spec`. I looked through (info "(elisp) Lexical Binding") and I think I understand the issue better. Thank you for fixing it. I confirmed it's all clear. SM> I installed the patch below which should sadly fix it, I have some (probably dumb) suggestions. The fix and the whole pre-existing Gnus "user defines special function" mechanism feels very magical. Could we instead define a standard way of calling these custom user-defined functions in Gnus, passing them an explicit alist or plist of special properties? That would also make it easier from within the function to check what's passed down, and probably remove some complex code in the long run. The code that calls them today could check their arity and if it's 1 (current call signature), warn and do the workaround. If it's 2, pass the alist or plist with no workarounds. Another way may be to provide a special macro to define these functions in a backwards-compatible way. If they have not been defined with the macro, warn and use the workaround. Otherwise, pass them the special values. ...and yet another way may be a new escape char in the format spec for the new style functions with 2 arguments. Users can switch to it when they are ready, and the old escape char gets deprecated. I hope that's useful. Ted