Comments (7)
As a quick test, I evaluated this code and the slowness went away:
(progn
(setq-local eldoc-box-position-function #'eldoc-box--default-at-point-position-function)
(setq-local eldoc-message-function #'eldoc-box--eldoc-message-function)
(eldoc-box-hover-mode))
from eldoc-box.
Using Emacs 28.1 on Arch Linux and Sway (Wayland)
from eldoc-box.
Same on emacs 29.0.50 on arch linux and Gnome 42.0.
The above quick test also made it not slow.
from eldoc-box.
I guess the slowness comes from the "follow cursor" feature? I can make that feature optional so it isn't slow by default.
from eldoc-box.
I can confirm the issue, and my profiler reports tend to point to the follow cursor feature indeed. For some reason, disabling/enabling the mode fix my problem most of the time, but having a more future-proof approach would be neat!
from eldoc-box.
The following patch makes the feature usable again.
diff --git a/eldoc-box.el b/eldoc-box.el
index 7f7c8da..f563e57 100644
--- a/eldoc-box.el
+++ b/eldoc-box.el
@@ -317,29 +317,24 @@ FRAME is the childframe, WINDOW is the primary window."
;; move position
(set-frame-position frame (car pos) (cdr pos))))
-(defvar eldoc-box--inhibit-childframe-timer nil
- "When this timer is on, inhibit childframe display.
-Intended for follow-cursor to disable display when moving cursor.")
-
(defun eldoc-box--inhibit-childframe-for (sec)
- "Inhibit display of childframe for SEC seconds."
- (when eldoc-box--inhibit-childframe-timer
- (cancel-timer eldoc-box--inhibit-childframe-timer))
- (eldoc-box-quit-frame)
- (setq eldoc-box--inhibit-childframe t
- eldoc-box--inhibit-childframe-timer
- (run-with-timer sec nil
- (lambda ()
- (setq eldoc-box--inhibit-childframe nil)))))
+ "Inhibit display of childframe for SEC seconds after Emacs is idle again."
+ (unless eldoc-box--inhibit-childframe
+ (setq eldoc-box--inhibit-childframe t)
+ (eldoc-box-quit-frame)
+ (run-with-idle-timer sec nil
+ (lambda ()
+ (setq eldoc-box--inhibit-childframe nil)))))
(defun eldoc-box--follow-cursor ()
"Make childframe follow cursor in at-point mode."
- (if (member this-command eldoc-box-self-insert-command-list)
- (progn (when (frame-live-p eldoc-box--frame)
- (eldoc-box--update-childframe-geometry
- eldoc-box--frame (frame-selected-window eldoc-box--frame))))
- ;; if not typing, inhibit display
- (eldoc-box--inhibit-childframe-for 0.2)))
+ (unless eldoc-box--inhibit-childframe
+ (if (member this-command eldoc-box-self-insert-command-list)
+ (progn (when (frame-live-p eldoc-box--frame)
+ (eldoc-box--update-childframe-geometry
+ eldoc-box--frame (frame-selected-window eldoc-box--frame))))
+ ;; if not typing, inhibit display
+ (eldoc-box--inhibit-childframe-for 0.5))))
(defun eldoc-box--get-frame (buffer)
"Return a childframe displaying BUFFER.
Feel free to use the diff if you find it reasonable. I can also fill a PR if you prefer.
from eldoc-box.
As mentioned in the README (and from personal experience), there's still a performance penalty when enabling this mode.
Is this something that can be solved in principle, or are there some fundamental issues?
from eldoc-box.
Related Issues (20)
- The eldoc-box-frame-hook might be broken and how to draw a border around the child frame HOT 6
- Multiple overlapping child frames HOT 1
- consider pop the posframe over the edit line?
- Hover at point mode doesn't seem to work HOT 1
- eldoc-box overlapping with company-box HOT 7
- Typos in README HOT 1
- Using Only Help at Point HOT 6
- Code Background in Eldoc Box Frame HOT 2
- Update the README Notes HOT 1
- how to disable "embark on _____" messages from appearing HOT 2
- `C-g` does not kill the frame created by `eldoc-box-help-at-point` HOT 3
- Tab-bar enabled incorrectly on childframe
- Is it possible to choose which eldoc-documentation-functions are applied when displaying the documentation? HOT 2
- When using eldoc-box-hover-at-point-mode can't scroll child frame HOT 3
- eldoc-box-help-at-point not displaing the correct docs HOT 4
- Is it possible to target the child frame?
- Upstream plans
- Manually trigggering eldoc-box-help-at-point will often show previous/outdated docs HOT 11
- Child-frame partially off-screen in `eldoc-box-hover-mode` HOT 2
- Support as front-end for corfu or company-mode candidates? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eldoc-box.