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 kNrRDuz8Z18yXAAA0tVLHw (envelope-from ) for ; Mon, 21 Sep 2020 01:07:56 +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 0MC0Cuz8Z1/MKAAA1q6Kng (envelope-from ) for ; Mon, 21 Sep 2020 01:07:56 +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 933D19402B2 for ; Mon, 21 Sep 2020 01:07:54 +0000 (UTC) Received: from localhost ([::1]:42868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKAJ5-0006Tf-NR for larch@yhetil.org; Sun, 20 Sep 2020 21:07:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKAIb-0006TV-4n for emacs-orgmode@gnu.org; Sun, 20 Sep 2020 21:07:21 -0400 Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]:42861) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kKAIZ-0000q4-DM; Sun, 20 Sep 2020 21:07:20 -0400 Received: by mail-qk1-x735.google.com with SMTP id v123so13371132qkd.9; Sun, 20 Sep 2020 18:07:18 -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=gCGSkfJ1yQhVUzftA+5Z5o4u/N2XmPmIppjq6vN8SOE=; b=Kn6V4UfD3zCeAG+t7cgXnKxSrxjCXgCH5FAl2zgl5gGZVMAi2IFedNiWyvaK54HVQj QkFtnK/996wNcX0fTr2trmRc2DAagfOCV/2XHHAiKieL41nat8sYx2Cw7wt2Lr1U4HhR 9BymyJeTCHqGS60fl565oMWKSBkp3FgDh8vQFD9reu+HrfuYKVzdqPMQgcj+4mzqw6an 03/MgND+q1eD5BGs3tM/LiJxuwbKzFBSMuGRoCxu1EhzKKsf5LbdSl/6L7Vziy2Fe4/8 wlagaJ6eK0JVDNE4LCWtJ9/Su4IKfOZjGPp7cyvV7pgssqB9sRDm2IVYcK8Ab0qcaay7 0MHw== 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=gCGSkfJ1yQhVUzftA+5Z5o4u/N2XmPmIppjq6vN8SOE=; b=i7l5yY8ZQq6xY3VSxWJbVCSTngY976QhIsf45KcigFLhFQMRPd7Ucg2a5fkYyd8Vtg 48RR1ObHe/MmWDssGJqsKV89xrx5NXUH0c/BDOzzK5nXvVPtQ+r/boHmTc6kj7hby0KW Yu7X67T9sPjXbX6LWN6Grd0+kUcTVYkvlgkAIZqL7YWArP9kTs7ziWuAVoFP3r9lgDHc uQgIzMXljM3QYAGieCy0tFTjqEJ9UoUa4TP+SUdPQ+9ey6KrQOWVxIoFsQUrfkC2uRcX VbxfiYq7rjKVmz1diC68YugYZ+kJ0MUB/0rvwXFOhuSIIJI+VfzwBHTsiohOsHL0hTVY VEeQ== X-Gm-Message-State: AOAM532k7msCjZ6ETTMdDRuJDzBanHRCoW64GxlGtIzJVGkqTF9dhboi k7Szp1RDiiwi+FWWjtOpmWI= X-Google-Smtp-Source: ABdhPJwAna5xdoCY+5sgKUQ5f8p6lS09h1cow+UXa29wAeG7wcKWh+tP8UJCgQhXUqvibPlTcDPqqA== X-Received: by 2002:a37:a09:: with SMTP id 9mr45505208qkk.258.1600650438060; Sun, 20 Sep 2020 18:07:18 -0700 (PDT) Received: from gonk ([2607:f2c0:e360:1126:b071:eead:590b:5fdd]) by smtp.gmail.com with ESMTPSA id s10sm7911835qkg.61.2020.09.20.18.07.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2020 18:07:17 -0700 (PDT) From: James N. V. Cash To: Kyle Meyer Subject: Re: eldoc recursion error In-Reply-To: <87k0wovx1v.fsf@kyleam.com> References: <87tuvtvyig.fsf@kyleam.com> <87mu1kxxzm.fsf@gmail.com> <87k0woxxb9.fsf@gmail.com> <87k0wovx1v.fsf@kyleam.com> Date: Sun, 20 Sep 2020 21:07:15 -0400 Message-ID: <877dsox7i4.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::735; envelope-from=james.nvc@gmail.com; helo=mail-qk1-x735.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=Kn6V4UfD; 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: fSYb5uilIU93 --=-=-= Content-Type: text/plain Kyle Meyer writes: > 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. Yeah, good point. I was doing that so I could honour the setting of eldoc-documentation-strategy. I don't know if that's going to be a concern in practice though. > 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: My concern with using the eldoc-print-current-symbol-info is that it's now somewhat subverting the actual eldoc documentation function -- i.e. the invocation of org-eldoc-documentation-function now "fails" and instead it prints out the actual documentation as a side-effect. Indeed, applying that patch makes the eldoc for python code blocks not work correctly. The below patch which essentially just inlines the definition of eldoc-documentation-default, so it's not messing around with any private variables in eldoc, although it now won't honour the documentation strategy. It remains to be seen if that will be an issue in practice, but if necessary we could just check the value of eldoc-documentation-strategy and behave appropriately. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Address-org-eldoc-recursion-issue.patch Content-Description: org eldoc recursion patch >From 7d59ecadbea429626bae90464d76f01b60c8d67f 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 | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/contrib/lisp/org-eldoc.el b/contrib/lisp/org-eldoc.el index 3b0999340..946a57273 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,18 @@ 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)) + (run-hook-with-args-until-success + 'eldoc-documentation-functions + callback)))) + (and eldoc-documentation-function + (symbol-value 'eldoc-documentation-function)))) + (puthash lang doc-func org-eldoc-local-functions-cache)) doc-func) cached-func))) @@ -127,7 +134,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 +167,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 --=-=-=--