Skip to content

Handle position argument #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions quick-peek.el
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ Calling this method is only useful after directly setting the
contents of a quick-peek overlay. Most programs should not need
to do so (call `quick-peek-show' directly instead)."
(save-excursion
(goto-char (overlay-start ov))
(goto-char (overlay-get ov 'quick-peek-pos))
(setq min-h (or min-h 4) max-h (or max-h 16))
(let* ((contents (quick-peek-overlay-contents ov))
(offset (quick-peek--text-width (quick-peek--point-at-bovl) (point)))
Expand Down Expand Up @@ -239,6 +239,7 @@ instead."
(goto-char pos)
(make-overlay (point-at-bol) (1+ (point-at-eol))))))
(overlay-put ov 'quick-peek t)
(overlay-put ov 'quick-peek-pos pos)
(push ov quick-peek--overlays)
ov)))

Expand All @@ -254,10 +255,12 @@ selected Emacs window."
;;;###autoload
(defun quick-peek-show (str &optional pos min-h max-h)
"Show STR in an inline window at POS.
MIN-H (default: 4) and MAX-H (default: 16) are bounds on the
height of the window. Setting MAX-H to `none' allows the inline
window to expand past the bottom of the current Emacs window."
(ignore (quick-peek--show-at (or pos (point)) str min-h max-h)))
POS (default: `point-at-bol') is the position in whichs column
the STR should be shown. MIN-H (default: 4) and MAX-H (default:
16) are bounds on the height of the window. Setting MAX-H to
`none' allows the inline window to expand past the bottom of the
current Emacs window."
(ignore (quick-peek--show-at (or pos (point-at-bol)) str min-h max-h)))

(defun quick-peek--overlay-matches-pos (ov pos)
"Check if OV is a quick-peek overlay covering POS."
Expand Down