Commit Graph

162 Commits

Author SHA1 Message Date
Bas Alberts
43ec41dcc0
* eldoc-box.el (eldoc-box-eglot-help-at-point): Don’t display nil. 2022-04-15 10:38:47 -07:00
Bas Alberts
c18023132d
* eldoc-box.el: Ensure macros are available at time of byte compile. 2022-04-15 10:38:35 -07:00
Yuan Fu
c0cbb8d919
* eldoc-box.el (eldoc-box-frame-parameters): Hide tab-lines. 2022-02-27 22:31:47 -08:00
Yuan Fu
6fbb6e3e19
Remove unnecessary check for empty string in eldoc-box--display
* eldoc-box.el (eldoc-box--display): Now we require the caller to make
sure the string is not empty.
2022-02-20 12:47:10 -08:00
Yuan Fu
646ae5cdd8
Fix eldoc-box-frame-hook to run in childframe as documented
* eldoc-box.el (eldoc-box--get-frame): Run the hook in the childframe
2022-02-20 12:03:16 -08:00
Trevor Richards
3efb59ab78
Add customizable eldoc-box-offset
* eldoc-box.el (eldoc-box-offset): New option.
(eldoc-box--default-upper-corner-position-function): Use
eldoc-box-position-function
2022-02-16 14:21:32 -08:00
Doug Davis
13d207d408
fix child border in Emacs 28
* eldoc-box.el (eldoc-box--get-frame): Set child-frame-border's
background to border color.
2021-06-08 18:02:25 -04:00
Yuan Fu
f66f8d0641
Merge branch 'defcustom' 2021-04-02 16:39:01 -04:00
Jimmy Yuen Ho Wong
4e81912d9b
Turn defvars to defcustoms for the documentation variables
* eldoc-box.el (eldoc-box-only-multi-line, eldoc-box-cleanup-interval,
eldoc-box-clear-with-C-g, eldoc-box-max-pixel-width,
eldoc-box-max-pixel-height, eldoc-box--inhibit-childframe): Turn into
custom options.
2021-04-02 16:38:01 -04:00
Yuan Fu
20580ad346
Merge branch 'fix-compiler-warnings' 2021-04-02 16:36:41 -04:00
Jimmy Yuen Ho Wong
10c792cc40
Fix byte compiler warnings
* eldoc-box.el (require): New require form.
(eldoc-box-hover-at-point-mode, eldoc-box-hover-at-point-mode,
eldoc-box-hover-mode, eldoc-box-hover-at-point-mode): Move below.
(eglot--hover-info, eglot--current-server-or-lose,
eglot--TextDocumentPositionParams, eglot--error, jsonrpc-request): New
declare forms.
2021-04-02 16:35:03 -04:00
Jimmy Yuen Ho Wong
eb694dde6b
Consider a single newline terminated string as single line
* eldoc-box.el (eldoc-box--eldoc-message-function): Trim newlines in
DOC. Rename 'multi-line-p' to 'single-line-p'.
2021-04-02 16:29:57 -04:00
sm2n
d4574ee392
Fix eldoc-box-only-multi-line behavior
Prior to this change, single line eldoc messages were just ignored
completely when eldoc-box-only-multi-line was non-nil, though they
should have been displayed in the minibuffer.

* eldoc-box.el (eldoc-box--enable): Change :before-until to :before-while.
(eldoc-box--eldoc-message-function): Return nil if the message is not
multi-line, so that the default eldoc message function picks up the
message.
2021-03-13 13:24:35 -05:00
Yuan Fu
7fa3b78d07 Add at point position hack
This should fix #22
2020-03-16 15:56:50 -04:00
Yuan Fu
82dc2e96e6
Get point position right 2020-03-16 12:19:29 -04:00
Yuan Fu
9137860707
Fix window position-finding 2019-11-02 10:33:49 -04:00
Yuan Fu
33b73c9169
Recover window-header-line-height 2019-11-02 10:04:28 -04:00
Yuan Fu
d3ea596daa
Hotfix #24 2019-11-02 09:30:07 -04:00
Yuan Fu
ec87e8c7f8
Simplify position-finding code 2019-11-02 00:10:11 -04:00
Yuan Fu
fcebfaa141
Fix #15
Line numbers mode is the problem
2019-11-02 00:09:10 -04:00
Yuan Fu
0fffdf9a11
Inhibit tab-bar in childframe (#23) 2019-10-08 10:27:22 -04:00
Yuan Fu
138386aa32
Merge branch 'new-feature' 2019-10-08 10:25:09 -04:00
Yuan Fu
9196bfe858
Take header line height into account in position calculation (#22) 2019-10-03 09:40:17 -04:00
Yuan Fu
5ca8a2cef5
Fix fringe 2019-10-03 09:34:49 -04:00
Yuan Fu
6c5c9d57d8
Inhibit childframe display when moving point (#21)
(only in at-point mode)
2019-10-03 09:34:45 -04:00
Yuan Fu
1cb8f409e0
Separate hover-mode and at-point-mode (#21)
at-point-mode no longer stack on top of hover-mode.
Instead, they stands as two exclusive modes,
enabling any one of them disables the other.
2019-10-03 00:50:57 -04:00
Yuan Fu
fb983d973e
Inhibit childframe display when moving point (#21)
(only in at-point mode)
2019-10-03 00:38:32 -04:00
Yuan Fu
8be8ef42d0
Separate hover-mode and at-point-mode
at-point-mode no longer stack on top of hover-mode.
Instead, they stands as two exclusive modes,
enabling any one of them disables the other.
2019-10-03 00:21:04 -04:00
Yuan Fu
c90d4c8285
Remove unused local var 2019-09-28 21:41:12 -04:00
Yuan Fu
028a29516d
Shrink fringe size 2019-08-13 13:44:37 +08:00
Yuan Fu
4c88ceecc6
Add buffer and frame hooks 2019-08-13 13:44:28 +08:00
Yuan Fu
93f89087b8
Improve eldoc-box-body face
Now every attribute takes effect.
2019-08-13 13:42:44 +08:00
Yuan Fu
8aa2b6d35a
Disable at-point mode when hover mode is disabled 2019-07-11 20:26:30 +08:00
Yuan Fu
d413647eea
Add badge and fix commentary 2019-07-11 20:18:04 +08:00
Yuan Fu
ac4a3965ea
Revert (part of) last commit 2019-06-08 22:53:54 +08:00
Yuan Fu
2a198c4d3e
Follow cursor when in at-point mode
Instead of disappear.
2019-06-08 12:07:18 +08:00
Yuan Fu
f292d28712
Display childframe alongside company popup 2019-06-07 20:31:35 +08:00
Yuan Fu
5dbd37009e
Hide childframe when company pops up
An attempt to fix the issue mentioned in #11
2019-06-06 21:17:37 +08:00
Yuan Fu
c97fe860fa
Don't show childframe when docstring is an empty string 2019-05-29 16:31:01 +08:00
Yuan Fu
0071538273
Fix #14 2019-05-23 22:11:06 +08:00
Yuan Fu
0d671026b9
Update fringe face everytime the childframe is redisplayed 2019-03-05 16:06:46 -05:00
Yuan Fu
6caf8a2710
Add new variable eldoc-box-fringe-use-same-bg 2019-03-05 11:53:36 -05:00
Yuan Fu
61dd07f670
Update version 2019-02-20 14:36:09 -05:00
Yuan Fu
f86d7a6c37
Fix: dead-frame 2019-02-20 14:25:05 -05:00
Yuan Fu
0649423e70
Add warning if eldoc-box-hover-at-point-mode is enable too early
Early means eldoc-box-hover-mode is not enabled
2019-02-10 13:06:16 -05:00
Yuan Fu
b9a235b61c
Make frame visible after all configurations done 2019-02-10 13:03:35 -05:00
Yuan Fu
d5c52cb7f0
Cleaner logic on getting frame and window 2019-02-10 13:02:56 -05:00
Yuan Fu
6ce7402874
Fix point coordinate differences across OS’s. 2019-02-10 12:53:55 -05:00
Yuan Fu
5a9ceec283
Try to fix #11 2019-02-09 15:52:50 -05:00
Yuan Fu
6f18d01501
Revert "Simplify childframe creation"
Built-in function doesn't really reused the childframe,
change back to manually reuse.

This reverts commit 6ceeb22b68.
2019-01-23 14:39:51 -05:00
Yuan Fu
18829272b8
make at-point minor mode a add-on of the other minor mode
This way there is no confusion.
2019-01-06 20:54:54 -05:00
Yuan Fu
a34e2e2e6e
Don't cleanup when clicking popup 2019-01-05 19:45:50 -05:00
Yuan Fu
ec9a4003de
Make sure point is at top when displaying childframe 2019-01-04 19:06:43 -05:00
Yuan Fu
4dc269bc1e
Add the hack into codebase 2019-01-04 19:06:34 -05:00
Yuan Fu
6ceeb22b68
Simplify childframe creation
display-buffer-in-childframe will automatically reuse childframe
2019-01-04 18:56:42 -05:00
Yuan Fu
ae1a4690a9
Comment out en local variable
We don't need it now
2019-01-04 18:56:16 -05:00
Yuan Fu
4f1d227d4d
Enable users to set font of the childframe
This step is before resizing.
2019-01-04 18:51:37 -05:00
Yuan Fu
0278b46f7e
Fix: meesed up minor modes
Because at-point mode uses hover mode, disabling each other
doesn't work.
2018-12-31 00:54:32 -05:00
Yuan Fu
f5e15dbf09
Fix "childframe" typos 2018-12-29 00:49:43 -05:00
Yuan Fu
03d075eda6
Fix: empty childframe when used with lsp-mode
lsp-mode returns empty string as documentation from time to time,
add a workaround to ignore that
2018-12-28 21:45:38 -05:00
Yuan Fu
2f5910325d
Move position of "at-point" popup to the left
This way the childframe is still under the point when
the cursor type is bar
2018-12-28 21:41:16 -05:00
Yuan Fu
7b2768a6c5
Merge branch 'master' of https://github.com/casouri/eldoc-box into pop-at-point 2018-12-26 16:38:39 -05:00
Yuan Fu
42c176375a
Remove eldoc pre command hook to eliminate flicker 2018-12-26 16:36:34 -05:00
Yuan Fu
1d9b0bb000
Disable the other minor mode before enabling either one 2018-12-26 16:35:27 -05:00
Yuan Fu
29cf6d7fb6
Merge branch 'master' into pop-at-point 2018-12-22 12:42:15 -05:00
Yuan Fu
291e5ac97c
Fix: tool-bar-mode mess up popup position 2018-12-21 02:16:02 -05:00
Yuan Fu
c7fea8278e
Update README 2018-12-20 22:19:58 -05:00
Yuan Fu
cf5ef5510c
Fix: local-variable eldoc-box-position-function doesn't work 2018-12-20 22:17:04 -05:00
Yuan Fu
28eb1d7f8a
Add convenient minor mode for at-point mode 2018-12-20 21:56:48 -05:00
Yuan Fu
bbc1139e95
Fix at-point position calculation 2018-12-20 21:56:36 -05:00
Yuan Fu
3ca3a304b6
Add contributro notice 2018-12-20 13:53:24 -05:00
Yuan Fu
f7b4806694
Tweak the pop at point position 2018-12-20 10:31:14 -05:00
Yuan Fu
1733e35085
Add eldoc-box-clear-with-C-g, update README 2018-12-20 10:26:03 -05:00
Yuan Fu
8f71b3c65e
Fix at point position function 2018-12-20 10:18:49 -05:00
Yuan Fu
c4af2c7e23
Support childframe at point 2018-12-20 09:57:30 -05:00
Yuan Fu
1738ccae4c
Support max width/height to be functions 2018-12-20 09:29:34 -05:00
Yuan Fu
112afa1137
Abstract timer interval as a variable
1 second is a bit too long, but old machines might want a longer
interval, I set it to 0.2 on my machine and CPU looks ok.
2018-12-18 12:34:48 -05:00
João Távora
c7a670d6b9
Delete two unused functions
* eldoc-box.el (eldoc-box-quit-hook)
(eldoc-box--inject-quit-func): Delete.
2018-12-18 12:26:08 -05:00
João Távora
44007aa67d
When quitting eldoc-box-hover-move, really delete the frame
This helps to reset the frame in case something has gone wrong.

* eldoc-box.el (eldoc-box-hover-mode): Delete frame and set
var to nil.
2018-12-18 12:26:08 -05:00
Yuan Fu
e02f496368
Fix: Flicker when move out and into a eldoc-able symbol quickly
- (eldox-box--eldoc-message-function): doesn't cleanup childframe
  when passed with nil anymore

I finally figured out why the flicker occurs:

1. when eldoc asks for doc string, elgot returns nil immeditaly
2. when you move out of a eldoc-cable symbol and move back in
   the childframe isn't cleaned up. Adn eldoc recieves nil from
   eglot, passes that to message function (eldoc-message)
   -> (eldoc-message-function), eldoc-box gets it and cleans up
   childframe. Then eglot recieved doc string from server
   and calls (eldoc-message), childframe is then redisplayed.

Since eldoc-box cleans up after itself and doesn't rely on eldoc
to cleanup. A quick fix is simply don't clean up when eldoc-box
(eldoc-box--eldoc-message-function) recieves nil from eldoc
(eldoc-message).
2018-12-17 11:44:47 -05:00
Yuan Fu
9108035c97
Fix #4: CPU 100%
Also change version to 1.4
2018-12-16 15:47:49 -05:00
Yuan Fu
dd634c62ae
Bump version 2018-12-16 04:00:15 -05:00
Yuan Fu
d722255ebc
Make compiler happy and add autoload 2018-12-16 03:57:56 -05:00
Yuan Fu
4af83a852c
Bump version to 1.2 2018-12-14 18:06:13 -05:00
Yuan Fu
aec39b6bd4
Remove eldoc-box-help-at-point
This function doesn't play well when eldoc-document-function is async.
Plus this function is not in ElDoc spec anyway.
2018-12-14 18:03:51 -05:00
Yuan Fu
0a3b4a8c0e
Bump version 2018-12-13 20:25:18 -05:00
Yuan Fu
310e08a0d5
Update eldoc-box-max-pixel-height and README doc
- height max 1400 -> 700
- add doc in readme about them
2018-12-12 21:58:54 -05:00
Yuan Fu
614c318fdb
Hide eldoc doc buffer in buffer list 2018-12-12 21:54:18 -05:00
Yuan Fu
fe9483dd3c
Minor cleanup 2018-12-12 21:51:38 -05:00
Yuan Fu
f0b1bd23c5
Fix: scroll/click doc frame make it disappear after 1s
- Add eldoc-box--last-point
- eldoc-box--display sets eldoc-box-hover-mode to t in doc buffer
- eldoc-box--maybe-cleanup checks more things to decide whether to
  clear frame
- eldoc-box--eldoc-message-function sets eldoc-box--last-point to
  (point)
2018-12-12 21:49:20 -05:00
Yuan Fu
152d422aba
Minor fixup
eldoc-box--maybe-cleanup: Fix docstring typo
Add comment

eldoc-box--eldoc-message-function: Fix docstring
Add comment
minor code fix
2018-12-12 13:28:40 -05:00
João Távora
2d6b9c3765 Clean up file header a bit
* eldoc-box.el (Copyright): Clear up situation.
(Maintainer): New field.
(Commentary): Add very brief commentary.
2018-12-12 14:24:09 +00:00
João Távora
ff11ef9392 Shoosh compilation warnings
* eldoc-box.el (eldoc-box): New group.
(eldoc-box-hover-mode, eldoc-box--frame): Move up in file.
compilation warning.
2018-12-12 14:21:43 +00:00
João Távora
8232e5eb60 Simplify timer management
* eldoc-box.el (eldoc-box--maybe-cleanup): Set timer var to nil
unconditionally.
(eldoc-box--eldoc-message-function): Rescheduler timer here.
(eldoc-box-hover-mode): Simplify.
(eldoc-box--maybe-cancel-timer, eldoc-box--enabled-buffer-list):
Not needed.
2018-12-12 14:16:29 +00:00
João Távora
c9693eddb0 Play nice with further customizations of eldoc-message-function
Uses a :before-until advice on the local value of
eldoc-message-function instead of setting it directly.  Thus, when we
give up because of eldoc-box-only-multi-line (or some other future
criteria), other :before-until handlers can kick in.

* eldoc-box.el (eldoc-box--eldoc-message-function): Control return of
t or nil.
(eldoc-box-hover-mode): Use add-function and
remove-function.
2018-12-12 13:53:33 +00:00
Yuan Fu
fcfd701f57
Manager the global timer gracefully
Don't cancel and create new timers naively.
Only cancel timer (and set to nil) when there is no live buffer
with eldoc-box-hover-mode enabled;
and only create new timer when none exists.
2018-12-12 01:58:56 -05:00
Yuan Fu
388282f59f
Clean up childframe after ElDoc
Add cleanup function and a idle timer

Why a timer? ElDoc is mainly use in minibuffer,
where the text is constantly being flushed by other commands
so ElDoc doesn't try very hard to cleanup
2018-12-12 00:14:53 -05:00
Yuan Fu
3fab3fb571
Say no documentation available if no documentation is available 2018-12-11 17:17:25 -05:00
Yuan Fu
ae91043e87
Minor change 2018-12-11 16:42:08 -05:00
Yuan Fu
f8de3466f5
Change copyright stuff 2018-12-11 16:40:48 -05:00