Commit graph

203 commits

Author SHA1 Message Date
Po Lu
f396763818 Improve Eldoc text conversion support
* lisp/emacs-lisp/eldoc.el: ("back-to-indentation"): Register
touch screen and text conversion commands.
2023-06-02 16:24:42 +08:00
João Távora
83b5e9cd24 Eldoc: don't overdisplay if using eldoc-documentation-compose
bug#62816

This is about a particular value for 'eldoc-documentation-strategy',
'eldoc-documentation-compose'.  Its helper
'eldoc--documentation-compose-1' was buggy.  It created the callback
for all the backends in 'eldoc-documentation-functions', but arranged
so that it could potentially be invoked immediately and trigger
display, half-defeating the purpose of the "patience" and causing
blinking in the echo area.

Now it creates all the callbacks beforehand and only then passes them
to the corresponding members of eldoc-documentation-functions.  This
sets up the correct state in eldoc--invoke-strategy.

* lisp/emacs-lisp/eldoc.el (eldoc--documentation-compose-1):
Delete.
(eldoc-documentation-compose)
(eldoc-documentation-compose-eagerly): Rework.
2023-04-13 17:42:37 +01:00
João Távora
f2357df91f Eldoc: bump package version to 1.14.0
* lisp/emacs-lisp/eldoc.el (Version): Bump to 1.14.0
2023-04-02 23:40:46 +01:00
João Távora
87f025117b ; Eldoc: fix doc of e-d-functions w.r.t. :origin keyword
* lisp/emacs-lisp/eldoc.el (eldoc-documentation-functions): Fix.
2023-04-02 23:40:46 +01:00
Yuan Fu
f446bfc819
; * lisp/emacs-lisp/eldoc.el (eldoc-doc-buffer-separator): Fix doc. 2023-03-24 12:29:33 -07:00
João Távora
e79b4ccd79 Allow users to customize eldoc buffer separator (bug#62029)
* lisp/emacs-lisp/eldoc.el (eldoc-doc-buffer-separator): New
variable.
(eldoc--format-doc-buffer): Use it.
2023-03-24 17:37:42 +00:00
João Távora
a384401eab Eldoc: slightly enhance meaning of :echo option
Can now be a string to echo instead of a larger docstring.

* lisp/emacs-lisp/eldoc.el (eldoc-documentation-functions):
Describe :echo.
(eldoc--echo-area-render): Allow :echo to be string.
2023-03-24 17:37:42 +00:00
João Távora
541eec259b Eldoc: fix bug recently introduced in "old" protocol
In the "old" protocol, eldoc-documentation-strategy is actually used
as the deprecated eldoc-documentation-function and it is itself the
"origin" of the doc snippet to be displayed.

* lisp/emacs-lisp/eldoc.el (eldoc--invoke-strategy): Fix.
2023-03-24 15:08:50 +00:00
João Távora
e19994fe8c ElDoc: rework rendering of echo area (bug#62029)
Previously, the display function 'eldoc-display-in-echo-area' reused
the same buffer as 'eldoc-display-in-doc-buffer', but that made it
harder to render documentation items differently depending on the
specific constraints of each display functions.

Allow documentation-generating backends to pass an :echo-area property
for tweaking the echo area display of certain documentation items.

* lisp/emacs-lisp/eldoc.el (eldoc-documentation-functions): Update docstring.
(eldoc--doc-buffer-docs): Remove.
(eldoc--format-doc-buffer): Simplify.
(eldoc--echo-area-render): New helper.
(eldoc-display-in-echo-area): Use 'eldoc--echo-area-render'.
2023-03-23 21:14:18 +00:00
João Távora
9b18407c7f ElDoc: remember origin backend in doc snippets (bug#62029)
This lays groundwork for discriminating between different
documentation providers in ElDoc display outlets, i.e. members
of eldoc-display-functions

* lisp/emacs-lisp/eldoc.el (eldoc--make-callback): Take extra origin arg.
(eldoc-documentation-compose-1)
(eldoc-documentation-compose-eagerly)
(eldoc-documentation-default): Pass extra arg to eglot--make-callback.
(eldoc--invoke-strategy): Rework.
(eldoc-documentation-functions): Work docstring.
2023-03-23 21:14:15 +00:00
Dmitry Gutov
dff9657c6c Redirect eldoc messages to the mode-line when in edebug-mode
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message): Redirect
eldoc messages to the mode-line when in edebug-mode (bug#56459).
(eldoc-minibuffer--cleanup): New function, used in above.
2023-03-04 02:37:14 +02:00
Dmitry Gutov
a33d3ae98a Revert "Revert "Don't disable eldoc when doing edebug""
This reverts commit 99df815c15.
2023-03-04 02:27:35 +02:00
Eli Zaretskii
99df815c15 Revert "Don't disable eldoc when doing edebug"
This reverts commit 6fd1fb8a68.
It turns out ElDoc does show messages inside Edebug, if you
are (un)lucky enough to have point where ElDoc has something
to show.  Bug#56459 needs to be fixed in some more complex
way.
2023-03-01 17:35:51 +02:00
Yuan Fu
94e70ed426
; * lisp/emacs-lisp/eldoc.el (eldoc-display-in-echo-area): Fix typo. 2023-02-22 17:55:30 -08:00
Eli Zaretskii
cae528457c ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
Eli Zaretskii
8ce2b89aa1 Improve and extend documentation of ElDoc
* lisp/emacs-lisp/eldoc.el (eldoc-documentation-strategy)
(eldoc-documentation-enthusiast)
(eldoc-documentation-compose-eagerly)
(eldoc-documentation-compose, eldoc-documentation-default)
(eldoc-minibuffer-message, eldoc-idle-delay)
(eldoc-print-after-edit)
(eldoc-echo-area-display-truncation-message)
(eldoc-echo-area-use-multiline-p)
(eldoc-echo-area-prefer-doc-buffer): Doc string fixes.

* doc/emacs/emacs.texi (Top):
* doc/emacs/programs.texi (Documentation, Programming Language Doc):
Rename "Lisp Doc" to "Programming Language Doc", including in
parent menus.  All references changed.
(Programming Language Doc): Formerly "Lisp Doc".  Rewrite to not
be specific to Emacs Lisp.  Improve markup and wording.  Document
more commands and variables.
* doc/emacs/maintaining.texi (Maintaining): Improve indexing.
2022-10-21 16:10:08 +03:00
Lars Ingebrigtsen
6fd1fb8a68 Don't disable eldoc when doing edebug
* lisp/emacs-lisp/eldoc.el
(eldoc-display-message-no-interference-p): Don't disable eldoc
when edebugging (bug#56459).  There should be no interference in
that case, because edebug messaging is done after stepping, and
eldoc messaging is done after other movements.
2022-08-02 11:56:55 +02:00
Lars Ingebrigtsen
97abe8511a Use special-mode in eldoc--doc-buffer
* lisp/emacs-lisp/eldoc.el (eldoc--format-doc-buffer): Use
`special-mode' to allow normal customizations of the buffer
(bug#56659).
2022-07-23 09:14:04 +02:00
João Távora
3c539cb5b3 Make eldoc-echo-area-prefer-doc-buffer consider all frames
Previously, it considered only windows on 'visible' frames (according
to get-buffer-window).  This seemed correct at first, but it's not
much use for multiple TTY frames and not particularly reliable on GUI
frames either.  There's no reliable way to tell what is actually
visible, so it's best to assume that users setup frames that are
indeed visible when using this parameter.

* lisp/emacs-lisp/eldoc.el (eldoc--echo-area-prefer-doc-buffer-p):
Consider all frames.
2022-07-20 00:35:18 +01:00
João Távora
5f64ba0efb Ensure Eldoc buffer displays on interactive M-x eldoc
* lisp/emacs-lisp/eldoc.el (eldoc-display-in-buffer): Call
eldoc-doc-buffer with interactive set to t.
(Version): Bump to 1.13.0.
2022-07-20 00:27:56 +01:00
Stefan Kangas
4e79f77635 Merge from origin/emacs-28
5e47ec9511 ; * lisp/url/url-http.el (url-http-parse-headers): Fix typo.
ba0871bef1 ; Fix typos: prefer American spelling
e3e7f31faa Adapt Tramp doc

# Conflicts:
#	etc/NEWS
#	etc/themes/modus-themes.el
#	lisp/emacs-lisp/byte-opt.el
#	test/lisp/so-long-tests/spelling-tests.el
2022-07-14 11:37:42 +02:00
Stefan Kangas
ba0871bef1 ; Fix typos: prefer American spelling 2022-07-13 13:04:22 +02:00
João Távora
d377b39643 Allow non-interactive use of eldoc-doc-buffer
* lisp/emacs-lisp/eldoc.el (eldoc-doc-buffer): Allow
non-interactive use.
(Version): Bump minor.
2022-05-09 12:51:24 +01:00
Augusto Stoffel
45978f97be Handle invisible text in Eldoc when calculating size
Co-authored-by: João Távora <joaotavora@gmail.com>

* lisp/emacs-lisp/eldoc.el (eldoc--echo-area-substring,
eldoc-display-in-echo-area):  Take invisible text into consideration
when counting lines to crop an echo-area message.
(Version): Bump.
2022-03-24 15:06:05 +00:00
Tassilo Horn
2755e6bba0 Allow showing show-paren context in an overlay
* lisp/paren.el (show-paren-context-when-offscreen): Add new
possibility `overlay'.
(show-paren--context-overlay): New defvar.
(show-paren--delete-context-overlay): New function.
(show-paren--show-context-in-overlay): New function.
(show-paren-function): Handle the new `overlay' case.
* lisp/emacs-lisp/eldoc.el (eldoc-display-message-no-interference-p):
There's no interference if `show-paren-context-when-offscreen' is
overlay or child-frame.
2022-02-08 21:54:56 +01:00
Eli Zaretskii
dcd76bd48d Merge from origin/emacs-28
836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year.
86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year
ebe8772f65 ; Minor fixes related to copyright years
23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye...
8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t.
19dcb237b5 ; Add 2022 to copyright years.

# Conflicts:
#	etc/NEWS
#	etc/refcards/ru-refcard.tex
#	lib/cdefs.h
#	lisp/erc/erc-dcc.el
#	lisp/erc/erc-imenu.el
#	lisp/erc/erc-replace.el
#	lisp/image-dired.el
#	lisp/progmodes/xref.el
#	m4/alloca.m4
#	m4/byteswap.m4
#	m4/errno_h.m4
#	m4/getopt.m4
#	m4/gnulib-common.m4
#	m4/inttypes.m4
#	m4/stddef_h.m4
#	m4/stdint.m4
#	m4/sys_socket_h.m4
2022-01-01 07:03:03 -05:00
Eli Zaretskii
19dcb237b5 ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
Greg Minshall
1625123e4c Fix eldoc usage of newly introduced variable
* lisp/emacs-lisp/eldoc.el
(eldoc-display-message-no-interference-p): Make this function work
in older Emacs versions again (bug#51939).
2021-11-18 10:35:12 +01:00
Daniel Martín
9f505c476e New option show-paren-context-when-offscreen
* lisp/simple.el (blink-paren-open-paren-line-string): Extract
functionality that shows the open paren line in the echo area into its
own function, to reuse it from paren.el.
(blink-matching-open): Use blink-paren-open-paren-line-string.
* lisp/paren.el (show-paren-context-when-offscreen): New option
show-paren-context-when-offscreen.
(show-paren-function): Implement it using
blink-paren-open-paren-line-string.
* lisp/emacs-lisp/eldoc.el (eldoc-display-message-no-interference-p):
Make sure the feature works well with eldoc.
* test/lisp/paren-tests.el (paren-tests-open-paren-line): Test
blink-paren-open-paren-line-string.
* doc/emacs/programs.texi (Matching): Update the documentation.
* etc/NEWS: And announce the new feature.
2021-10-18 09:26:44 +02:00
Augusto Stoffel
90575a6c0c Disable 'nobreak-char-display' in Eldoc buffers
* lisp/emacs-lisp/eldoc.el (eldoc--format-doc-buffer): Set
'nobreak-char-display' to nil in Eldoc buffers (bug#50989).
2021-10-05 11:12:05 +02:00
Stefan Kangas
25ebb9374b ; More minor docfixes found by checkdoc 2021-09-14 07:57:14 +02:00
Basil L. Contovounesios
33c0994c7c Look for ElDoc buffer in all visible frames
* lisp/emacs-lisp/eldoc.el (eldoc--echo-area-prefer-doc-buffer-p):
Look for a window displaying the ElDoc documentation buffer in all
visible frames, as promised by the user option
eldoc-echo-area-prefer-doc-buffer (bug#48278).
2021-05-18 16:31:19 +01:00
Štěpán Němec
2c2dfbbbf0 ; Fix some typos in doc strings and manuals 2021-04-24 18:26:07 +02:00
Mattias Engdegård
de15ca7d00 Fix typos
* doc/lispref/display.texi (Size of Displayed Text):
* doc/lispref/windows.texi (Buffer Display Action Functions):
* etc/NEWS:
* etc/ORG-NEWS (Org-Attach has been refactored and extended):
* lisp/battery.el (display-battery-mode, battery--upower-subsribe):
* lisp/calendar/parse-time.el:
* lisp/dired-x.el:
* lisp/emacs-lisp/chart.el (chart-sequece, chart-bar-quickie):
* lisp/emacs-lisp/eldoc.el (eldoc-echo-area-use-multiline-p)
(eldoc-documentation-strategy):
* lisp/emacs-lisp/pcase.el (pcase--split-pred, pcase--u1):
* lisp/gnus/gnus-search.el (gnus-search-expandable-keys)
(gnus-search-parse-query, gnus-search-query-return-string)
(gnus-search-imap, gnus-search-imap-search-command)
(gnus-search-transform-expression):
* lisp/gnus/nnselect.el:
* lisp/isearch.el (isearch-lazy-count-format):
* lisp/mh-e/mh-show.el (mh-show-msg):
* lisp/net/dictionary-connection.el (dictionary-connection-open):
* lisp/net/dictionary.el (dictionary-default-popup-strategy)
(dictionary, dictionary-split-string, dictionary-do-select-dictionary)
(dictionary-display-dictionarys, dictionary-search)
(dictionary-tooltip-mode):
* lisp/net/eudcb-macos-contacts.el (eudc-macos-contacts-set-server):
* lisp/net/mailcap.el (mailcap-mime-data):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/nxml/nxml-mode.el (nxml-mode):
* lisp/progmodes/cc-engine.el:
* lisp/progmodes/cperl-mode.el (cperl-mode)
(cperl-fontify-syntaxically):
* lisp/progmodes/flymake.el (flymake-diagnostic-functions):
* lisp/progmodes/verilog-mode.el (verilog--supressed-warnings)
(verilog-preprocess):
* lisp/simple.el (self-insert-uses-region-functions):
* lisp/textmodes/bibtex.el (bibtex-copy-summary-as-kill):
* lisp/textmodes/texnfo-upd.el (texinfo-insert-master-menu-list):
* src/dispnew.c:
* src/font.c (Ffont_get):
* src/indent.c (compute_motion):
* src/process.c (init_process_emacs):
* src/w32fns.c (deliver_wm_chars):
* test/lisp/jsonrpc-tests.el (deferred-action-complex-tests):
Fix typos in documentation, comments, and internal identifiers.
2021-02-18 16:50:55 +01:00
Basil L. Contovounesios
c3163069a1 Fix ElDoc setup for eval-expression
* lisp/emacs-lisp/eldoc.el (eldoc--eval-expression-setup): Don't set
global value of eldoc-documentation-strategy (bug#44886).
2021-02-12 21:28:47 +00:00
Paul Eggert
ba05d005e5 Update copyright year to 2021
Run "TZ=UTC0 admin/update-copyright".
2021-01-01 01:13:56 -08:00
João Távora
755a9f2a8b Inhibit quit in ElDoc timer functions (bug#45117)
The point of un-inhibiting it was to make ElDoc backends interruptible
with any input (as in while-no-input), since that should in principle
invalidate the need of the current ElDoc processing.  But that
strategy is dangerous for backends that perform complex
synchronization with external processes.  Better let each backend
decide for itself it needs this eager interruptive behavior, like is
presumably the case with the Octave backend.

This reverts a part of

    commit 12e922156c
    Author: Stefan Monnier <monnier@iro.umontreal.ca>
    Date:   Tue Dec 4 18:15:44 2018 -0500

* lisp/emacs-lisp/eldoc.el (eldoc-print-current-symbol-info):

* lisp/progmodes/octave.el (octave-eldoc-function-signatures): Use
while-no-input.
2020-12-13 23:16:53 +00:00
João Távora
67a9ecb489 Remove interactive spec from internal eldoc--format-doc-buffer
Per bug#43609.

* lisp/emacs-lisp/eldoc.el (eldoc--format-doc-buffer): Remove
useless interactive spec.
2020-12-08 23:40:23 +00:00
Lars Ingebrigtsen
0287c51768 Keep point in the *eldoc* buffer in eldoc-display-in-echo-area
* lisp/emacs-lisp/eldoc.el (eldoc-display-in-echo-area): Use
'save-excursion' to keep point position in *eldoc* buffer.
Suggested by Andrii Kolomoiets <andreyk.mad@gmail.com>.
2020-11-26 11:24:20 +01:00
João Távora
74c45a62e1 Shoosh byte-compilation warning in lisp/emacs-lisp/eldoc.el
Per bug#43609, elisp-eldoc-documentation-function is again in master,
but since it's now officially obsoleted, this backward compatibility
shim in eldoc--eval-expression-setup shouldn't unnecessarily trigger
warnings in master's code.

* lisp/emacs-lisp/eldoc.el (eldoc--eval-expression-setup): Shoosh
by-compilation warning.
2020-10-30 22:31:20 +00:00
João Távora
3758be484e Don't make ElDoc doc buffer visible in buffer list by default
Fixes: bug#44334

* lisp/emacs-lisp/eldoc.el (eldoc-doc-buffer): No longer take
INTERACTIVE arg.  Show buffer if invisible.
(eldoc--format-doc-buffer): Don't change buffer visibility.
(eldoc-display-in-buffer): Show buffer if invisible if by calling
eldoc-doc-buffer.
2020-10-30 22:31:20 +00:00
João Távora
10e7c76ee3 Rework semantics of eldoc-echo-are-use-multiline-p
Per bug#43543.  Now uses logical lines, not visual lines.

* lisp/emacs-lisp/eldoc.el (eldoc-echo-area-use-multiline-p): Rework
semantics.
(eldoc--echo-area-substring): New helper.
(eldoc--echo-area-prefer-doc-buffer-p): New helper.
(eldoc-display-in-echo-area): Rework using new helpers.
2020-10-24 18:02:28 +01:00
João Távora
77c3928425 Rename ElDoc user option controlling display of truncation notice
The new name makes it consistent with other variables controlling the
display of ElDoc documentation in the echo area.

Per bug#43543.

* etc/NEWS (Eldoc): Rename eldoc-display-truncation-message to
eldoc-echo-area-display-truncation-message.

* lisp/emacs-lisp/eldoc.el
(eldoc-echo-area-display-truncation-message): Rename from
eldoc-display-truncation-message.
(eldoc-display-in-echo-area): Use new variable name.
2020-10-24 18:02:28 +01:00
João Távora
5daa6a6a03 Rework eldoc-echo-area-prefer-doc-buffer (bug#42532)
* lisp/emacs-lisp/eldoc.el:
(eldoc-echo-area-prefer-doc-buffer): Rename from
eldoc-echo-area-prefer-doc-buffer
(eldoc-display-in-echo-area): Rework to honour
eldoc-echo-area-prefer-doc-buffer.
2020-10-24 18:02:28 +01:00
João Távora
4c543a724f Introduce eldoc-display-functions
See bug#43609.

* lisp/emacs-lisp/eldoc.el (eldoc--request-state): Add comment.
(eldoc--last-request-state): No longer buffer-local.
(eldoc--request-docs-p): Delete.
(eldoc-display-functions): New user variable.
(eldoc--doc-buffer-docs): New variable.
(eldoc-display-message-p): Rework.
(eldoc--format-doc-buffer): Rework from eldoc--handle-docs.
(eldoc-display-in-echo-area, eldoc-display-in-buffer): New
user-visible function.
(eldoc--invoke-strategy): Take INTERACTIVE arg.
Invoke eldoc-display-in-buffer
(eldoc-print-current-symbol-info): Simplify.
(Version): Bump to 1.11.0

* etc/NEWS: Mention eldoc-display-functions.
2020-10-24 18:02:28 +01:00
Lars Ingebrigtsen
73f77558cc Fix off-by-one error in eldoc--handle-docs
* lisp/emacs-lisp/eldoc.el (eldoc--handle-docs): We have one extra
line to use if we don't show the truncation message (bug#43543).
2020-09-22 16:20:05 +02:00
Stefan Kangas
462dbc1cb2 ; Fix typos 2020-09-21 14:26:42 +02:00
Lars Ingebrigtsen
e72d3793bc Allow disabling the verbose eldoc truncation message
* doc/emacs/programs.texi (Lisp Doc): Document it.

* lisp/emacs-lisp/eldoc.el (eldoc-display-truncation-message): New
variable (bug#43543).
(eldoc--handle-docs): Use it.
2020-09-21 14:15:39 +02:00
João Távora
ae6daa680a Fix ElDoc's eldoc-documentation-enthusiast strategy
As soon as we get a response from any of the user functions/sources in
eldoc-documentation-functions, we must make sure to call the
display-doc local function, just like in the other strategies.

That is even if that response produced nil, meaning that there's no
doc coming from that source.  Failure to do so when none of the
sources produced non-nil would keep stale documentation displaying.

First reported in https://github.com/joaotavora/eglot/issues/503

* lisp/emacs-lisp/eldoc.el (eldoc--invoke-strategy): Fix
:enthusiast strategy.
(Version): Bump to 1.10.0
2020-09-03 23:20:55 +01:00
João Távora
c7e297e906 Prevent ElDoc blinking when eldoc-documentation-enthusiast is used
This eldoc-documentation-strategy function didn't always obey protocol
since it returned nil sometimes, which the eldoc engine took it as a
hint for the "old" protocol to clear the echo area.

* lisp/emacs-lisp/eldoc.el (eldoc-documentation-enthusiast):
Return t.
(Version): Bump to 1.9.0
2020-08-29 14:29:22 +01:00