Add after-make-(window|console)-frame-hooks
This commit is contained in:
parent
08a82bf2ae
commit
fd8fb9ea67
3 changed files with 62 additions and 43 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
95
core/core.el
95
core/core.el
|
@ -26,53 +26,68 @@
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(! (require 's)
|
(eval-when-compile
|
||||||
(require 'dash)
|
(require 's)
|
||||||
(require 'f)
|
(require 'dash)
|
||||||
|
(require 'f)
|
||||||
|
|
||||||
(setq use-package-verbose narf-debug-mode)
|
(setq use-package-verbose narf-debug-mode)
|
||||||
;; (setq use-package-expand-minimally (not narf-debug-mode))
|
;; (setq use-package-expand-minimally (not narf-debug-mode))
|
||||||
(require 'use-package)
|
(require 'use-package)
|
||||||
|
|
||||||
(defun use-package--add-keyword (keyword after)
|
(defun use-package--add-keyword (keyword after)
|
||||||
(setq use-package-keywords
|
(setq use-package-keywords
|
||||||
(-insert-at (-find-index (lambda (key) (eq key after)) use-package-keywords)
|
(-insert-at (-find-index (lambda (key) (eq key after)) use-package-keywords)
|
||||||
keyword use-package-keywords)))
|
keyword use-package-keywords)))
|
||||||
|
|
||||||
(progn ; remap :bind to bind! macro instead of bind-keys
|
(progn ; remap :bind to bind! macro instead of bind-keys
|
||||||
;; (defun use-package-handler/:bind
|
;; (defun use-package-handler/:bind
|
||||||
;; (name-symbol keyword arg rest state &optional override)
|
;; (name-symbol keyword arg rest state &optional override)
|
||||||
;; (let ((commands (mapcar #'cdr arg)))
|
;; (let ((commands (mapcar #'cdr arg)))
|
||||||
;; (use-package-concat
|
;; (use-package-concat
|
||||||
;; (use-package-process-keywords name-symbol
|
;; (use-package-process-keywords name-symbol
|
||||||
;; (use-package-sort-keywords
|
;; (use-package-sort-keywords
|
||||||
;; (use-package-plist-maybe-put rest :defer t))
|
;; (use-package-plist-maybe-put rest :defer t))
|
||||||
;; (use-package-plist-append state :commands commands))
|
;; (use-package-plist-append state :commands commands))
|
||||||
;; `((ignore (,bind! ,@arg))))))
|
;; `((ignore (,bind! ,@arg))))))
|
||||||
)
|
)
|
||||||
|
|
||||||
(progn ; add :after to use-package
|
(progn ; add :after to use-package
|
||||||
(use-package--add-keyword :after :load-path)
|
(use-package--add-keyword :after :load-path)
|
||||||
|
|
||||||
(defalias 'use-package-normalize/:after 'use-package-normalize-symlist)
|
(defalias 'use-package-normalize/:after 'use-package-normalize-symlist)
|
||||||
|
|
||||||
(defun use-package-handler/:after (name-symbol keyword arg rest state)
|
(defun use-package-handler/:after (name-symbol keyword arg rest state)
|
||||||
(let ((body (use-package-process-keywords name-symbol rest state)))
|
(let ((body (use-package-process-keywords name-symbol rest state)))
|
||||||
(if (null arg)
|
(if (null arg)
|
||||||
body
|
body
|
||||||
(use-package-concat
|
(use-package-concat
|
||||||
(use-package-process-keywords name-symbol
|
(use-package-process-keywords name-symbol
|
||||||
(use-package-sort-keywords (use-package-plist-maybe-put rest :defer t)) state)
|
(use-package-sort-keywords (use-package-plist-maybe-put rest :defer t)) state)
|
||||||
(apply #'nconc
|
(apply #'nconc
|
||||||
(mapcar (lambda (feature)
|
(mapcar (lambda (feature)
|
||||||
`((after! ,feature (require ',name-symbol))))
|
`((after! ,feature (require ',name-symbol))))
|
||||||
(delete-dups arg))))))))
|
(delete-dups arg))))))))
|
||||||
|
|
||||||
;; Make any folders needed
|
;; Make any folders needed
|
||||||
(dolist (file '("" "undo" "backup"))
|
(dolist (file '("" "undo" "backup"))
|
||||||
(let ((path (concat narf-temp-dir file)))
|
(let ((path (concat narf-temp-dir file)))
|
||||||
(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 ;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue