emacs-mini-frame
emacs-mini-frame copied to clipboard
Feature request: position relative to the current window or to the cursor
Rather than positioning the mini-frame relative to the frame, I'd like to position it relative to the current window. In some specific cases, I'd also like to be able to to position it relative to the cursor (e.g. lsp-execute-code-action
)
I was able to implement cursor-relative positioning using a custom mini-frame-show-parameters
value:
(lambda ()
(cl-destructuring-bind
((cursor-x . cursor-y) . (frame-left . frame-top))
(cons (window-absolute-pixel-position nil (selected-window))
(frame-position))
`((top . ,(- cursor-y frame-top))
(width . (text-pixels . 1000))
(height . 15)
(left . ,(- cursor-x frame-left)))))
But in case the point is near the bottom of the frame, we want to show the mini-frame above the point, right?
I've done point related child frame positioning in my other package and it looks a bit complicated.
I want to keep mini-frame package as simple as possible. Thats why I leave the frame positioning up to user.
Let's keep this feature request open, but please don't expect this will be implemented in the near future :)
Yeah, my snippet as a lot of flaws in the ahem edge cases.
Hi, mullr
Mini-frame is good enough. If you want to customize a specific position, this example may be helpful:
First, install posframe and require it, then
(setq mini-frame-show-parameters
(lambda()
(let* ((info (posframe-poshandler-argbuilder))
(posn (posframe-poshandler-point-top-left-corner info)))
`((left . ,(car posn))
(top . ,(cdr posn))))))
The position provided by https://github.com/tumashu/posframe/blob/895c7ab4cde68ff9af9151d64804ae84823a9a2e/posframe.el#L327. Just check it out. : )