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 uJBELId6Z19XawAA0tVLHw (envelope-from ) for ; Sun, 20 Sep 2020 15:51:35 +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 GDcVKId6Z1/1dwAAB5/wlQ (envelope-from ) for ; Sun, 20 Sep 2020 15:51:35 +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 0AB24940224 for ; Sun, 20 Sep 2020 15:51:34 +0000 (UTC) Received: from localhost ([::1]:43196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kK1ci-0000FO-Ui for larch@yhetil.org; Sun, 20 Sep 2020 11:51:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kK1b6-0000DK-0u for emacs-orgmode@gnu.org; Sun, 20 Sep 2020 11:49:53 -0400 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]:36172) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kK1b3-0004Iu-LQ; Sun, 20 Sep 2020 11:49:51 -0400 Received: by mail-qk1-x72f.google.com with SMTP id q63so12398481qkf.3; Sun, 20 Sep 2020 08:49:48 -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=8AkmRgCVpaeSWzFJkwu0aXn7b7OlETn06IVAic987xk=; b=WYGYAbmjDkC/duUcWWv8iPvQlNNTuRRz47BMxL37Vcs+mRWTCYGDV9crq2ayIv6OGE sgipypkAK+MynymxEbakZmfVptau3sk4OFH7e9tUFwyOnUlOqY3TvIuVzPc/8uVzNmf/ OaapKu9NhQpcesqvqzs0sMtq2Oh51tOC36M7FSc1qmbFx9N6pYJAaayxtLCxA3Spy914 MxU2qVf85/R0OJWeElySC7bvHkgQjy5EsO2JbpCxMbLglfTa7PZmge55c1yroyiydUgk bBk70MW2tgVIysjw/CdNgPQuNpU+6eOB7GBMMpQ7rIOh3CIgMbp9aKqdfgUPFebRlcVh K5Jw== 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=8AkmRgCVpaeSWzFJkwu0aXn7b7OlETn06IVAic987xk=; b=PBOWc6m8t9WrNuJ6/jhGcLn+MRdECZ2e8M9aNKZzb76QXJizlu5F0VMkVxYY+3PV9B VOoW3hWm3SRynGxw+dD7xZnJdgmpdb2bNGkEosVgLPGh1lDujbFnlmhn/bMjZ5rxGmyL 1f8mOs9CUJ94jtj4ig8twi0KHEGXAEnqphzJsW5AHwqmrzBsHyDtv9AIxIVsaGXg67ZC eabXh28f+1GMyvyI0T9c0ku2Hg/XdNVNyA+eKNka4PfYydF0ZmHTiK/2Lo1UqWkWzUNo RugBNJYZ/AlLuW19DbAL0DQh3hJ9uNmyRVKFX0xZtCKH1Fb6rzQVWH0qNw54llR4K10V 6GMg== X-Gm-Message-State: AOAM533ChGN/R7osMryBXGlHpJXkq16kVTH431QXLJ620UrshQ/EC+vI Y07pSWsllOGNtENQYdgdwzQ= X-Google-Smtp-Source: ABdhPJxehknY+PiH1UTfiaDz4lUibaC+1Db5z1NISX+GasmD1cbOt68Ec56O8Eflenid/c+hWVdXog== X-Received: by 2002:a37:6a47:: with SMTP id f68mr1707312qkc.148.1600616988189; Sun, 20 Sep 2020 08:49:48 -0700 (PDT) Received: from gonk ([2607:f2c0:e360:1126:b071:eead:590b:5fdd]) by smtp.gmail.com with ESMTPSA id m36sm7285111qtd.10.2020.09.20.08.49.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2020 08:49:47 -0700 (PDT) From: James N. V. Cash To: Kyle Meyer Subject: Re: eldoc recursion error In-Reply-To: <87mu1kxxzm.fsf@gmail.com> References: <87tuvtvyig.fsf@kyleam.com> <87mu1kxxzm.fsf@gmail.com> Date: Sun, 20 Sep 2020 11:49:46 -0400 Message-ID: <87k0woxxb9.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::72f; envelope-from=james.nvc@gmail.com; helo=mail-qk1-x72f.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.249, 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=WYGYAbmj; 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: fhnNLLGpR4v8 --=-=-= Content-Type: text/plain James N. V. Cash writes: > I was just thinking more about this, and I'm concerned I might need to > change things around a little bit more. The closure that > org-eldoc-get-mode-local-documentation-function now returns under Emacs > 28 doesn't take any arguments and instead lets the > eldoc-documentation-strategy function create its own new callback. > > I think the current approach will appear to work when the documentation > function returns a value directly, but if it uses the callback, then I > think that it won't, since it invokes a new, separate callback. > > I will take another crack at addressing this and send another patch shortly. 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Address-org-eldoc-recursion-issue.patch Content-Description: org eldoc recursion patch >From 028675e460d12711ba4b91bf576b35e307a0e640 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 | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/contrib/lisp/org-eldoc.el b/contrib/lisp/org-eldoc.el index 3b0999340..b86ad1f39 100644 --- a/contrib/lisp/org-eldoc.el +++ b/contrib/lisp/org-eldoc.el @@ -1,4 +1,4 @@ -;;; org-eldoc.el --- display org header and src block info using eldoc +;;; org-eldoc.el --- display org header and src block info using eldoc -*- lexical-binding: t; -*- ;; Copyright (c) 2014-2020 Free Software Foundation, Inc. @@ -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)) doc-func) cached-func))) @@ -127,7 +133,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 (&rest args) "Return breadcrumbs when on a headline, args for src block header-line, calls other documentation functions depending on lang when inside src body." (or @@ -160,8 +166,12 @@ (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))) - (when (functionp doc-fun) (funcall doc-fun)))))))) + (t (let ((doc-fun (org-eldoc-get-mode-local-documentation-function lang)) + (callback (car args))) + (when (functionp doc-fun) + (if (functionp callback) + (funcall doc-fun callback) + (funcall doc-fun))))))))) ;;;###autoload (defun org-eldoc-load () -- 2.25.1 --=-=-=--