Email or username:

Password:

Forgot your password?
Top-level
Andrew Tropin

@zrzz

~/tmp/init.el:
(defun test-fn ()
""
(message "fuuuck!")
(when (and (daemonp) (string= server-name "server"))
(message "everything is ok"))
(message "yeah!"))
(add-hook 'after-init-hook 'test-fn)

emacs --fg-daemon=test --no-site-lisp --no-site-file --init-directory=~/tmp

3 comments
Andrew Tropin

@zrzz Oh, my bad, it's cause of server-name, not daemonp. Today it's me, not a compiler or os. (Still silently hanging).

I thought I tried it in isolation and only later added server-name 🤔

zrzz

@abcdw Looks like the current master correctly prints the error and doesn't hang. So I guess this was fixed sometime after 29.

zrzz

@abcdw Looks like this is actually triggered by the access to the server-name variable which is undefined since it's not autoloaded. Using (defun test-fn () foo) produces the same hang.

Access to the undefined variable throws an error and apparently if you signal an error in after-init-hook while in daemon mode it hangs instead of printing a backtrace. Not sure why that happens.

If I stick a (setq debug-on-error t) at the beginning of the original example then it does produce the expected backtrace:

Debugger entered--Lisp error: (void-variable server-name)
(string= server-name "server")
(and (daemonp) (string= server-name "server"))
(if (and (daemonp) (string= server-name "server")) (progn (message "everything is ok")))
test-fn()
run-hooks(after-init-hook delayed-warnings-hook)
command-line()
normal-top-level()

@abcdw Looks like this is actually triggered by the access to the server-name variable which is undefined since it's not autoloaded. Using (defun test-fn () foo) produces the same hang.

Access to the undefined variable throws an error and apparently if you signal an error in after-init-hook while in daemon mode it hangs instead of printing a backtrace. Not sure why that happens.

Go Up