-
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
Can't open more than one emacs frame (Invalid face: linum). #6104
Comments
It appears that this bug disappears when either the |
Disabling the |
I believe this is because I don't have line numbers enabled in these modes. |
I'm pretty sure this is related to this issue: kaushalmodi/.emacs.d#4 I haven't tried the proposed fix. |
It looks related. Unfortunately, that fix only seems to allow one frame to load. Really, it looks like (defvar frame-ready nil)
(add-hook 'after-make-frame-functions (lambda (frame) (set-frame-parameter frame 'frame-ready t)))
(add-hook 'after-init-hook (lambda () (set-frame-parameter nil 'frame-ready t))) To mark a frame as "ready" and changing: (defun nlinum--setup-window ()
(let ((width (if (display-graphic-p)
(ceiling
(let ((width (nlinum--face-width 'linum)))
(if width
(/ (* nlinum--width 1.0 width)
(frame-char-width))
(/ (* nlinum--width 1.0
(nlinum--face-height 'linum))
(frame-char-height)))))
nlinum--width)))
(set-window-margins nil (if nlinum-mode width)
(cdr (window-margins))))) To: (defun nlinum--setup-window ()
(let ((width (if (and frame-ready (display-graphic-p)) ;; <-- Here
(ceiling
(let ((width (nlinum--face-width 'linum)))
(if width
(/ (* nlinum--width 1.0 width)
(frame-char-width))
(/ (* nlinum--width 1.0
(nlinum--face-height 'linum))
(frame-char-height)))))
nlinum--width)))
(set-window-margins nil (if nlinum-mode width)
(cdr (window-margins))))) |
There appears to be a two year old upstream report: https://lists.gnu.org/archive/html/bug-gnu-emacs/2014-10/msg00126.html |
@Stebalien FYI fd756a1 reverted line numbers back to the |
@StreakyCobra Thanks! (Although it might be a good idea to keep this open as there is still an nlinum layer which may eventually, from what I've read, be enabled by default). |
Following code is worked for only one frame. (defun initialize-nlinum (&optional frame)
(require 'nlinum)
(add-hook 'prog-mode-hook 'nlinum-mode))
(when (daemonp) (add-hook 'window-setup-hook 'initialize-nlinum)) But, I still not find out a way to make |
Because I use (defun initialize-nlinum (&optional frame)
(require 'nlinum)
(add-hook 'prog-mode-hook 'nlinum-mode))
(when (daemonp)
(add-hook 'window-setup-hook 'initialize-nlinum)
(defadvice make-frame (around toggle-nlinum-mode compile activate)
(nlinum-mode -1) ad-do-it (nlinum-mode 1))) Those code make my emacs 24.5.1 daemon mode worked with nlinum-mode very well. |
Simply running linum/nlinum in ;; Set/unset linum
(if (daemonp)
;; Need to delay linum activation till the frame and fonts are loaded, only
;; for emacsclient launches. For non-daemon, regular emacs launches, the
;; frame is loaded *before* the emacs config is read. Not doing so results
;; in the below error in emacs 24.5:
;; *ERROR*: Invalid face: linum
(add-hook 'after-make-frame-functions #'modi/toggle-linum)
;; Even when running in non-daemon mode, run `modi/toggle-linum' only after the
;; init has loaded, so that the last modified value of `modi/linum-fn-default'
;; if any in setup-personal.el is the one effective, not its standard value
;; in its defvar form above.
(add-hook 'after-init-hook #'modi/toggle-linum)) PS: I was surprised to see my config referenced here :) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid! |
Description
Since fa4eeb4, I can't open more than one emacs frame (client/daemon).
Reproduction guide
emacsclient -c -n
).Observed behaviour:
emacsclient spits out the following when run the second time:
There are no relevant errors in the
*messages*
buffer (as far as I can tell).Expected behaviour:
Two frames are opened.
System Info
The text was updated successfully, but these errors were encountered: