Skip to content

Commit

Permalink
refactor: make use of +hook-once!
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Apr 18, 2023
1 parent 4a08072 commit 43b12bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
10 changes: 3 additions & 7 deletions modules/extras/me-mu4e-ui.el
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,9 @@ will also be the width of all other printable characters."
(defun +mu4e-ui-setup ()
(if (display-graphic-p)
(+mu4e--ui-setup)
(add-hook
'server-after-make-frame-hook
(defun +mu4e-ui--setup-once-h ()
(when (display-graphic-p)
(+mu4e--ui-setup)
(remove-hook 'server-after-make-frame-hook
#'+mu4e--ui-setup-once-h))))))
(+hook-once! server-after-make-frame-hook
(when (display-graphic-p)
(+mu4e--ui-setup)))))


(provide 'me-mu4e-ui)
Expand Down
14 changes: 5 additions & 9 deletions modules/me-daemon.el
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,11 @@
(defun +daemon--reload-theme-h ()
(load-theme minemacs-theme t)))

(add-hook
'server-after-make-frame-hook
(defun +daemon--reload-battery-mode-once-h ()
(when (and (display-graphic-p)
(bound-and-true-p display-battery-mode))
(display-battery-mode -1)
(display-battery-mode 1)
(remove-hook 'server-after-make-frame-hook
#'+daemon--reload-battery-mode-once-h))))
(+hook-once! server-after-make-frame-hook
(when (and (display-graphic-p)
(bound-and-true-p display-battery-mode))
(display-battery-mode -1)
(display-battery-mode 1)))


(provide 'me-daemon)
Expand Down

0 comments on commit 43b12bb

Please sign in to comment.