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 mNYHOWXsYl+GOgAA0tVLHw (envelope-from ) for ; Thu, 17 Sep 2020 04:56:05 +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 8BHxNGXsYl+bNQAAB5/wlQ (envelope-from ) for ; Thu, 17 Sep 2020 04:56:05 +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 C77969402CC for ; Thu, 17 Sep 2020 04:56:04 +0000 (UTC) Received: from localhost ([::1]:45620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kIlxi-0000Rt-J2 for larch@yhetil.org; Thu, 17 Sep 2020 00:56:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIlwx-0000RW-Rc for emacs-orgmode@gnu.org; Thu, 17 Sep 2020 00:55:15 -0400 Received: from pb-smtp20.pobox.com ([173.228.157.52]:63040) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIlwu-00007t-Vj; Thu, 17 Sep 2020 00:55:14 -0400 Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 00FFCEBA58; Thu, 17 Sep 2020 00:55:10 -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=nYFktVkGdKfBattW2O1hkbjz6YM=; b=xhRWhft+oB8d3GjlS9Su E5VlerimZ37+5j6TcLrzcV2dIcZyv22WH0rB/hkTfwgTIHCCAiJVZNIedFkZLxKQ bc3Bb9+p+1dToRGty/UvxP21vzDNIrWAk+Wi33PZBPqEXADvj2G/SEDNtYP7wIKL NZyszrPUGQyy0iAadC4d7oI= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id E0E1BEBA57; Thu, 17 Sep 2020 00:55:09 -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=H/KccjmtPtECh8Aq5mrlqcPu8DUwlPiOEpCaFz3yqAA=; b=k4GDgCi23VRFUMLoM3E6JTUiaVex7BDDeVCmOtbBAj05YjyORmsgQmPeW0ee1B20XFSUF6XXUiH24sA1BJbnH05Cy8J7foP+8WnrxeNnsBZWoT43aQUw2ZOFwyxSeDpdErIZS3nspCt4yi2rmkkFfUqfUMD/Cb5S6tN6qe+90O4= 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-smtp20.pobox.com (Postfix) with ESMTPSA id 4DB1BEBA55; Thu, 17 Sep 2020 00:55:07 -0400 (EDT) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: James N V Cash Subject: Re: eldoc recursion error In-Reply-To: <87imcealr7.fsf@gmail.com> Date: Thu, 17 Sep 2020 00:55:05 -0400 Message-ID: <87a6xp80k6.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: F5131E52-F8A1-11EA-B0F2-F0EA2EB3C613-24757444!pb-smtp20.pobox.com Received-SPF: pass client-ip=173.228.157.52; envelope-from=kyle@kyleam.com; helo=pb-smtp20.pobox.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/17 00:16: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 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: bzg@gnu.org, 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=xhRWhft+; dkim=fail (rsa verify failed) header.d=kyleam.com header.s=mesmtp header.b=k4GDgCi2; 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: L5WjxOaMTofQ James N V Cash writes: > I've attached a patch that addresses the recursion issue with Emacs 28 > and shows eldoc properly with example python. It presumably should act > the same with older versions of Emacs, although I haven't tested. Thanks for the patch! For information about the expected commit message format, please see . > diff --git a/contrib/lisp/org-eldoc.el b/contrib/lisp/org-eldoc.el > index 3b0999340..ccc23b523 100644 > --- a/contrib/lisp/org-eldoc.el > +++ b/contrib/lisp/org-eldoc.el > @@ -116,9 +116,12 @@ > (when (fboundp mode-func) > (with-temp-buffer > (funcall mode-func) > - (setq doc-func (and eldoc-documentation-function > - (symbol-value 'eldoc-documentation-function))) > - (puthash lang doc-func org-eldoc-local-functions-cache)) > + (setq doc-func (if (boundp 'eldoc-documentation-functions) > + (car eldoc-documentation-functions) > + (and eldoc-documentation-function > + (symbol-value 'eldoc-documentation-function)))) > + > + (puthash lang doc-func org-eldoc-local-functions-cache)) > doc-func) > cached-func))) Okay, so when eldoc-documentation-functions is defined (Emacs >=28), we take the first function and go with it. That might not be exactly what you'd see in the native buffer, depending on whether there are other members of eldoc-documentation-functions and how they interact. (I'm being vague, because I don't really know anything about eldoc, but it seems like that must be the case.) Anyway, I'd guess it will be good enough in most cases, and it's certainly better than the recursion error. However, the docstring of eldoc-documentation-functions says Each hook function is called with at least one argument CALLBACK, a function, and decides whether to display a doc short string about the context around point. But downstream in org-eldoc-documentation-function, the function is called with no arguments: (t (let ((doc-fun (org-eldoc-get-mode-local-documentation-function lang))) (when (functionp doc-fun) (funcall doc-fun)))) That happens to work with python-eldoc-function, whose signature is (&rest _ignored), but it may error with other valid eldoc functions. So, at the very least, I think we should wrap the call in a condition-case with a wrong-number-of-arguments handler. Thoughts?