Closed syl20bnr closed 8 years ago
Hi Constantin,
Hello.
crash on startup of the emacsclient because of nil persp variable.
Hmhmm... This is something strange. Need to look deeper.
ok, it was a long time ago when I started emacs daemon last time.) And first of all it looks like the persp-alambda
and so the persp-hook-once
macros do not work anymore.
Could you test this branch https://github.com/Bad-ptr/persp-mode.el/tree/alambda-no-more ? (can't test it myself until tomorrow)
Well, I tested that branch myself and I think it must solve the https://github.com/syl20bnr/spacemacs/issues/4121 issue(and https://github.com/syl20bnr/spacemacs/issues/4187 too). It's merged into master now.
As for this https://github.com/syl20bnr/spacemacs/issues/4120 issue, probably I can add custom variable to not restore window configuration for new frames.
Sorry for the late reply, I tested last persp-mode
from MELPA and the emacsclient crash is still here. I'll ask some people if they can test it on their side.
Sorry for the late reply
It's ok.)
the emacsclient crash is still here
This is very strange because I can not reproduce it myself. Actually any action on the nil perspective must be valid.
Well I think I know how to get more debug information:
emacs --daemon --debug-init && echo 'Emacs daemon started normally.'
persp-mode
is not active:
emacsclient --eval 'persp-mode'
(it must print nil
)persp-mode-start-and-remove-from-make-frame-hook
is in the after-make-frame-functions
list:
emacsclient --eval "(memq #'persp-mode-start-and-remove-from-make-frame-hook after-make-frame-functions)"
persp-mode-start-and-remove-from-make-frame-hook
from the after-make-frame-functions
list:
emacsclient --eval "(setq after-make-frame-functions (delete #'persp-mode-start-and-remove-from-make-frame-hook after-make-frame-functions))"
emacsclient -t
M-:
):
(persp-mode-start-and-remove-from-make-frame-hook (selected-frame))
I think this is it:
emacs --daemon && echo 'Emacs daemon started normally.'
emacsclient -c
, make it fullscreen.M-: (dolist (i '(1 2 3 4 5)) (if (= 0 (% i 2)) (split-window-horizontally) (split-window-vertically)))
emacsclinet -t
Oops, crashed.persp-init-new-frame
from the after-make-frame-functions
:
emacsclient --eval "(setq after-make-frame-functions (delete #'persp-init-new-frame after-make-frame-functions))"
emacsclinet -t
, and try to launch the persp-init-new-frame
manually: M-: (persp-init-new-frame (selected-frame))
and get an error, saying something like:
(error "Window #<window 24 on *scratch*> too small to accommodate state")
Now it must be fixed: 56828b520e30662da7a20557971b47a99c56011a
Just tried to run spacemacs in Ubuntu 14.04.4 LTS with different emacs versions:
The standard ubuntu's 24.3.1 -- the only problem of spacemacs here is the helm-flx package, which depends on emacs 24.4. No crash here.)
24.4.2 -- built from sources(ftp://ftp.gnu.org/pub/gnu/emacs/emacs-24.4.tar.xz). No crash.
25.0.50.1 -- built from sources. No crash.
The only error I was able to get in all emacs versions is the apply: Device 1 is not a termcap terminal device
, which is the cause of the bracketed-paste--tty-state-exit-hook
in the kill-emacs-hook
.
What the bracketed-paste--tty-state-exit-hook
is trying to do is to execute: (send-string-to-terminal "\e[?2004l")
on emacs exit. This don't work if your current frame is a graphical frame.
I consider it as a bug in the bracketed-paste.el
.)
Also to support emacs 25 in your fork (https://github.com/syl20bnr/persp-mode.el), replace the: https://github.com/syl20bnr/persp-mode.el/blob/master/persp-mode.el#L580
(defmacro persp-alambda (arglist &rest body)
"Anaphoric lambda."
(declare (indent 1))
`(labels ((self ,arglist ,@body))
#'self))
with
(unless (fboundp 'self) (fset 'self nil))
(defmacro persp-alambda (args &rest body)
"Anaphoric lambda."
(declare (indent defun))
`(lexical-let ((self))
(setq self #'(lambda ,args
(letf (((symbol-function 'self) self))
,@body)))
self))
This will fix the *ERROR*: Symbol’s function definition is void: self
for emacs 25 without breaking older emacses(prove me wrong:)). Just saying because I will break backward compatibility(if it is not already broken) in near feature and suppose users(even those who uses emacs 25) will switch to your fork.
That's great, I'll test it again this evening. Thank you for the fix for my fork but the sooner I can get rid of this fork, the better :-)
Big thank you for tracking the bug apply: Device 1 is not a termcap terminal device
.
In the case if still get a crash(Just if you don't know how to debug emacs:))
If you can not create an emacs frame -- check the before-make-frame-hook
and the after-make-frame-functions
. Just remove functions from these lists one by one emacsclient --eval '(pop after-make-frame-functions)'
and see after which removed function you can create the frame. After the frame is created -- M-x toggle-debug-on-error RET
and try to execute the last removed function manually (You can run a function from the before-make-frame-hook
list without arguments, but to run a function from the after-make-frame-functions
you must pass the (selected-frame)
as an argument).
If you can not kill emacs -- do the same for the kill-emacs-hook
, the kill-emacs-query-functions
and maybe the delete-frame-functions
.
@Bad-ptr fwiw on emacs 25 the fix to @syl20bnr's fork you mention above does not appear to work. If I emacsclient --eval '(pop after-make-frame-functions)'
once to get rid of self
then emacsclient
starts as normal, but persp-mode can no longer create layouts. because *persp-hash*
is nil
the fix ... you mention above does not appear to work
Ok, try this:
(unless (fboundp 'self) (fset 'self nil))
(defmacro persp-alambda (args &rest body)
"Anaphoric lambda."
(declare (indent defun))
`(let ((lexical-binding t))
(,(if (> emacs-major-version 25)
'let
'lexical-let) ((self))
(setq self #'(lambda ,args
(letf (((symbol-function 'self) self))
,@body)))
self)))
@Bad-ptr nope. emacsclient -t foo
exits immediately. emacsclient -c foo
displays:
Waiting for Emacs...
*ERROR*: Symbol’s function definition is void: self
then exits
This is bad :( Just to be sure that you are not doing something wrong: Can you provide a recipe of what you are doing to apply this (so-called:p)"fix"
erg, I forgot to delete the .elc
. Both fixes actually work for me, sorry about that.
I forgot to delete the .elc
hehe. I knew it!
@Bad-ptr can you fix here or should @syl20bnr update his fork? Thanks!
@aaronjensen I'm planing to do a 'stable' release with some backward compatibility fixes. But I don't know when I'l do it)
Sorry for being so late on this. I tested the last version on MELPA and it fixes the crash :+1: Thank you :100:
Hi Constantin,
This PR fixes a crash on startup of the emacsclient because of nil persp variable. Not sure if this nil persp is expected but in the meantime this PR fixes the crash.
For more info see https://github.com/syl20bnr/spacemacs/issues/4120 and https://github.com/syl20bnr/spacemacs/issues/4121
Cheers, syl20bnr