From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: master 9ade7ea: Fix Eldoc problem when loading on Emacs 26.3 Date: Sat, 11 Jul 2020 09:06:24 +0100 Message-ID: <87zh86cw73.fsf@gmail.com> References: <20200710004934.18557.69586@vcs0.savannah.gnu.org> <20200710004936.2935520A27@vcs0.savannah.gnu.org> <0veepjz719.fsf@fencepost.gnu.org> <87lfjrdzna.fsf@gmail.com> <87h7ufdtyr.fsf@gmail.com> <87a707docl.fsf@gmail.com> <874kqfdmc4.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6920"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Glenn Morris , Noam Postavsky , emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jul 11 10:07:05 2020 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 1juAXJ-0001hJ-0P for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Jul 2020 10:07:05 +0200 Original-Received: from localhost ([::1]:54294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1juAXI-0002pP-2I for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Jul 2020 04:07:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1juAWo-0002QU-Pq for emacs-devel@gnu.org; Sat, 11 Jul 2020 04:06:34 -0400 Original-Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:36955) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1juAWl-0003Yo-Kv; Sat, 11 Jul 2020 04:06:34 -0400 Original-Received: by mail-wr1-x430.google.com with SMTP id a6so8043859wrm.4; Sat, 11 Jul 2020 01:06:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=5350WHVoRxz+KYwOoOKohkdAJyUzTWLmMGBWHijT0oE=; b=mwEM1t6fsHEN71h741zAI2AC+tO+WsKLmI3KvM1fAZROUnwIvcD7u0Hn/Jb8MmLigQ bBKaiOP9d2QE5lV8kLBE+MaKOTNDpGogw3+2VeDad4YipWm5j3sdLe4lSWv8up9JxDaz hfIW/V4K/LC0+tKvYUiQ/pc7wGBaJ4NfOwXFONHlYs8vnxBtBtjJFF22CxFwFqhz6UZo 18UFuX36ylWwgCm1Ah5VGssjyap43iwvg2oZ5iTOITZHR4FnHn63sWsEj2U7EM4YzP2J FZkGkh3Dyy8/mBxv5DzAPDofXZqUTUZDDXTb4ou6q8djrcSmSScx90N7o8FKWvAsMHnZ 0xwA== 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:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=5350WHVoRxz+KYwOoOKohkdAJyUzTWLmMGBWHijT0oE=; b=FsHD8wfyJwoMNDB5HZE6XDBcPOM3pcF4XatxTcGr/STOWqwl+y+4twRtnqA6Q+1QE0 i1JWSgRDZMYEr4E+IOBwg0257RE74FhsfNDvHDQhN//Bvse21cndYkgk/pr8370LD/Sq M5eyetV4RDyj+SZXOCR7j319/JAGj7o+e5pcpLf1lh/84n2K+yHfmKbIGF12Nz4QFdgE R/XsQ50L0awGc1bLfv/4vN9YxugK7mFfBXko2EasNdny1xLlbIcfXuwct4xcHvh3eeHC qjOZQsVbOEq/qsu2x7qIcuaTnO6CFWoa8RNl07cgQPNnpw5J33qpm8Fn3VekptXaluVd 5xDQ== X-Gm-Message-State: AOAM532G7SfzG4v1JIsuBw0wQgRe6yESVzcO7iYktcQN3Dq+gAGm3xew KqO1zYS1mIGuKlcixCH1eOLyClJY X-Google-Smtp-Source: ABdhPJz3GCv3ovAR/0BD/a5RzwMjJ2Z55USvRRauogYzwKRnLL+TUIAEEAEiNH41TNOxg8C7ghtu0A== X-Received: by 2002:adf:e2c9:: with SMTP id d9mr70537491wrj.227.1594454788376; Sat, 11 Jul 2020 01:06:28 -0700 (PDT) Original-Received: from krug ([2001:818:d820:9500:824a:171:15a:2213]) by smtp.gmail.com with ESMTPSA id 14sm12138478wmk.19.2020.07.11.01.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jul 2020 01:06:27 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Fri, 10 Jul 2020 19:44:24 -0400") Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=joaotavora@gmail.com; helo=mail-wr1-x430.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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:252856 Archived-At: Stefan Monnier writes: >> all, a much safer bet. I've even thought about dropping the whole >> "rename function to strategy" idea completely, which was just a cosmetic >> way to escape the awful mind-bending confusion between "e-d-function" >> singular and "e-d-functions" plural. > > The reason why I was happy to see you use a different name is to make it > possible for eldoc--supported-p to distinguish the case where something > changed the -strategy var (which shouldn't affect > eldoc--supported-p) from the case where something changed > the -function var. Yes, I know that now, and I don't oppose it. I just don't feel capacitated enough to separated the two things without mixing myself up :-). I drafted up this patch yesterday, but it's got this problem I mentioned. Maybe you can fix it. In the meantime, I'm going to go with the alias. Jo=C3=A3o commit c40761d683dcf70fe7f404b675a3a2631edfeaf0 Author: Jo=C3=A3o T=C3=A1vora Date: Fri Jul 10 19:11:01 2020 +0100 Adjust Eldoc backward compatibility of eldoc-documentation-function =20=20=20=20 Making a variable alias doesn't work because that variable is preloaded and localized. So just keep the eldoc-documentation-function, make it obsolete, and let it be used instead of strategy if it is found to be non-nil (either locally or globally). =20=20=20=20 * lisp/emacs-lisp/eldoc.el (eldoc--eval-expression-setup): Set eldoc-documentation-function to nil. (eldoc-documentation-function): Reinstate variable. (eldoc--documentation-strategy): New helper function. (eldoc--invoke-strategy): Use eldoc--documentation-strategy. (eldoc--supported-p): Reowkr (Version): Bump to 1.5.0 eldoc--supported-p diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 7964c4c45a..29007807aa 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -5,7 +5,7 @@ ;; Author: Noah Friedman ;; Keywords: extensions ;; Created: 1995-10-06 -;; Version: 1.4.0 +;; Version: 1.5.0 ;; Package-Requires: ((emacs "26.3")) =20 ;; This is a GNU ELPA :core package. Avoid functionality that is not @@ -233,7 +233,8 @@ eldoc--eval-expression-setup #'elisp-eldoc-var-docstring nil t) (add-hook 'eldoc-documentation-functions #'elisp-eldoc-funcall nil t) - (setq eldoc-documentation-strategy 'eldoc-documentation-default) + (setq-local eldoc-documentation-function nil) + (setq-local eldoc-documentation-strategy 'eldoc-documentation-default) (eldoc-mode +1)) =20 ;;;###autoload @@ -535,8 +536,11 @@ eldoc-documentation-enthusiast (if (stringp str) (funcall callback str)) nil)))) =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 -(define-obsolete-variable-alias 'eldoc-documentation-function - 'eldoc-documentation-strategy "eldoc-1.1.0") +(make-obsolete-variable + 'eldoc-documentation-function + "use `eldoc-documentation-strategy' instead." "eldoc-1.5.0") + +(defvar eldoc-documentation-function nil) =20 (defcustom eldoc-documentation-strategy #'eldoc-documentation-default "How to collect and organize results of `eldoc-documentation-functions'. @@ -584,9 +588,14 @@ eldoc-documentation-strategy (function :tag "Other function")) :version "28.1") =20 +(defun eldoc--documentation-strategy () + "Return the actual " + (or (bound-and-true-p eldoc-documentation-function) + eldoc-documentation-strategy)) + (defun eldoc--supported-p () "Non-nil if an ElDoc function is set for this buffer." - (and (not (memq eldoc-documentation-strategy '(nil ignore))) + (and (not (memq (eldoc--documentation-strategy) '(nil ignore))) (or eldoc-documentation-functions ;; The old API had major modes set `eldoc-documentation-functio= n' ;; to provide eldoc support. It's impossible now to determine @@ -596,7 +605,8 @@ eldoc--supported-p ;; `eldoc-documentation-functions' (as in the new API). ;; But at least if it's set buffer-locally it's a good hint that ;; there's some eldoc support in the current buffer. - (local-variable-p 'eldoc-documentation-strategy)))) + (local-variable-p 'eldoc-documentation-strategy) + (local-variable-p 'eldoc-documentation-function)))) =20 (defvar eldoc--enthusiasm-curbing-timer nil "Timer used by the `eldoc-documentation-enthusiast' strategy. @@ -703,7 +713,7 @@ eldoc--invoke-strategy (display-doc) t)))))) (let* ((eldoc--make-callback #'make-callback) - (res (funcall eldoc-documentation-strategy))) + (res (funcall (eldoc--documentation-strategy)))) ;; Observe the old and the new protocol: (cond (;; Old protocol: got string, output immediately; (stringp res) (register-doc 0 res nil) (display-doc))