1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-04 02:51:31 -08:00
emacs/doc/lispref
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
..
abbrevs.texi Remove #' and function quoting from lambda forms in manual 2020-04-19 13:19:37 +02:00
anti.texi ; * doc/lispref/anti.texi (Antinews): Fix typo. 2020-01-11 14:14:11 +01:00
back.texi Update copyright year to 2020 2020-01-01 00:59:52 +00:00
backups.texi Remove #' and function quoting from lambda forms in manual 2020-04-19 13:19:37 +02:00
book-spine.texi
buffers.texi Update copyright year to 2020 2020-01-01 00:59:52 +00:00
ChangeLog.1 Update copyright year to 2020 2020-01-01 00:59:52 +00:00
commands.texi Update copyright year to 2020 2020-01-01 00:59:52 +00:00
compile.texi Document that 'byte-compile-dynamic' is obsolete 2020-03-07 14:23:23 +02:00
control.texi Don't use 'cl' functions in ELisp manual's examples 2020-06-20 10:29:37 +03:00
customize.texi Fix typo in "(elisp) Type Keywords" 2020-06-07 16:46:12 +01:00
debugging.texi Fix some Texinfo markup 2020-06-17 13:07:51 +01:00
display.texi Merge from origin/emacs-27 2020-07-07 07:50:40 -07:00
doclicense.texi Merge from Gnulib 2017-10-01 18:31:10 -07:00
edebug.texi Merge from origin/emacs-27 2020-05-28 07:50:26 -07:00
elisp.texi Don’t use “constant” for values you shouldn’t change 2020-05-16 18:24:07 -07:00
errors.texi Clean up D-Bus documentation (bug#41744) 2020-06-08 18:19:50 +01:00
eval.texi Don’t use “constant” for values you shouldn’t change 2020-05-16 18:24:07 -07:00
files.texi Merge from origin/emacs-27 2020-06-17 08:47:53 -07:00
frames.texi Merge from origin/emacs-27 2020-07-07 07:50:40 -07:00
functions.texi Remove #' and function quoting from lambda forms in manual 2020-04-19 13:19:37 +02:00
gpl.texi Merge from Gnulib 2017-10-01 18:31:10 -07:00
hash.texi Update copyright year to 2020 2020-01-01 00:59:52 +00:00
help.texi Remove #' and function quoting from lambda forms in manual 2020-04-19 13:19:37 +02:00
hooks.texi Update copyright year to 2020 2020-01-01 00:59:52 +00:00
index.texi
internals.texi ; * doc/lispref/internals.texi (Module Misc): Fix version 2020-03-29 10:22:35 +02:00
intro.texi Update copyright year to 2020 2020-01-01 00:59:52 +00:00
keymaps.texi Merge from origin/emacs-27 2020-04-20 07:50:19 -07:00
lay-flat.texi Update copyright year to 2020 2020-01-01 00:59:52 +00:00
lists.texi Don’t use “constant” for values you shouldn’t change 2020-05-16 18:24:07 -07:00
loading.texi Merge from origin/emacs-27 2020-05-28 07:50:26 -07:00
macros.texi Update copyright year to 2020 2020-01-01 00:59:52 +00:00
Makefile.in Prefer saying "Info manual" to "info page" in docs 2020-01-23 14:44:27 +01:00
maps.texi Update copyright year to 2020 2020-01-01 00:59:52 +00:00
markers.texi Update copyright year to 2020 2020-01-01 00:59:52 +00:00
minibuf.texi Merge from origin/emacs-27 2020-03-07 07:50:28 -08:00
modes.texi Better handle asynchronous Eldoc sources 2020-07-08 11:25:33 +01:00
nonascii.texi Revert markup change in with-coding-priority docs 2020-06-13 17:54:51 +01:00
numbers.texi Clarify when fixnums are used. 2020-02-17 13:54:36 -08:00
objects.texi Merge from origin/emacs-27 2020-05-23 07:50:29 -07:00
os.texi Merge from origin/emacs-27 2020-06-17 08:47:53 -07:00
package.texi Update copyright year to 2020 2020-01-01 00:59:52 +00:00
positions.texi Update copyright year to 2020 2020-01-01 00:59:52 +00:00
processes.texi Introduce process-file-return-signal-string 2020-05-16 14:04:07 +02:00
README Update copyright year to 2020 2020-01-01 00:59:52 +00:00
records.texi Update copyright year to 2020 2020-01-01 00:59:52 +00:00
searching.texi Regexps cannot infloop; fix manual 2020-05-03 14:27:51 +02:00
sequences.texi Don’t use “constant” for values you shouldn’t change 2020-05-16 18:24:07 -07:00
spellfile Update lispref spellfile 2019-06-04 08:34:16 -07:00
streams.texi * doc/lispref/streams.texi (Output Functions): Improve indexing. 2020-01-25 19:15:32 +01:00
strings.texi Fix and extend format-spec (bug#41758) 2020-06-18 12:46:21 +01:00
symbols.texi Update copyright year to 2020 2020-01-01 00:59:52 +00:00
syntax.texi Remove #' and function quoting from lambda forms in manual 2020-04-19 13:19:37 +02:00
text.texi Use getrandom syscall for nonces 2020-06-27 13:03:49 -07:00
threads.texi Update copyright year to 2020 2020-01-01 00:59:52 +00:00
tips.texi Recommend to avoid unnecessary abbreviations in doc 2020-04-30 18:02:28 +02:00
two-volume-cross-refs.txt Update copyright year to 2020 2020-01-01 00:59:52 +00:00
two-volume.make Update copyright year to 2020 2020-01-01 00:59:52 +00:00
variables.texi Document changes in lexical-binding 2020-03-07 13:32:52 +02:00
windows.texi Merge from origin/emacs-27 2020-04-15 07:50:15 -07:00

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Copyright (C) 2001-2020 Free Software Foundation, Inc.  -*- outline -*-
See the end of the file for license conditions.


README for the Emacs Lisp Reference Manual.

* This directory contains the texinfo source files for the Emacs Lisp
Reference Manual.

* Report bugs in the Lisp Manual (or in Emacs) using M-x report-emacs-bug.
To ask questions, use the help-gnu-emacs mailing list.

* The Emacs Lisp Reference Manual is quite large.  It totals around
1100 pages in smallbook format; the info files total around 3.0 megabytes.

* You can format this manual for Info, for printing hardcopy using TeX,
or for HTML.

* You can buy nicely printed copies from the Free Software Foundation.
Buying a manual from the Free Software Foundation helps support our GNU
development work.  See <https://shop.fsf.org/>.
(At time of writing, this manual is out of print.)

* The master file for formatting this manual for Tex is called 'elisp.texi'.
It contains @include commands to include all the chapters that make up
the manual.

* This distribution contains a Makefile that you can use with GNU Make.

** To make an Info file, you need to install Texinfo, then run 'make info'.

** Use 'make elisp.pdf' or 'make elisp.html' to create PDF or HTML versions.


This file is part of GNU Emacs.

GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.