Skip to content

hook to server-after-make-frame-hook seems not work on first frame #6

@AlynxZhou

Description

@AlynxZhou

With such config:

(use-package indent-bars
  :load-path "site-lisp/indent-bars"
  :hook
  ((server-after-make-frame . (lambda ()
                                (add-hook 'prog-mode-hook  'indent-bars-mode)
                                (add-hook 'nxml-mode-hook  'indent-bars-mode)
                                (add-hook 'rpm-spec-mode-hook  'indent-bars-mode)
                                (add-hook 'yaml-ts-mode-hook  'indent-bars-mode)))))

and run emacsclient --create-frame --alternate-editor="" init.el (which will first start the daemon then open init.el, I see no bars in this file. And if I close this frame, and open another file with emacsclient --create-frame early-init.el, it will show bars correctly.

However, if I open init.el again with emacsclient --create-frame init.el, Emacs daemon will crash.

I am using PGTK Emacs 30, not sure whether it is related or not.

Maybe this package should handle frame open or not internally? Currently I cannot simply hook it, because if I only hook server-after-make-frame-hook, I cannot make it work on normal Emacs (not a daemon), but if I directly hook it with prog-mode-hook, then normal Emacs works but Emacs daemon will crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions