Add after-make-(window|console)-frame-hooks

This commit is contained in:
Henrik Lissner 2015-06-20 10:22:31 +02:00
parent 08a82bf2ae
commit fd8fb9ea67
3 changed files with 62 additions and 43 deletions

View file

@ -11,7 +11,7 @@
mac-option-modifier 'alt) mac-option-modifier 'alt)
;; fix emacs PATH on OSX (GUI only) ;; fix emacs PATH on OSX (GUI only)
(when window-system (add-hook! 'after-make-window-system-frame-hooks
(setenv "SHELL" "/usr/local/bin/zsh") (setenv "SHELL" "/usr/local/bin/zsh")
(setenv "EMACS" "1") ; make sure the world knows (setenv "EMACS" "1") ; make sure the world knows

View file

@ -3,8 +3,12 @@
;; This is kept separate so it can jumpstart emacs; this prevents the unstyled ;; This is kept separate so it can jumpstart emacs; this prevents the unstyled
;; flash of emacs pre-makeover. ;; flash of emacs pre-makeover.
(load-theme narf-default-theme t) (add-hook! 'after-make-console-frame-hooks
(when window-system (load-theme narf-term-theme t)
(menu-bar-mode -1)) ; no menubar
(add-hook! 'after-make-window-system-frame-hooks
(load-theme narf-default-theme t)
(set-frame-font (apply #'font-spec narf-default-font)) (set-frame-font (apply #'font-spec narf-default-font))
(scroll-bar-mode -1) ; no scrollbar (scroll-bar-mode -1) ; no scrollbar
(tool-bar-mode -1) ; no toolbar (tool-bar-mode -1) ; no toolbar

View file

@ -26,7 +26,8 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(! (require 's) (eval-when-compile
(require 's)
(require 'dash) (require 'dash)
(require 'f) (require 'f)
@ -74,6 +75,20 @@
(unless (file-exists-p path) (unless (file-exists-p path)
(make-directory path t))))) (make-directory path t)))))
(defvar after-make-console-frame-hooks '()
"Hooks to run after creating a new TTY frame")
(defvar after-make-window-system-frame-hooks '()
"Hooks to run after creating a new window-system frame")
(defun run-after-make-frame-hooks (frame)
"Selectively run either `after-make-console-frame-hooks' or
`after-make-window-system-frame-hooks'"
(select-frame frame)
(run-hooks (if window-system
'after-make-window-system-frame-hooks
'after-make-console-frame-hooks)))
(add-hook 'after-make-frame-functions 'run-after-make-frame-hooks)
(add-hook! after-init (run-after-make-frame-hooks (selected-frame)))
;; Emacs configuration ;;;;;;;;;;;;;;;;; ;; Emacs configuration ;;;;;;;;;;;;;;;;;
;;; UTF-8 please ;;; UTF-8 please