Comments (13)
I tried following settings, but none of them works.
(add-to-list 'company-box-frame-parameters
'(font . "-SRC-Hack-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1"))
(add-to-list 'company-box-frame-parameters
'(font-parameter . "-SRC-Hack-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1"))
(add-to-list 'company-box-frame-parameters
'(border-width . 2))
(add-to-list 'company-box-frame-parameters
'(border-color . "red"))
(add-to-list 'company-box-frame-parameters
'(scroll-bar-width . 2))
EDITED
After restart Emacs, now those settings like font seems worked. But border width and border color still does not work.
from company-box.
I know this not really about original issue, but stumbled upon this looking for a way to change the border color.
Actually what I was after was something similar to Sublime Text's version of popups:
I think I have achieved something very close, but it seems like kind of a hack. I'll share it, in case it is helpful. Here is what mine looks like:
First, set the value for undecorated
to nil
in company-box-frame-parameters
, then add this code somewhere which will turn it back to t
after the frame has already been created.
(defun add-ui-frame-hack (orig-fun &rest args)
"Set some frame parameters AFTER the frame has already been created."
(let ((frame (apply orig-fun args)))
(set-frame-parameter frame 'undecorated t)
(set-frame-parameter frame 'ns-appearance 'light)
frame))
(advice-add 'company-box--make-frame :around #'add-ui-frame-hack)
The ultimate result is you get the shadow around the frame which gives a nice border, without the title bar and buttons at the top.
This does it for me.
(Emacs 26.1, Max OS 10.14)
from company-box.
The font used in the frame is the one specified in default-frame-alist
, you can either change this variable or company-box-frame-parameters
For the scrollbar it should be fixed in a recent commit, from yesterday
from company-box.
About the scrollbar, it is fixed. Then I found it is little kind of thick. Can it be thinner? Sorry I raise so many requests. Because I try to figure out company-box child-frame code, but can't understand them enough. If I can I might PR by myself. And thanks for this great package.
from company-box.
I also tried to change the scroll-bar width but noticed that while I could make it larger, I couldn't make it any smaller than its original size.
from company-box.
@nealot I checked out (current-frame-configuration)
, found company-box-scrollbar
value is a buffer: (company-box-scrollbar . #<buffer *company-box-60817588-scrollbar*>)
. In function company-box--update-scrollbar
, The scrollbar-pixels
in let-binding seems decide the scrollbar width.
from company-box.
You're right, after I changed code
(setq
company-box--scrollbar-window
(with-selected-frame (company-box--get-frame)
(display-buffer-in-side-window
(company-box--update-scrollbar-buffer height-blank height-scrollbar percent buffer)
'((side . right) (window-width . 2)))))
In function company-box--update-scrollbar
, the scrollbar get larger, and can't get back smaller anymore no matter I re-evaluate function definition. Weird.
from company-box.
Sorry I raise so many requests.
No problem, you're raising issues others might have too :)
The scrollbar can't be smaller. It has its own window and the minimum width of a window is hardcoded in the emacs source code:
https://github.com/emacs-mirror/emacs/blob/6e362a32bc9d21f73a0f29ca6f45481edeea6f29/src/window.c#L3970
I didn't try to change this hardcoded value, it might work.
The scrollbar-pixels in let-binding seems decide the scrollbar width.
This value is the scrollbar height, in pixel.
from company-box.
border width and border color still does not work.
You can't define "normal" borders with child frames, you need to use internal border with the frame parameter internal-border-width
(add-to-list 'company-box-frame-parameters '(internal-border-width . 10))
from company-box.
@sebastiencs Would it be possible to define faces specifically for company-box borders? I know you can set the global internal border face but that makes some other components look ugly.
from company-box.
@nealot I think that you can use the function set-face-attribute
to change faces on a specific frame
from company-box.
I also wanted to change the font face of the documentation and candidates list. I thought that was defined by company
but it seems company-box
overrides those faces, so thanks to the code snippet of @stardiviner I was able to make the adjustment like this:
(use-package company-box
:after company
:ensure t
:hook (company-mode . company-box-mode)
:config
(setq company-box-show-single-candidate t)
(setq x-gtk-resize-child-frames 'hide) ;; This solves the variable scrollbar width. This is probably related to Wayland
(add-to-list
'company-box-frame-parameters
'(font . "JetBrains Mono-11")
)
)
I'm not quite happy with that since I was using a default face setting like this:
(set-face-attribute 'default nil :family "JetBrains Mono" :height 130)
Then inheriting from it to adjust the font height of other faces. Using add-to-list
makes me add a hardcoded style in the configuration.
Is there another way to set the font size?
Thanks!
from company-box.
@ig-perez You can define a variable of cons like '("JetBrains Mono" . 130)
, And use this variable in font setting to avoid hardcoded style.
from company-box.
Related Issues (20)
- company-box--height doesn't take default line-spacing into account and clips lines
- Scrolling with trackpad doesn't work
- Wrong scrollbar with only two candidate completions
- icons-in-terminal not working HOT 3
- Is there a way to disable highlight by mouse pointer HOT 1
- Company box mess with frame config HOT 2
- Error HOT 7
- company-box-doc breaks lsp-java snippets HOT 1
- Company Box crashes EMACS on first display HOT 1
- Company-Box causes EMACS to freeze and slow to respond, never actually displays any completions. HOT 3
- `(wrong-type-argument integer-or-marker-p nil)` during completing Python function (with docs) HOT 15
- vertical misalignment HOT 1
- icons not displayed when candidate list very close to left margin of frame
- only activating company box in certain major modes
- How to configure border width and colour? HOT 2
- Scroll by keyboard HOT 1
- docstring popup text color HOT 1
- How to disable tab-bar-mode in company box frame?
- company-box breaks company-show-doc-buffer ?
- Etherscan HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from company-box.