0

I have attempted to change my emacs theme. I am using the emacs daemon and I have attempted to create a hook to change the theme on frame creation. However when this hook is active the frame crashes immediately upon activation without an error message

This is the chunk from my init.el


(defun my-change-emacs-theme ()
  "theme is a symbol as accepted by load-theme"
  (load-theme 'whiteboard t))
(add-hook 'after-make-frame-functions 'my-change-emacs-theme )
1
  • Depending on circumstances, you might prefer (unless (memq 'whiteboard custom-enabled-themes) (load-theme 'whiteboard t))
    – phils
    Commented Jul 11, 2023 at 23:41

1 Answer 1

1

Read C-hv after-make-frame-functions.

You've given it a function which takes NO arguments, but which is going to be called with one. So that's going to cause an error.

Any time you use add-hook with a hook variable which doesn't end in -hook you know you need to check the documentation:

If the hook variable’s name does not end with ‘-hook’, that indicates it is probably an “abnormal hook”. These differ from normal hooks in two ways: they can be called with one or more arguments, and their return values can be used in some way. The hook’s documentation says how the functions are called and how their return values are used. Any functions added to an abnormal hook must follow the hook’s calling convention. By convention, abnormal hook names end in ‘-functions’.

-- C-hig (elisp)Hooks

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.