fix: peek eldoc display index out of bound error
feat: image support
fix: temporary fix for `line-prefix' (example: `org-index-mode')
This package allow you to create a peek view below/above cursor point to show things.
Note: this package is still in frequent updating, with function name changing possibly.
xref-find-definitions.eldoc-message-function and eldoc-display-functions integration.\n inside and uses display text property
to show image, like insert-image with default STRING parameter or insert-image-file function.display text property on its before-string
or after-string, like put-imageStore marked region and peek it later:
peek-overlay-dwim to store the regionpeek-overlay-dwim again to show a peek view of the marked content. You can use this command in other buffer/window to show the marked content.peek-overlay-dwim to hidden the peek view.Tip: You can make the peek view of the marked region automatically updated by
customizing peek-live-update to t. Or you want to manually update content, you
can use peek-view-refresh command. It should be noted that live updating/refreshing
peek view can only be done when the source buffer(owns marked region) is alive.
Find definition of a symbol.
peek-xref-definition to show the definition at the cursor point in peek view.peek-overlay-dwim to hide the peek view.Display eldoc for the symbol under cursor.
note: you need Emacs version >= 28.1
(remove-hook 'eldoc-display-functions 'eldoc-display-in-buffer)
eldoc to diplay eldoc for the symbol under cursor.peek-overlay-dwim to hide the peek view.Display eldoc message
Customize peek-enable-eldoc-message-integration to t to enable the eldoc message integration. You may also want to customize peek-eldoc-message-overlay-position too.
Note: peek-overlay-eldoc-message-toggle-stauts function can be used to toggle whether the peek view for eldoc message will be shown.
Scroll up/down in the peek view
M-n: peek-next-lineM-p: peek-prev-line(use-package peek
:straight (:type git :host sourcehut :repo "meow_king/peek")
:custom
;; only list some settings that are wanted to be chaned by most people
(peek-overlay-window-size 11) ; lines
;; you can also set `peek-overlay-border-character' to nil to achieve a similar
;; looking as `make-separator-line', which is useful when you find there is a wrong
;; number of border characters when using default settings. However, in this case,
;; please consider report a bug.
(peek-overlay-border-character ?\N{BOX DRAWINGS LIGHT HORIZONTAL})
(peek-overlay-position 'above) ; or below
(peek-overlay-distance 4) ; the distance between peek view and the cursor point
;; one line before the place found by `peek-definition' will also appear
;; in peek window. Note `peek-definition' is the underlying function of
;; `peek-xref-definition'
(peek-definition-surrounding-above-lines 1)
(peek-live-update t) ; live update peek view of a marked region
(peek-enable-eldoc-message-integration t) ; enable `eldoc-message-function' integration
;; eldoc message overlay at two lines below the point
;; It's recommended to set the eldoc message overlay below the point since the pop up of
;; the peek overlay may cause visual shaking
(peek-eldoc-message-overlay-position 2)
;; enable `eldoc-display-functons' integration
;; note: you need Emacs version >= 28.1
(peek-enable-eldoc-display-integration t)
:config
(global-peek-mode 1)
;; Keybindings
;; default keybindings in peek-mode-keymap
(define-key peek-mode-keymap (kbd "M-n") 'peek-next-line)
(define-key peek-mode-keymap (kbd "M-p") 'peek-prev-line)
;; or you can use `keymap-global-set', which is introduced in emacs 29
(global-set-key (kbd "C-x P p") #'peek-overlay-dwim)
(global-set-key (kbd "C-x P d") #'peek-xref-definition)
(global-set-key (kbd "C-x P m") #'peek-overlay-eldoc-message-toggle-stauts)
(global-set-key (kbd "C-c c d") #'eldoc)
;; Eldoc display setting
;; Besides making `peek-enable-eldoc-display-integration' to t, you may want to remove
;; other eldoc display functions.
(remove-hook 'eldoc-display-functions 'eldoc-display-in-buffer)
;; you may also want to set scroll margin (see its docs)
(setq-default scroll-margin 5))
Go to customize -> peek
These API may be useful for advanced customization:
eldoc-message-function related API: peek-overlay-eldoc-message-toggle-stauts, peek-overlay-eldoc-message-disable, peek-overlay-eldoc-message-enable. Possible customization direction: for model editing mode like evil, you can use these function to only enable displaying eldoc message overlay(peek view) when in insert mode. Personally I use meow, and this is my settings:(add-hook 'meow-insert-enter-hook 'peek-overlay-eldoc-message-enable)
(add-hook 'meow-insert-exit-hook 'peek-overlay-eldoc-message-disable)
peek-overlay-set-custom-content, peek-overlay-toggle, peek-overlay-hide, peek-overlay-show
peek-definition. This function can be used to create custom peek definition
command like peek-xref-definition.
;; goto-definition function: any number of parameters, no requirement for returned
;; value. The only requirement is that it should act to go the the point of definition.
(defun peek-goto-xref-defintion-func (identifier)
"Go to the definition of IDENTIFIER."
(xref-find-definitions identifier)
;; clear xref history
(pop (car (xref--get-history))))
;; integration
(defun peek-xref-definition ()
"Peek xref definition."
(interactive)
(peek-definition
'peek-goto-xref-defintion-func
(list (thing-at-point 'symbol))))
Child frame. (Currently Peek only support overlay.)overlay that behaves like floating on the upper layer of the text (like child frame, so we have better terminal support). Maybe I should take a look at the source code of corfu or company.