casouri / eldoc-box

childframe doc for eglot and anything that uses eldoc
359 stars 26 forks source link

Controlling the eldoc-box position #67

Closed karthink closed 1 year ago

karthink commented 1 year ago

Hi,

Thank you for writing eldoc-box -- it's a very slick alternative to eldoc-doc-buffer.

Is it possible to specify (by pixel or line number) where the eldoc-box appears on the screen?

Here's the context:

I'm working on a replacement for org-mode's LaTeX preview system, which is planned to be included in Org 9.7. The new system generates previews asynchronously and very fast, fast enough that you can preview LaTeX fragments as you type. To display this, I implemented a child-frame version of the previews:

https://user-images.githubusercontent.com/8607532/228973013-0a8c69d2-c342-4bd7-860b-7df397ce630f.mp4

However from discussions with the Org maintainers I was told to show the live previews with Eldoc instead, and then folks can customize how it's displayed (echo area/dedicated buffer/child frame) with eldoc-display-functions, using eldoc-box if they want "pop-up" behavior like in the above video.

However, eldoc-box-hover-at-point-mode obscures the LaTeX fragment being edited with the box:

Fragment being edited: 2023-03-30-145740_778x337_scrot

Fragment previewed with eldoc box (Can't preview live because it covers the fragment): 2023-03-30-145753_778x337_scrot

Is it possible to specify where the box should appear dynamically? In my from-scratch child-frame implementation I place it immediately below the LaTeX environment being edited, whose pixel-position I know.

Display child-frame under the edited LaTeX env: 2023-03-30-150143_1120x700_scrot

casouri commented 1 year ago

Yeah, you can set eldoc-box-position-function to a custom function. But note that eldoc-box-hover-at-point-mode modifies that value, so you might need to change it in eldoc-box-hover-at-point-mode-hook...

karthink commented 1 year ago

Thank you, that resolves the issue!