From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#41531: 27.0.91; Better handle asynchronous eldoc backends Date: Wed, 03 Jun 2020 19:07:37 +0100 Message-ID: <875zc8nhue.fsf@gmail.com> References: <875zckuet9.fsf@gmail.com> <4987863b-d390-5f87-eb1c-2cca4f4b7262@yandex.ru> <87blmbrlda.fsf@gmail.com> <87pnaqrae9.fsf@gmail.com> <877dwyr7b9.fsf@gmail.com> <871rn6r0pr.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="15230"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Christopher Wellons , Dmitry Gutov , andreyk.mad@gmail.com, 41531@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 03 20:08:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jgXoA-0003sE-PL for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Jun 2020 20:08:10 +0200 Original-Received: from localhost ([::1]:39526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgXo9-0005gq-FV for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Jun 2020 14:08:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgXo2-0005gg-Co for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2020 14:08:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:32993) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jgXo2-0000r9-40 for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2020 14:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jgXo1-0006YL-Un for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2020 14:08:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Jun 2020 18:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41531 X-GNU-PR-Package: emacs Original-Received: via spool by 41531-submit@debbugs.gnu.org id=B41531.159120766925170 (code B ref 41531); Wed, 03 Jun 2020 18:08:01 +0000 Original-Received: (at 41531) by debbugs.gnu.org; 3 Jun 2020 18:07:49 +0000 Original-Received: from localhost ([127.0.0.1]:44539 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jgXno-0006Xu-Mh for submit@debbugs.gnu.org; Wed, 03 Jun 2020 14:07:48 -0400 Original-Received: from mail-wm1-f51.google.com ([209.85.128.51]:55821) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jgXnm-0006Xd-06 for 41531@debbugs.gnu.org; Wed, 03 Jun 2020 14:07:47 -0400 Original-Received: by mail-wm1-f51.google.com with SMTP id c71so2792899wmd.5 for <41531@debbugs.gnu.org>; Wed, 03 Jun 2020 11:07:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-transfer-encoding; bh=YhkHaOYvVZReJOV3EtfsOXmD0b1cweClyD2c5FNJIac=; b=YNwNLjLbO9wr/Ou7MsnAIfhYa0FRT5ZB85LeBIDsSl/OSYhRev+/Snqu8rU2KdPFGJ fq9H5vWppxScEOQqGi7tveVxq+io5fSNwFqGQqHj6MS59UVLw5DzyIz54u/f+1bJjMyI uqG3EOLsJIcLugmhb8OPVG9H6/sKs7s9o1shMa6MjHfy6qe/P2aojfjwGonfDW/YHMLh uSy02W5D8mr8lXzF5h4AImeesDL+8D8+xjuYfc9b3vADw3Ys+IttFi+ZBh1PBCx1b3MM l6QsGcJTES3N3EoWGUUWVjRoCniaqVMj6OPNFkA71/mhH0kmxIA5RTJWAMzcCbRkN0db r06A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-transfer-encoding; bh=YhkHaOYvVZReJOV3EtfsOXmD0b1cweClyD2c5FNJIac=; b=nvi6GLVQY3rJkCCaEXLrzMkLIkyK1phDy+vqU13iFL8sA22u3vpOkwzXsG5Vu1MSKk XUBCtDCAwv6Ssa6FCUvoyuN69ijUPeN9uImQPcoK2m2Jz3coA/UKOjrmlaQ4KPYyHfXh ecvGdQVSJuQao4KLdM6FeipVQy358er9wbSZnERDjJS2DX0DmFA66HU458/s+i4X/Z0t 22+1NvbOcZTANagRmsX4qsFG6jrN+rlXF4gNUeUN2b/SjUAXM3IaPAPEAiTclTW8zeSs VxcMycsUI6qZPCCDNdyD6rUchKdwk/+gA/m4I7XyrZ8vo3JG1qeZrq/tLMhev8AB6SAI vFcg== X-Gm-Message-State: AOAM531xPZcP73ipB55lI1EgO+6yrD2yXMe9ki+2tXVLNlRL+UDOX7by vPwa8tKylw2fe41FClLPFNE= X-Google-Smtp-Source: ABdhPJz9t1LiBgrdBlk36ZJJlhfpYORQaZa7Sc1JHOzckX9XS+FJ8oWn3x9UpdkgcVAdIiewJsYhgQ== X-Received: by 2002:a1c:544d:: with SMTP id p13mr376788wmi.25.1591207660103; Wed, 03 Jun 2020 11:07:40 -0700 (PDT) Original-Received: from krug ([89.180.148.153]) by smtp.gmail.com with ESMTPSA id b187sm4193939wmd.26.2020.06.03.11.07.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2020 11:07:38 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Tue, 02 Jun 2020 22:45:42 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:181471 Archived-At: Stefan Monnier writes: > "Future object." >> + (value 'eldoc-future--unset) >> + callback) >> + >> +(defun eldoc-future-set (f v) >> + "" Ahem. >> + (cl-assert (eq (eldoc-future--value f) 'eldoc-future--unset)) >> + (setf (eldoc-future--value f) v) >> + (when (eldoc-future--callback f) >> + (funcall (eldoc-future--callback f) v))) >> + >> +(defun eldoc-future-set-callback (f c) >> + "" Ahem hem :-) >> + > > "Special hook run to get the documentation string at point. > Each function is called with no argument and should return either nil > or an `eldoc-future` object that should have its `value` set as soon > as possible via `eldoc-future-set-value` (it can be set before > returning the future or at a later time). > This value should be a string, typically occupying only a single line. Sometimes clients want to return more than one value, i.e. set more than one value. In this case it would be, for instance, the type of the docstring being returns (function signature, value of a variable, etc). The callback strategy makes it easy because there are lambda lists of all shapes and sizes. How does the future approach handle this? Do clients return structured lists of things? > In case the function ends up finding no information it is allowed > not to `eldoc-future-set-value` at all." This is problematic. In the eldoc-documentation-compose situation we need to wait for every backend to reply before composing. In other situation, indeed we can be greedy. But I don't think you can just say to clients they dont'need to do anything. If they returned the future they are making _a promise_. If they don't fullfil it something goes wrong. The callback case is the same, if you return non-nil non-string, you, the eldoc function, are _required_, by Eldoc law, to call it, even if with nil. The equivalent in futures is just to say clients can set the value nil, or some other application-specific indication of "sorry, I failed". > each `eldoc-documentation-function` which chooses its own callback > rather than being chosen by their caller. For this to work, i.e. to be able to handle multiple responses, I think it has to be set by their caller, i.e. eldoc-print-current-symbol-info: that's the central "hub" that maintains information about how many backends have responded and how many haven't. But indeed that's only an implementation detail. If you can make the defined behaviour work work in some other simpler way, I have no objections, of course. Jo=C3=A3o