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 uErrINd9Y1+1awAA0tVLHw (envelope-from ) for ; Thu, 17 Sep 2020 15:16:39 +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 AO7RHNd9Y1+zBgAAB5/wlQ (envelope-from ) for ; Thu, 17 Sep 2020 15:16:39 +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 70A3A940919 for ; Thu, 17 Sep 2020 15:16:38 +0000 (UTC) Received: from localhost ([::1]:51090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kIveE-0004V7-RD for larch@yhetil.org; Thu, 17 Sep 2020 11:16:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIvRS-0003Qj-C2 for emacs-orgmode@gnu.org; Thu, 17 Sep 2020 11:03:22 -0400 Received: from mail-qt1-x82d.google.com ([2607:f8b0:4864:20::82d]:47025) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kIvRO-0001E4-DB; Thu, 17 Sep 2020 11:03:21 -0400 Received: by mail-qt1-x82d.google.com with SMTP id r8so2053394qtp.13; Thu, 17 Sep 2020 08:03:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=MTjfqs/DO3j+SpfGO68W0UezjkC1qLc67iDdlhbUwOc=; b=Z1XTEGVIvw/67uNZKIYrDYr3F7kaYPDBnTF9fzP0iIV2SB81OLfk9PtdNeRlmv4X/n IU0bRTIF4ZK0oszhhJ88HdQkCpe68t4q78g2F0UtxKPm22ANGXaJMEMLpDeUuS2i2FTn pL3gMyLrHfBuHKgPbEsssq0UqRCI+P1JhdHVpbX8Z6BJ880ASuCKzQa6E/DGSAYas0vN 56nUpQ86zBLJvE7fwwxl3xKV70WDnopK2qGcn1Or7EfIr/3TwEafE5GEjfFt74Xlvnge uYRssIfWbWQSzCulKgejwUf1Zhzpp+SXW54EeMX6Tg6L3r1V9u+OViCK6EiIwWex+4vO G5NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:cc:subject:in-reply-to :references:date:message-id:mime-version; bh=MTjfqs/DO3j+SpfGO68W0UezjkC1qLc67iDdlhbUwOc=; b=kaL6wL4OHye9l5/SVo8akMoxVUksc2szhGBk4wMmCCA9CYEEsSHND8+H7bSFZU956l m4aTIL1A6Ac6o7NNVR5tbQzE+F3tqemn9jYUcNyvVpaarVFY1QzDbtk9O0F5stYD59jz YG9UGEeW3tSo82/6hlqPS27RkvrIzuGpPgOTuwfc8hjbdcFu6o/yQjcU1so7Q62ixOGk GN6C8i+irNo63kczQjAsjHn2zngvTK3hzzXmif+Hv4jzW3I2TH46C6ksr/2lnDd32Laz NqixH02My7td8hpR91K7OCT0pC9fCicc1bfcogYRziXKZiFM5ehUumzB8cQHFXh9Xzua KZag== X-Gm-Message-State: AOAM531zG2sSkb+f8vo3LLZ2N6jB3He+8h8O/zamiDHAxh/p7F/JKpHu dLz9o0Z4Fjpuqt2BBFQcfdY= X-Google-Smtp-Source: ABdhPJwgBmtfBiwzCqUC2zDifmbmdJ8LO7dXd/MOx8ENuN3co66N3Sfs1k7bGNijV+8lj45ylJtmFw== X-Received: by 2002:ac8:1b3d:: with SMTP id y58mr27602282qtj.10.1600354994304; Thu, 17 Sep 2020 08:03:14 -0700 (PDT) Received: from gonk ([2607:f2c0:e360:1126:3828:532d:3761:fe34]) by smtp.gmail.com with ESMTPSA id i62sm28192qkf.36.2020.09.17.08.03.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2020 08:03:12 -0700 (PDT) From: James N. V. Cash To: Kyle Meyer Subject: Re: eldoc recursion error In-Reply-To: <87a6xp80k6.fsf@kyleam.com> References: <87a6xp80k6.fsf@kyleam.com> Date: Thu, 17 Sep 2020 11:03:11 -0400 Message-ID: <878sd88mz4.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::82d; envelope-from=james.nvc@gmail.com; helo=mail-qt1-x82d.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: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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=gmail.com header.s=20161025 header.b=Z1XTEGVI; 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: K5h6fsFDa92+ --=-=-= Content-Type: text/plain Kyle Meyer writes: > Thanks for the patch! For information about the expected commit message > format, please see . Ah will do, thanks! I'm still learning how to work with the email & patch-based workflow. > 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. Ah yes, very true. I've attached another patch, which tries to better preserve how the new eldoc strategy works, by passing through the callback to the mode-local eldoc function if available, which will be a closure over the configured documentation strategy with eldoc-documentation-functions bound to the appropriate mode-local value. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Address-org-eldoc-recursion-issue.patch Content-Description: Revised org eldoc patch >From 4c2042c9e3820d88cd655cf01d572b9686a40d31 Mon Sep 17 00:00:00 2001 From: "James N. V. Cash" Date: Thu, 17 Sep 2020 10:51:13 -0400 Subject: [PATCH] Address org-eldoc-recursion issue * org-eldoc.el (org-eldoc-get-mode-local-documentation-function, org-eldoc-documentation-function): Support Emacs 28-style eldoc, where instead of a single function, the eldoc-documentation-functions hook has a list of functions, which may optionally take a callback. --- contrib/lisp/org-eldoc.el | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/contrib/lisp/org-eldoc.el b/contrib/lisp/org-eldoc.el index 3b0999340..85e238e64 100644 --- a/contrib/lisp/org-eldoc.el +++ b/contrib/lisp/org-eldoc.el @@ -116,8 +116,13 @@ (when (fboundp mode-func) (with-temp-buffer (funcall mode-func) - (setq doc-func (and eldoc-documentation-function - (symbol-value 'eldoc-documentation-function))) + (setq doc-func (if (boundp 'eldoc-documentation-functions) + (lexical-let ((doc-funs (symbol-value 'eldoc-documentation-functions))) + (lambda () + (let ((eldoc-documentation-functions doc-funs)) + (funcall eldoc-documentation-strategy)))) + (and eldoc-documentation-function + (symbol-value 'eldoc-documentation-function)))) (puthash lang doc-func org-eldoc-local-functions-cache)) doc-func) cached-func))) @@ -127,7 +132,7 @@ (declare-function php-eldoc-function "php-eldoc" ()) (declare-function go-eldoc--documentation-function "go-eldoc" ()) -(defun org-eldoc-documentation-function (&rest _ignored) +(defun org-eldoc-documentation-function (&optional callback) "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,7 +166,12 @@ (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))) - (when (functionp doc-fun) (funcall doc-fun)))))))) + (when (functionp doc-fun) + (if (functionp callback) + (condition-case nil + (funcall doc-fun callback) + (wrong-number-of-arguments (funcall doc-fun))) + (funcall doc-fun))))))))) ;;;###autoload (defun org-eldoc-load () -- 2.25.1 --=-=-=--