Make config more emacsclient-friendly

This commit is contained in:
Henrik Lissner 2017-04-22 01:49:15 -04:00
parent 72bf9df905
commit b47b951a41
5 changed files with 24 additions and 10 deletions

View file

@ -85,7 +85,9 @@ is enabled/disabled.'")
(tabulated-list-mode :noesc t))) (tabulated-list-mode :noesc t)))
:config :config
(shackle-mode 1) (if (display-graphic-p)
(shackle-mode +1)
(add-transient-hook! 'after-make-frame-functions (shackle-mode +1)))
(defun doom*shackle-always-align (plist) (defun doom*shackle-always-align (plist)
"Ensure popups are always aligned and selected by default. Eliminates the need "Ensure popups are always aligned and selected by default. Eliminates the need

View file

@ -48,12 +48,13 @@
'("*Command Line*" :size 8)) '("*Command Line*" :size 8))
;; Set cursor colors later, presumably once theme is loaded ;; Set cursor colors later, presumably once theme is loaded
(add-hook! 'after-init-hook (defun +evil*init-cursors (&rest _)
(setq evil-default-cursor (face-attribute 'cursor :background nil t) (setq evil-default-cursor (face-attribute 'cursor :background nil t)
evil-normal-state-cursor 'box evil-normal-state-cursor 'box
evil-emacs-state-cursor `(,(face-attribute 'warning :foreground nil nil) box) evil-emacs-state-cursor `(,(face-attribute 'warning :foreground nil nil) box)
evil-insert-state-cursor 'bar evil-insert-state-cursor 'bar
evil-visual-state-cursor 'hollow)) evil-visual-state-cursor 'hollow))
(advice-add #'load-theme :after #'+evil*init-cursors)
;; highlight matching delimiters where it's important ;; highlight matching delimiters where it's important
(defun +evil|show-paren-mode-off () (show-paren-mode -1)) (defun +evil|show-paren-mode-off () (show-paren-mode -1))

View file

@ -42,17 +42,24 @@ renamed.")
;; auto-save on kill ;; auto-save on kill
persp-auto-save-opt 1) persp-auto-save-opt 1)
(add-hook! 'after-init-hook (defun +workspaces|init (&rest _)
(persp-mode +1) (unless persp-mode
(persp-mode +1))
;; The default perspective persp-mode makes (defined by `persp-nil-name') is ;; The default perspective persp-mode makes (defined by `persp-nil-name') is
;; special and doesn't actually represent a real persp object, so buffers ;; special and doesn't actually represent a real persp object, so buffers
;; can't really be assigned to it, among other quirks. We create a *real* ;; can't really be assigned to it, among other quirks. We create a *real*
;; main workspace to fill this role. ;; main workspace to fill this role.
(persp-add-new +workspaces-main) (persp-add-new +workspaces-main)
;; Switch to it if we aren't auto-loading the last session ;; Switch to it if we aren't auto-loading the last session
(when (= persp-auto-resume-time -1) (when (or (= persp-auto-resume-time -1)
(equal (safe-persp-name (get-current-persp)) persp-nil-name))
(persp-frame-switch +workspaces-main))) (persp-frame-switch +workspaces-main)))
(add-hook! 'after-init-hook
(if (display-graphic-p)
(+workspaces|init)
(add-hook 'after-make-frame-functions '+workspaces|init)))
(define-key persp-mode-map [remap delete-window] #'+workspace/close-window-or-workspace) (define-key persp-mode-map [remap delete-window] #'+workspace/close-window-or-workspace)
;; Per-frame perspectives ;; Per-frame perspectives

View file

@ -41,17 +41,20 @@
;; ;;
(setq doom-fallback-buffer +doom-dashboard-name) (setq doom-fallback-buffer +doom-dashboard-name)
(add-hook 'after-make-frame-functions #'+doom-dashboard-deferred-reload) (defun +doom-dashboard|init (&rest _)
(add-hook! 'window-setup-hook (add-hook 'after-make-frame-functions #'+doom-dashboard-deferred-reload)
(add-hook 'window-configuration-change-hook #'+doom-dashboard-reload)
(add-hook! 'kill-buffer-query-functions (add-hook! 'kill-buffer-query-functions
(or (not (+doom-dashboard-p)) (or (not (+doom-dashboard-p))
(ignore (ignore-errors (+doom-dashboard-force-reload)) (ignore (ignore-errors (+doom-dashboard-force-reload))
(bury-buffer)))) (bury-buffer))))
(add-hook 'window-configuration-change-hook #'+doom-dashboard-reload)
(+doom-dashboard-reload) (+doom-dashboard-reload)
(when (equal (buffer-name) "*scratch*") (when (equal (buffer-name) "*scratch*")
(switch-to-buffer (doom-fallback-buffer)))) (switch-to-buffer (doom-fallback-buffer))))
(add-hook! '(after-make-frame-functions window-setup-hook)
#'+doom-dashboard|init)
;; Compatibility with `midnight-mode' and `clean-buffer-list' ;; Compatibility with `midnight-mode' and `clean-buffer-list'
(after! midnight-mode (after! midnight-mode
(push +doom-dashboard-name clean-buffer-list-kill-never-buffer-names) (push +doom-dashboard-name clean-buffer-list-kill-never-buffer-names)

View file

@ -51,8 +51,9 @@
:group 'doom) :group 'doom)
;; Dark frames by default ;; Dark frames by default
(push (cons 'background-color (face-background 'default)) default-frame-alist) (when (display-graphic-p)
(push (cons 'foreground-color (face-foreground 'default)) default-frame-alist) (push (cons 'background-color (face-background 'default)) default-frame-alist)
(push (cons 'foreground-color (face-foreground 'default)) default-frame-alist))
(defun +doom|buffer-mode-on () (defun +doom|buffer-mode-on ()
"Enable `doom-buffer-mode' in buffers that are real (see "Enable `doom-buffer-mode' in buffers that are real (see