From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id VnhCCh7oZ19kEAAA0tVLHw (envelope-from ) for ; Sun, 20 Sep 2020 23:39:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id OPi/BR7oZ18kaQAA1q6Kng (envelope-from ) for ; Sun, 20 Sep 2020 23:39:10 +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 E64169402AA for ; Sun, 20 Sep 2020 23:39:08 +0000 (UTC) Received: from localhost ([::1]:39198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kK8vC-00043B-C3 for larch@yhetil.org; Sun, 20 Sep 2020 19:39:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kK8ue-000430-3r for emacs-orgmode@gnu.org; Sun, 20 Sep 2020 19:38:32 -0400 Received: from pb-smtp20.pobox.com ([173.228.157.52]:57094) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kK8ua-0008I3-He; Sun, 20 Sep 2020 19:38:31 -0400 Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id CDBB4ED1BA; Sun, 20 Sep 2020 19:38:24 -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:references:date:message-id:mime-version :content-type; s=sasl; bh=c+CnEaopae+G54E+6WLihfTn9Tk=; b=YpBQtW Cm7JBWv1eHTw+3kltIwyqpw+mAIqXPvIA4Jb4ugUTrF1kdX3lNch0C9R6CEnRuDV BS9VTbCDSogl8iQOzLLBcbRiDHh0Cw8g4p2wBhg6O0Xjky+bxAgAN/n71/+eWvuK EeIwft3qnf1V30swB9jh/abRWR9d73/Tj5NYI= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id C60BFED1B9; Sun, 20 Sep 2020 19:38:24 -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:references:date:message-id:mime-version:content-type; s=mesmtp; bh=JevPXKrJK1QJA7EWT1E1fRVB8btmGIOH7Bh87KyVwOM=; b=QLEGZPYbavWk7F4bUSPBr3EJIXCo8hceQ8OC0wEz/VHpPOAI4EhgqWGNaIziSCPOiFby6dXytgk+dAbCDM7DrEnoczzvzptO2QFpsApYx7VPQVkb6CZlFFPbstzRF8p2k69DScEYpYRgSOZ5CwDu3kep9zXo5WD/tzR/YHs7sFc= 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 3F489ED1B8; Sun, 20 Sep 2020 19:38:22 -0400 (EDT) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: "James N. V. Cash" Subject: Re: eldoc recursion error In-Reply-To: <87k0woxxb9.fsf@gmail.com> References: <87tuvtvyig.fsf@kyleam.com> <87mu1kxxzm.fsf@gmail.com> <87k0woxxb9.fsf@gmail.com> Date: Sun, 20 Sep 2020 19:38:20 -0400 Message-ID: <87k0wovx1v.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 5ED4A734-FB9A-11EA-95AD-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/20 19:38:25 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=YpBQtW C; dkim=fail (rsa verify failed) header.d=kyleam.com header.s=mesmtp header.b=QLEGZPYb; 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: 1.49 X-TUID: yA2VCiVd8aAq James N. V. Cash writes: > Indeed, testing with an eldoc backend (a personally hacked-up version of > clojure's cider) that actually uses the callback, it wasn't working with > the previous approach. I've attached a patch that addresses the > previously-mentioned issues as well as this. [...] > @@ -114,11 +114,17 @@ > doc-func) > (if (eq 'empty cached-func) > (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)) > + (with-temp-buffer > + (funcall mode-func) > + (setq doc-func (if (boundp 'eldoc-documentation-functions) > + (let ((doc-funs eldoc-documentation-functions)) > + (lambda (callback) > + (let ((eldoc-documentation-functions doc-funs) > + (eldoc--make-callback (lambda (_ignored) callback))) > + (funcall eldoc-documentation-strategy)))) > + (and eldoc-documentation-function > + (symbol-value 'eldoc-documentation-function)))) > + (puthash lang doc-func org-eldoc-local-functions-cache)) All right, so we can't get by without using eldoc--make-callback here? Relying on a symbol marked with "--" makes me uneasy, and I'd like to avoid it if possible. Does your cider test case above break if we use eldoc-print-current-symbol-info without relaying the callback? That is, this squashed into your patch: diff --git a/contrib/lisp/org-eldoc.el b/contrib/lisp/org-eldoc.el index b86ad1f39..06dcd6fe2 100644 --- a/contrib/lisp/org-eldoc.el +++ b/contrib/lisp/org-eldoc.el @@ -118,10 +118,9 @@ (defun org-eldoc-get-mode-local-documentation-function (lang) (funcall mode-func) (setq doc-func (if (boundp 'eldoc-documentation-functions) (let ((doc-funs eldoc-documentation-functions)) - (lambda (callback) - (let ((eldoc-documentation-functions doc-funs) - (eldoc--make-callback (lambda (_ignored) callback))) - (funcall eldoc-documentation-strategy)))) + (lambda () + (let ((eldoc-documentation-functions doc-funs)) + (eldoc-print-current-symbol-info)))) (and eldoc-documentation-function (symbol-value 'eldoc-documentation-function)))) (puthash lang doc-func org-eldoc-local-functions-cache)) @@ -133,7 +132,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 (&rest args) +(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 @@ -166,12 +165,9 @@ (defun org-eldoc-documentation-function (&rest args) (string= lang "go") (string= lang "golang")) (when (require 'go-eldoc nil t) (go-eldoc--documentation-function))) - (t (let ((doc-fun (org-eldoc-get-mode-local-documentation-function lang)) - (callback (car args))) + (t (let ((doc-fun (org-eldoc-get-mode-local-documentation-function lang))) (when (functionp doc-fun) - (if (functionp callback) - (funcall doc-fun callback) - (funcall doc-fun))))))))) + (funcall doc-fun)))))))) ;;;###autoload (defun org-eldoc-load ()