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

Add company-box-buffer-hook to run on newly created buffers #137

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
11 changes: 9 additions & 2 deletions company-box.el
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ Examples:
(defvar company-box-selection-hook nil
"Hook run when the selection changed.")

(defcustom company-box-buffer-hook nil
"Hook run on new company-box buffers."
:type 'hook
:group 'company-box)

(defalias 'company-box--icons-in-terminal
(if (require 'icons-in-terminal nil t)
Expand All @@ -318,8 +322,11 @@ Examples:

(defun company-box--get-buffer (&optional suffix)
"Construct the buffer name, it should be unique for each frame."
(get-buffer-create
(concat " *company-box-" (company-box--get-id) suffix "*")))
(let ((buf (get-buffer-create
(concat " *company-box-" (company-box--get-id) suffix "*"))))
(with-current-buffer buf
(run-hooks 'company-box-buffer-hook))
buf))

(defun company-box--with-icons-p nil
(let ((spaces (+ (- (current-column) (string-width company-prefix))
Expand Down