emacs/lisp/emacs-lisp
João Távora a7a53f0d79 Better handle asynchronous Eldoc sources
This is a backward compatible redesign of significant parts of the
eldoc.el library.

Previously, Eldoc clients (major/minor modes setting its documentation
gathering variables) needed to directly call eldoc-message, an
internal function, to display the docstring to the user.  When more
asynchronous sources are involved, this is hard to do or even breaks
down.

Now, an Eldoc backend may return any non-nil, non-string value and
call a callback afterwards.  This restores power to Eldoc over how
(and crucially also when) to display the docstrings to the user.

Among other things, this fixes so called "doc blinking", or the very
short-lived display of a lower priority Eldoc message.  This would
happen if a particular producer of documentation finishes shortly
before a higher priority one, like in the LSP engine Eglot as reported
by Andrii Kolomoiets <andreyk.mad@gmail.com> and Dmitry Gutov
<dgutov@yandex.ru>.

Gathering docstrings is now delegated to the variable
eldoc-documentation-strategy, which is the new name for the
now-obsolete eldoc-documentation-function, and still accepts the
so-called "old protocol".  Examples of the new strategies enabled are
codified in functions such as eldoc-documentation-enthusiast,
eldoc-documentation-compose-eagerly, along with the existing
eldoc-documentation-compose and eldoc-documentation-default.

The work of displaying and formatting docstrings is shifted almost
fully to Eldoc itself and is delegated to the internal function
eldoc--handle-docs.  Among other improvements, it handles most of
eldoc-echo-area-use-multiline-p and outputs documentation to a
temporary *eldoc* buffer.

The manual and NEWS are updated to mention the new Eldoc features.

* lisp/emacs-lisp/eldoc.el (eldoc-documentation-functions):
Overhaul docstring.
(eldoc-documentation-compose, eldoc-documentation-default): Handle
non-nil, non-string values of elements of
eldoc-documentation-functions.  Use eldoc--handle-multiline.
(eldoc-print-current-symbol-info): Honour non-nil, non-string
values returned by eldoc-documentation-callback.
(eldoc--make-callback): Now also a function.
(eldoc-documentation-default, eldoc-documentation-compose): Tweak docstring.
(eldoc-documentation-enthusiast, eldoc-documentation-compose-eagerly):
New functions.
(eldoc-echo-area-use-multiline-p): Add new semantics.
(eldoc--handle-docs): Handle some of eldoc-echo-area-use-multiline-p.
(eldoc-doc-buffer): New command.
(eldoc-prefer-doc-buffer): New defcustom.
(eldoc--enthusiasm-curbing-timer): New variable.
(eldoc-documentation-strategy): Rename from eldoc-documentation-function.
(eldoc--supported-p): Use eldoc-documentation-strategy
(eldoc-highlight-function-argument)
(eldoc-argument-case, global-eldoc-mode)
(turn-on-eldoc-mode): Mention eldoc-documentation-strategy.
(eldoc-message-function): Mention eldoc--message.
(eldoc-message): Made obsolete.
(eldoc--message): New helper.

* lisp/hexl.el (hexl-print-current-point-info): Adjust to new
eldoc-documentation-functions protocol.

* lisp/progmodes/cfengine.el (cfengine3-documentation-function):
Adjust to new eldoc-documentation-functions protocol.

* lisp/progmodes/elisp-mode.el
(elisp-eldoc-documentation-function): Adjust to new
eldoc-documentation-functions protocol.

* lisp/progmodes/octave.el (octave-eldoc-function): Adjust to new
eldoc-documentation-functions protocol.

* lisp/progmodes/python.el (python-eldoc-function): Adjust to new
eldoc-documentation-functions protocol.

(eldoc-print-current-symbol-info): Rework with cl-labels.

* doc/emacs/programs.texi (Lisp Doc): Mention
eldoc-documentation-strategy.

* doc/lispref/modes.texi (Major Mode Conventions): Mention
eldoc-documentation-functions.

* etc/NEWS: Mention eldoc-documentation-strategy.
2020-07-08 11:25:33 +01:00
..
advice.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
autoload.el Merge from origin/emacs-27 2020-04-15 07:50:15 -07:00
avl-tree.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
backquote.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
backtrace.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
benchmark.el Revert last change in benchmark.el 2020-06-21 19:01:40 +01:00
bindat.el Add new tests to bindat-tests.el 2020-04-29 09:52:34 +02:00
byte-opt.el Optimise assoc and rassoc with symbol key to assq and rassq 2020-07-07 17:55:20 +02:00
byte-run.el Merge from origin/emacs-27 2020-05-09 10:03:21 -07:00
bytecomp.el Merge from origin/emacs-27 2020-06-01 22:26:32 -07:00
cconv.el Remove generation of old bytecodes for catch/unwind 2020-01-05 11:19:52 +01:00
chart.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
check-declare.el Use lexical-binding in check-declare.el and add tests 2020-05-03 19:50:57 +02:00
checkdoc.el Merge from origin/emacs-27 2020-04-20 07:50:19 -07:00
cl-extra.el Make cl-concatenate an alias of seq-concatenate 2020-03-23 18:58:21 -04:00
cl-generic.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
cl-indent.el Remove redundant :groups args missed in last commit 2020-05-03 16:21:51 +02:00
cl-lib.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
cl-macs.el * lisp/emacs-lisp/cl-macs.el (cl-deftype-satisfies): Add keyword 2020-07-06 18:04:54 -04:00
cl-preloaded.el Fix copyright years by hand 2020-01-01 01:01:53 +00:00
cl-print.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
cl-seq.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
copyright.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
crm.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
cursor-sensor.el * lisp/emacs-lisp/cursor-sensor.el (cursor-sensor--detect): Change last fix 2020-02-24 09:55:09 -05:00
debug.el * lisp/emacs-lisp/debug.el (debug): Merge the non-interactive cases 2020-01-31 16:09:42 +02:00
derived.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
disass.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
easy-mmode.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
easymenu.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
edebug.el Fix bug #40992 whilst still allowing breakpoint highlights in edebug 2020-05-11 20:05:54 +00:00
eieio-base.el Revert "Inhibit modification hooks when saving eieio-persistent's" 2020-05-12 21:06:22 +02:00
eieio-compat.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
eieio-core.el Un-deprecate oset and oset-default 2020-06-06 17:24:00 +01:00
eieio-custom.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
eieio-datadebug.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
eieio-opt.el Replace add-hook load-hook with with-eval-after-load 2020-01-16 21:21:29 -08:00
eieio-speedbar.el Replace add-hook load-hook with with-eval-after-load 2020-01-16 21:21:29 -08:00
eieio.el Un-deprecate oset and oset-default 2020-06-06 17:24:00 +01:00
eldoc.el Better handle asynchronous Eldoc sources 2020-07-08 11:25:33 +01:00
elint.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
elp.el ; Fix some typos and doc issues (bug#40695) 2020-04-18 17:10:02 +02:00
ert-x.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
ert.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
ewoc.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
faceup.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
find-func.el load-library, locate-library: Use read-library-name 2020-04-03 14:54:49 +03:00
float-sup.el Use lexical-binding in float-sup.el and add tests 2020-04-29 09:25:02 +02:00
generator.el Band-aid for edebugging generator bodies (Bug#40434). 2020-06-14 20:01:28 +02:00
generic.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
gv.el Ensure that getters and setters can be edebugged at the same time. 2020-06-14 18:18:13 +02:00
helper.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
inline.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
let-alist.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
lisp-mnt.el Globally sanitize single-file package long descriptions (Bug#37548) 2020-01-23 22:57:23 +01:00
lisp-mode.el * lisp/emacs-lisp/lisp-mode.el: Add new indentation convention 2020-05-29 00:26:09 -04:00
lisp.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
macroexp.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
map-ynp.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
map.el * lisp/emacs-lisp/map.el: Add keyword-only pattern abbreviation 2020-02-04 12:30:31 -05:00
nadvice.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
package-x.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
package.el Evaluate some unnecessarily quoted lambdas 2020-06-21 13:42:14 +01:00
pcase.el * lisp/emacs-lisp/pcase.el (pcase--fgrep): Look inside vectors 2020-05-11 09:53:37 -04:00
pp.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
radix-tree.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
re-builder.el Fix void-variable n-reb in re-builder (Bug#40409) 2020-04-04 20:06:54 -04:00
regexp-opt.el Remove the optional KEEP-ORDER argument to regexp-opt 2020-02-13 20:43:42 +01:00
regi.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
ring.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
rmc.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
rx.el Various battery.el improvements (bug#41808) 2020-06-18 12:58:28 +01:00
seq.el Fix byte-compilation warning in project.el 2020-06-26 10:15:46 +03:00
shadow.el Fix edge case errors in filename-matching regexps 2020-04-14 12:25:16 +02:00
smie.el * lisp/emacs-lisp/package.elm lisp/emacs-lisp/smie.el: Fix indent 2020-05-29 15:01:58 -04:00
subr-x.el gnus-shorten-url: Improve and avoid args-out-of-range error 2020-04-13 12:12:00 +02:00
syntax.el Allow back-references in syntax-propertize-rules. 2020-05-19 20:50:14 +02:00
tabulated-list.el Move “Fix some broken conditional forms” to master 2020-01-05 11:50:31 -08:00
tcover-ses.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
tcover-unsafep.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
testcover.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
text-property-search.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
thunk.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
timer-list.el Support sorting timer-list-mode by column (Bug#40854) 2020-05-12 19:10:20 +02:00
timer.el Simplify run-at-time 2020-03-08 00:25:38 -08:00
tq.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
trace.el Clarify semantics of trace-function CONTEXT argument 2020-04-25 09:55:37 -04:00
unsafep.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
warnings.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00