Add eldoc-box-at-point-position-function
* eldoc-box.el (eldoc-box-at-point-position-function): New variable. (eldoc-box-help-at-point) (eldoc-box-hover-at-point-mode): Replace hard-code with eldoc-box-at-point-position-function.
This commit is contained in:
parent
2070e2fc16
commit
f6ae0e7a7b
17
eldoc-box.el
17
eldoc-box.el
@ -173,8 +173,17 @@ Its value should be a list: (left right top)"
|
|||||||
|
|
||||||
(defvar eldoc-box-position-function #'eldoc-box--default-upper-corner-position-function
|
(defvar eldoc-box-position-function #'eldoc-box--default-upper-corner-position-function
|
||||||
"Eldoc-box uses this function to set childframe's position.
|
"Eldoc-box uses this function to set childframe's position.
|
||||||
This should be a function that returns a (X . Y) cons cell.
|
|
||||||
It will be passes with two arguments: WIDTH and HEIGHT of the childframe.")
|
The function is passed two arguments, WIDTH and HEIGHT of the
|
||||||
|
childframe, and should return a (X . Y) cons cell.")
|
||||||
|
|
||||||
|
(defvar eldoc-box-at-point-position-function #'eldoc-box--default-at-point-position-function
|
||||||
|
"Eldoc-box uses this function to set childframe's position.
|
||||||
|
This function is used in ‘eldoc-box-help-at-point’ and in
|
||||||
|
‘eldoc-box-hover-at-point-mode’.
|
||||||
|
|
||||||
|
The function is passed two arguments, WIDTH and HEIGHT of the
|
||||||
|
childframe, and should return a (X . Y) cons cell.")
|
||||||
|
|
||||||
(defcustom eldoc-box-fringe-use-same-bg t
|
(defcustom eldoc-box-fringe-use-same-bg t
|
||||||
"T means fringe's background color is set to as same as that of default."
|
"T means fringe's background color is set to as same as that of default."
|
||||||
@ -276,7 +285,7 @@ If point != last point, hide the childframe.")
|
|||||||
(interactive)
|
(interactive)
|
||||||
(when (boundp 'eldoc--doc-buffer)
|
(when (boundp 'eldoc--doc-buffer)
|
||||||
(let ((eldoc-box-position-function
|
(let ((eldoc-box-position-function
|
||||||
#'eldoc-box--default-at-point-position-function))
|
eldoc-box-at-point-position-function))
|
||||||
(eldoc-box--display
|
(eldoc-box--display
|
||||||
(with-current-buffer eldoc--doc-buffer
|
(with-current-buffer eldoc--doc-buffer
|
||||||
(buffer-string))))
|
(buffer-string))))
|
||||||
@ -630,7 +639,7 @@ You can use \\[keyboard-quit] to hide the doc."
|
|||||||
(progn (when eldoc-box-hover-mode
|
(progn (when eldoc-box-hover-mode
|
||||||
(eldoc-box-hover-mode -1))
|
(eldoc-box-hover-mode -1))
|
||||||
(setq-local eldoc-box-position-function
|
(setq-local eldoc-box-position-function
|
||||||
#'eldoc-box--default-at-point-position-function)
|
eldoc-box-at-point-position-function)
|
||||||
(setq-local eldoc-box-clear-with-C-g t)
|
(setq-local eldoc-box-clear-with-C-g t)
|
||||||
(remove-hook 'pre-command-hook #'eldoc-pre-command-refresh-echo-area t)
|
(remove-hook 'pre-command-hook #'eldoc-pre-command-refresh-echo-area t)
|
||||||
(add-hook 'post-command-hook #'eldoc-box--follow-cursor t t)
|
(add-hook 'post-command-hook #'eldoc-box--follow-cursor t t)
|
||||||
|
Loading…
Reference in New Issue
Block a user