From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id aKksHDw6EV8vVQAA0tVLHw (envelope-from ) for ; Fri, 17 Jul 2020 05:42:20 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id INUVGDw6EV8rWAAAB5/wlQ (envelope-from ) for ; Fri, 17 Jul 2020 05:42:20 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 82F3E9402A2 for ; Fri, 17 Jul 2020 05:42:19 +0000 (UTC) Received: from localhost ([::1]:50506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwJ8T-0006pZ-1D for larch@yhetil.org; Fri, 17 Jul 2020 01:42:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwJ7d-0006nV-Qt for emacs-orgmode@gnu.org; Fri, 17 Jul 2020 01:41:25 -0400 Received: from pb-smtp2.pobox.com ([64.147.108.71]:56175) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwJ7a-0007R1-77 for emacs-orgmode@gnu.org; Fri, 17 Jul 2020 01:41:25 -0400 Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id C544165D7F; Fri, 17 Jul 2020 01:41:19 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:in-reply-to:date:message-id:mime-version:content-type; s=sasl; bh=mGl9PE2Bs9LDzWMLlvkaCDJ5wQE=; b=qb8wnCQwAGULSGQOJj7a 66hDz32oS/7c9PfqWc/1kDt2BKPtJwS2SrKpOo8O7sjOKT2NxQvuZpWQnktqH/8+ VPxs9t2FzgxOpoZm0uVcgk8mKVjZeNKY26O/LRFxviY5GxXLxV4H/CPmcSU/26Y6 ojqFaeU7/0RC9twbnxsK+Nc= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id BD27C65D7E; Fri, 17 Jul 2020 01:41:19 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=kyleam.com; h=from:to:cc:subject:in-reply-to:date:message-id:mime-version:content-type; s=mesmtp; bh=lrrd0s8CU7DgJqcHEP426yK0aYkMEzWdLtj0WhmMtrs=; b=vsQI5+j/E/BiBP+M3IlFa9lVaOLrxRrRYgSc1B3XR1PsqPYTJyErAyYc8lerPpgOrFKCpIZV9XcYqoCMLs8FhT1mdD+E2Tg/LOWqlqkxEYX5yNL29HMeAimPbNdUs6GPtEKepU+c9x6WT5Ct64hfI92Id79gtLRUKUsIQtAGXjA= Received: from localhost (unknown [45.33.91.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id 335A665D7D; Fri, 17 Jul 2020 01:41:19 -0400 (EDT) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: "James N. V. Cash" Subject: [PATCH] org-eldoc: Fix compatibility with Emacs 28 In-Reply-To: <87d04vjzp4.fsf@gmail.com> Date: Fri, 17 Jul 2020 01:41:17 -0400 Message-ID: <874kq6g0le.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 23A41218-C7F0-11EA-9FA6-2F5D23BA3BAF-24757444!pb-smtp2.pobox.com Received-SPF: pass client-ip=64.147.108.71; envelope-from=kyle@kyleam.com; helo=pb-smtp2.pobox.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/17 01:41:19 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Basil L. Contovounesios" , emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=pobox.com header.s=sasl header.b=qb8wnCQw; dkim=fail (rsa verify failed) header.d=kyleam.com header.s=mesmtp header.b=vsQI5+j/; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -0.01 X-TUID: 8jpDkuKTayxW James N. V. Cash writes: > Kyle Meyer writes: > >> Basil L. Contovounesios writes: >>> How involved would it be to make org-eldoc work in >>> non-"backwards-compatibility" mode? >> >> I think we can do that, while still supporting Org's minimum Emacs >> version, by following python.el. Here's what it does: >> ... >> >> ... org-eldoc-documentation-function's signature could be changed to >> (&rest _ignored), like python-eldoc-function's. > > This makes the most sense to me; I missed that the default documentation > strategy also allows the function to ignore the callback & just return a > docstring directly. All right, thanks. Here's that in patch form. I briefly tested with Emacs 26, 27, and 28, and things seemed to work fine (though I'm not an org-eldoc user). I'll plan to apply it in a day or two unless there are objections. -- >8 -- Subject: [PATCH] org-eldoc: Fix compatibility with Emacs 28 * contrib/lisp/org-eldoc.el (org-eldoc-documentation-function): Accept and ignore additional arguments for compatibility with Emacs 28. (org-eldoc-load): Use add-function to register org-eldoc-documentation-function for Emacs versions 25 through 27, as documented in eldoc-documentation-function. See Emacs's fd020a2931 (eldoc: modify `eldoc-documentation-function' using `add-function', 2014-12-05) and c0fcbd2c11 (Expose ElDoc functions in a hook (Bug#28257), 2020-02-25) for more information on the Emacs 25 and Emacs 28 changes, respectively. --- contrib/lisp/org-eldoc.el | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/contrib/lisp/org-eldoc.el b/contrib/lisp/org-eldoc.el index 72b10a1fb..b89eb0918 100644 --- a/contrib/lisp/org-eldoc.el +++ b/contrib/lisp/org-eldoc.el @@ -127,7 +127,7 @@ (declare-function css-eldoc-function "css-eldoc" ()) (declare-function php-eldoc-function "php-eldoc" ()) (declare-function go-eldoc--documentation-function "go-eldoc" ()) -(defun org-eldoc-documentation-function () +(defun org-eldoc-documentation-function (&rest _ignored) "Return breadcrumbs when on a headline, args for src block header-line, calls other documentation functions depending on lang when inside src body." (or @@ -161,11 +161,17 @@ (defun org-eldoc-documentation-function () (defun org-eldoc-load () "Set up org-eldoc documentation function." (interactive) - (if (boundp 'eldoc-documentation-functions) - (add-hook 'eldoc-documentation-functions - #'org-eldoc-documentation-function nil t) - (setq-local eldoc-documentation-function - #'org-eldoc-documentation-function))) + ;; This approach is taken from python.el. + (with-no-warnings + (if (null eldoc-documentation-function) + ;; Emacs<25 + (setq-local eldoc-documentation-function + #'org-eldoc-documentation-function) + (if (boundp 'eldoc-documentation-functions) + (add-hook 'eldoc-documentation-functions + #'org-eldoc-documentation-function nil t) + (add-function :before-until (local 'eldoc-documentation-function) + #'org-eldoc-documentation-function))))) ;;;###autoload (add-hook 'org-mode-hook #'org-eldoc-load) base-commit: e62ca4a1bf576a2c498f47536d3f12cd698e3ac0 -- 2.27.0