-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Font in daemon mode #299
Comments
Very nice find! I'll try this shortly. |
@tang0th well it is already implemented: https://github.com/syl20bnr/spacemacs/blob/master/core/spacemacs-mode.el#L160 Use |
regression since the refactoring of |
other regression linked to the refactoring #535 |
@syl20bnr I confirm this bug. On the following screenshot to the left is the frame opened by Also, after I closed the right-hand-side Emacs window, which was opened by calling |
I can confirm that the issue can be partly worked around by adding the same default font to .Xdefaults, but the curvy bits of the status line are still broken: https://antoszka.pl/perm/a06a7a6af3de69273034b6eaba9b08685f0cdbdf.png ← I'm running a totally default checkout (done an hour ago), emacs 24.5.1, Lucid toolkit. |
I have started a fix for this and the status line issues. I have pushed a work in progress branch that seems to correctly work for the fonts. Now I need to go through the set up code for powerline, etc and find what would behave differently in text vs graphical modes. If anyone has a cleaner way of doing this, let me know: My branch: The commit with the font change: |
Also, I notice |
Further testing notices that opening successive frames doesn't work correctly. This was just a test. I think this is the right track though. |
@travisbhartwell -- why not write some unit tests (is that even possible?) |
So I did some further hacking this morning and even if I only run this on the first graphical frame, subsequent frames do not get set properly. It's like it's losing the information. A friend shares this for how they use fonts and daemon mode: https://gist.github.com/RichardBarrell/756116c9ac41c1c1454b From this, I wonder if the appropriate thing to do instead of calling |
@travisbhartwell I'm OK with any solution that improves the current situation. |
I made some more progress. Someone Since there are no hooks provided for these functions, we can use advising. I just tried a test. In (if (not x-initialized)
(advice-add 'x-initialize-window-system :after
(lambda (x)
(message "*************************Initializing Spacemacs!")))
(message "*************************Initializing Spacemacs!")) Since in regular startup X is already initialized by the time I suggest we make a macro that essentially does this, perhaps Perhaps we could just advice the initialization function once and then just have the macro add a lambda function containing the Then we need to go through every part of the Spacemacs initialization (font selection, powerline setup, theme setup, etc) and wrap this macro around it. What do you think @syl20bnr? I've been discussing this with @cmccloud on IRC about this, particularly OS X portions. |
@travisbhartwell and I put this together and it seems to work - he ran some tests running emacs as a daemon and variable values deferred by the macro were nil until the initial launch of x-windows, after which they were set. (defvar spacemacs//after-display-system-init-list '())
(advice-add (cond ((eq system-type 'darwin) 'ns-initialize-window-system)
((eq system-type 'windows-nt) 'w32-initialize-window-system)
((eq system-type 'gnu/linux) 'x-initialize-window-system))
:after
(lambda (&rest args)
(mapcar (lambda (fn) (funcall fn))
(reverse spacemacs//after-display-system-init-list))))
(defmacro spacemacs//do-after-display-system-init (&rest body)
`(let ((init (cond ((eq system-type 'darwin) 'ns-initialized)
((eq system-type 'windows-nt) 'w32-initialized)
((eq system-type 'gnu/linux) 'x-initialized)
(t 't)))) ; fallback to normal loading behavior
(if (symbol-value init)
,@body
(push (lambda () ,@body) spacemacs//after-display-system-init-list)))) Let us know if you have any thoughts. |
I like it, good job guys 👍 I'm not sure about the state of Spacemacs 24.3 compatibility, I know that magit requires 24.4 now but we cannot use I really like the new advice API, I wonder if I should drop the support of 24.3. |
Oh, I didn't think about that. If we want 24.3 support, I can change this to use defadvice. Let me know what to do. |
WORK IN PROGRESS. NEEDS TESTING. NEEDS TO USE THIS THROUGHOUT THE REST OF SPACEMACS INITIALIZATION. Will push a clean commit when everything is working satisfactorily. Add macro to wrap things that depend on the display being initialized (and a frame active), such as getting the font. Advise the `server-create-window-system-frame` function which is called by emacsclient when creating a window-system frame. This is only run the first time a frame is created, so the advice removes itself. Fixes: syl20bnr#299 and syl20bnr#1894 (Among others)
WORK IN PROGRESS. NEEDS TESTING. NEEDS TO USE THIS THROUGHOUT THE REST OF SPACEMACS INITIALIZATION. Will push a clean commit when everything is working satisfactorily. Add macro to wrap things that depend on the display being initialized (and a frame active), such as getting the font. Advise the `server-create-window-system-frame` function which is called by emacsclient when creating a window-system frame. This is only run the first time a frame is created, so the advice removes itself. Fixes: syl20bnr#299 and syl20bnr#1894 (Among others)
WORK IN PROGRESS. NEEDS TESTING. NEEDS TO USE THIS THROUGHOUT THE REST OF SPACEMACS INITIALIZATION. Will push a clean commit when everything is working satisfactorily. Add macro to wrap things that depend on the display being initialized (and a frame active), such as getting the font. Advise the `server-create-window-system-frame` function which is called by emacsclient when creating a window-system frame. This is only run the first time a frame is created, so the advice removes itself. Fixes: syl20bnr#299 and syl20bnr#1894 (Among others)
WORK IN PROGRESS. NEEDS TESTING. NEEDS TO USE THIS THROUGHOUT THE REST OF SPACEMACS INITIALIZATION. Will push a clean commit when everything is working satisfactorily. Add macro to wrap things that depend on the display being initialized (and a frame active), such as getting the font. Advise the `server-create-window-system-frame` function which is called by emacsclient when creating a window-system frame. This is only run the first time a frame is created, so the advice removes itself. Fixes: syl20bnr#299 and syl20bnr#1894 (Among others)
Add macro to wrap things that depend on the display being initialized (and a frame active), such as getting the font. Advise the `server-create-window-system-frame` function which is called by emacsclient when creating a window-system frame. This is only run the first time a frame is created, so the advice removes itself. Fixes: syl20bnr#299 and syl20bnr#1894 (Among others)
Add macro to wrap things that depend on the display being initialized (and a frame active), such as getting the font. Advise the `server-create-window-system-frame` function which is called by emacsclient when creating a window-system frame. This is only run the first time a frame is created, so the advice removes itself. Fixes: syl20bnr#299 and syl20bnr#1894 (Among others)
Add macro to wrap things that depend on the display being initialized (and a frame active), such as getting the font. Advise the `server-create-window-system-frame` function which is called by emacsclient when creating a window-system frame. This is only run the first time a frame is created, so the advice removes itself. Fixes: syl20bnr#299 and syl20bnr#1894 (Among others)
Add macro to wrap things that depend on the display being initialized (and a frame active), such as getting the font. Advise the `server-create-window-system-frame` function which is called by emacsclient when creating a window-system frame. This is only run the first time a frame is created, so the advice removes itself. Fixes: syl20bnr#299 and syl20bnr#1894 (Among others)
Add macro to wrap things that depend on the display being initialized (and a frame active), such as getting the font. Advise the `server-create-window-system-frame` function which is called by emacsclient when creating a window-system frame. This is only run the first time a frame is created, so the advice removes itself. Fixes: #299 and #1894 (Among others)
Add macro to wrap things that depend on the display being initialized (and a frame active), such as getting the font. Advise the `server-create-window-system-frame` function which is called by emacsclient when creating a window-system frame. This is only run the first time a frame is created, so the advice removes itself. Fixes: syl20bnr#299 and syl20bnr#1894 (Among others)
This is still an inssue on Mac OS, Emacs 26.1 on |
When started in daemon mode the font in Emacs reverts to the default one because the font is not set for each frame.
There are two options:
Emacs.font: Source Code Pro-10
(which I'd have to do).Should the second option be implemented in spacemacs?
See: https://stackoverflow.com/questions/3984730/emacs-gui-with-emacs-daemon-not-loading-fonts-correctly
The text was updated successfully, but these errors were encountered: