From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#28257: 26.0.50; [PATCH] expose eldoc functions in a hook Date: Fri, 14 Feb 2020 09:50:47 -0500 Message-ID: References: <87ziakwifi.fsf@holos> <87val88l0d.fsf@users.sourceforge.net> <20170828031104.GA15524@holos.localdomain> <87shgb89q1.fsf@users.sourceforge.net> <20170830015017.GA28668@holos.localdomain> <87wohasikq.fsf@gmail.com> <20190626140303.quhh4psgvd3aneyr@logos.localdomain> <20200126234731.GA12794@holos.localdomain> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="113107"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , npostavs@users.sourceforge.net, Noam Postavsky , 28257@debbugs.gnu.org To: Mark Oteiza Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 14 15:52:21 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1j2cKK-000TJk-Qj for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Feb 2020 15:52:20 +0100 Original-Received: from localhost ([::1]:39858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2cKJ-00078R-Tp for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Feb 2020 09:52:19 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41174) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2cK2-0006w2-Rl for bug-gnu-emacs@gnu.org; Fri, 14 Feb 2020 09:52:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2cK1-0005EJ-MW for bug-gnu-emacs@gnu.org; Fri, 14 Feb 2020 09:52:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55079) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j2cK1-0005E9-JU for bug-gnu-emacs@gnu.org; Fri, 14 Feb 2020 09:52:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j2cK1-0001Pb-Ip for bug-gnu-emacs@gnu.org; Fri, 14 Feb 2020 09:52:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Feb 2020 14:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28257 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 28257-submit@debbugs.gnu.org id=B28257.15816918675347 (code B ref 28257); Fri, 14 Feb 2020 14:52:01 +0000 Original-Received: (at 28257) by debbugs.gnu.org; 14 Feb 2020 14:51:07 +0000 Original-Received: from localhost ([127.0.0.1]:32816 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j2cJ8-0001OA-QK for submit@debbugs.gnu.org; Fri, 14 Feb 2020 09:51:07 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:46103) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j2cJ6-0001Ng-GM for 28257@debbugs.gnu.org; Fri, 14 Feb 2020 09:51:05 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C9B9544E79F; Fri, 14 Feb 2020 09:50:58 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 851F044E745; Fri, 14 Feb 2020 09:50:49 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1581691849; bh=c3njxVRgpRL2IxepXbkd+PpjsVzjAOsVzOBsX+65CdM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=AnHKzPlEHED4jzbVSSk04QC/BdSXnNXRh4FzNMW8CeEwU9Rc4bJig2/bEUEf8fIWd 6TT9k9eov371E7Z0UqSg0m7yXuzuXq4b+ZOXrjbJqfv2vG0GC2kjizSFAQvPeqdc6V kR6fShmSCPlFT8Uyjtz7BZ88kIiI1zfCGNYT+7NQnSRfUGpngviTZhShTJlyRH/M46 DBWooqBuEnMBgWHKGQ0jmotKcjQSlcvT9uocypxyKsoUBOV//mIGnMl65QzOFLEls5 vVdDcu4qDOsJIJ7WgCNrzAsaEEkqPzZ1V37diYifpNmTDqoI5nUF6f7EE6jgdp6Qey 1elJ+puYtZY2w== Original-Received: from pastel (unknown [157.52.14.222]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4132B120484; Fri, 14 Feb 2020 09:50:49 -0500 (EST) In-Reply-To: <20200126234731.GA12794@holos.localdomain> (Mark Oteiza's message of "Sun, 26 Jan 2020 18:47:31 -0500") 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: 209.51.188.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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:176054 Archived-At: > +*** 'eldoc-documentation-function' is now a custom variable. I think this should be expanded to clarify that packages should stop using this var and use `eldoc-documentation-functions` instead. > (defun eldoc--supported-p () > "Non-nil if an ElDoc function is set for this buffer." > - (not (memq eldoc-documentation-function '(nil ignore)))) > + (let ((hook 'eldoc-documentation-functions)) > + (and eldoc-documentation-function > + (or (and (local-variable-p hook) > + (buffer-local-value hook (current-buffer))) > + (default-value hook))))) The (and eldoc-documentation-function should really be (and (not (memq eldoc-documentation-function '(nil ignore)))) > ;;;###autoload > -(defvar eldoc-documentation-function #'ignore > +(defvar eldoc-documentation-functions nil There's no reason to autoload this new var. [ Of course, it makes no practical difference since eldoc is preloaded anyway, but if it weren't preloaded this var should be autoloaded. ] > +(defun eldoc-documentation-default () > + "Show doc string for item at point. > +Default value for `eldoc-documentation-function'." This doc should clarify that it shows the *first* doc. > +;;;###autoload > +(defcustom eldoc-documentation-function #'eldoc-documentation-default Now that it's a defcustom this shouldn't be autoloaded either (currently packages are expected to use `add-function` on it even if there's no indication that the user will actually use eldoc, which is why it is/was autoloaded. But with its new meaning this need disappears). > + (if (> emacs-major-version 25) > + (add-hook 'eldoc-documentation-functions > + #'cfengine3-documentation-function nil t) The test should be fixed (I guess you could use (boundp 'eldoc-documentation-functions)). > + (if (< emacs-major-version 26) > + (add-function :before-until (local 'eldoc-documentation-function) > + #'python-eldoc-function) > + (add-hook 'eldoc-documentation-functions #'python-eldoc-function nil t))) Same here. Stefan