Skip to content
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

Be less instrusive as requested #57

Merged
merged 2 commits into from
Jan 19, 2017
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ it to the popup help buffer provided by

If you hit `M-x customize-group <RET> company-quickhelp <RET>` you'll
find a few variables you can diddle.
For instance, you can change the help popup text background and foreground colors.

You might also want to put this in your `init.el`:

Expand Down
20 changes: 17 additions & 3 deletions company-quickhelp.el
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ be triggered manually using `company-quickhelp-show'."
(const :tag "Don't limit the number of lines shown" nil))
:group 'company-quickhelp)

(defcustom company-quickhelp-color-foreground nil
"Popup text foreground color."
:type '(choice (color)
(const :tag "Default" nil))
:group 'company-quickhelp)

(defcustom company-quickhelp-color-background nil
"Popup text background color."
:type '(choice (color)
(const :tag "Default" nil))
:group 'company-quickhelp)

(defvar company-quickhelp--timer nil
"Quickhelp idle timer.")

Expand Down Expand Up @@ -159,7 +171,9 @@ currently active `company' completion candidate."
(let* ((frame (window-frame (selected-window)))
(max-width (pos-tip-x-display-width frame))
(max-height (pos-tip-x-display-height frame))
(w-h (pos-tip-string-width-height doc)))
(w-h (pos-tip-string-width-height doc))
(fg-bg `(,company-quickhelp-color-foreground
. ,company-quickhelp-color-background)))
(cond
((> (car w-h) width)
(setq doc (pos-tip-fill-string doc width nil 'none nil max-height)
Expand All @@ -168,11 +182,11 @@ currently active `company' completion candidate."
(> (cdr w-h) max-height))
(setq doc (pos-tip-truncate-string doc max-width max-height)
w-h (pos-tip-string-width-height doc))))
(pos-tip-show-no-propertize doc nil (overlay-start ovl) nil timeout
(pos-tip-show-no-propertize doc fg-bg (overlay-start ovl) nil timeout
(pos-tip-tooltip-width (car w-h) (frame-char-width frame))
(pos-tip-tooltip-height (cdr w-h) (frame-char-height frame) frame)
nil (+ overlay-width overlay-position) 1))
(pos-tip-show doc nil (overlay-start ovl) nil timeout width nil
(pos-tip-show doc fg-bg (overlay-start ovl) nil timeout width nil
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a null variable because it's out of scope from the let.

(+ overlay-width overlay-position) 1))))))

(defun company-quickhelp--set-timer ()
Expand Down