Add restart-emacs package & commands
This commit is contained in:
parent
d1068723e4
commit
0bd88b8414
5 changed files with 22 additions and 1 deletions
|
@ -623,7 +623,7 @@ loads MODULE SUBMODULE's packages.el file."
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(defun doom//reload ()
|
(defun doom//reload ()
|
||||||
"Reload your Doom config."
|
"Reload your Doom config. Experimental!"
|
||||||
(interactive)
|
(interactive)
|
||||||
(load (concat doom-emacs-dir "init.el") nil nil 'nosuffix)
|
(load (concat doom-emacs-dir "init.el") nil nil 'nosuffix)
|
||||||
(doom//reload-load-path))
|
(doom//reload-load-path))
|
||||||
|
|
|
@ -250,6 +250,10 @@ DEFAULT is non-nil, set the default mode-line for all buffers."
|
||||||
:hook (lisp-mode . rainbow-delimiters-mode)
|
:hook (lisp-mode . rainbow-delimiters-mode)
|
||||||
:config (setq rainbow-delimiters-max-face-count 3))
|
:config (setq rainbow-delimiters-max-face-count 3))
|
||||||
|
|
||||||
|
(def-package! restart-emacs
|
||||||
|
:commands restart-emacs
|
||||||
|
:config (setq restart-emacs--args (list "--restore")))
|
||||||
|
|
||||||
;; For a distractions-free-like UI, that dynamically resizes margins and can
|
;; For a distractions-free-like UI, that dynamically resizes margins and can
|
||||||
;; center a buffer.
|
;; center a buffer.
|
||||||
(def-package! visual-fill-column
|
(def-package! visual-fill-column
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
(package! nlinum-relative))
|
(package! nlinum-relative))
|
||||||
(package! rainbow-delimiters)
|
(package! rainbow-delimiters)
|
||||||
(package! visual-fill-column)
|
(package! visual-fill-column)
|
||||||
|
(package! restart-emacs)
|
||||||
|
|
||||||
;; core-editor.el
|
;; core-editor.el
|
||||||
(package! ace-link)
|
(package! ace-link)
|
||||||
|
|
|
@ -425,6 +425,12 @@ the next."
|
||||||
|
|
||||||
(t (+workspace-error "Can't delete last workspace" t)))))))
|
(t (+workspace-error "Can't delete last workspace" t)))))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +workspace/restart-emacs-then-restore ()
|
||||||
|
"Restarts Emacs, then restores the session."
|
||||||
|
(interactive)
|
||||||
|
(restart-emacs (list "--restore")))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Tabs display in minibuffer
|
;; Tabs display in minibuffer
|
||||||
|
|
|
@ -26,6 +26,10 @@ new project directory.")
|
||||||
"The basename of the file to store single workspace perspectives. Will be
|
"The basename of the file to store single workspace perspectives. Will be
|
||||||
stored in `persp-save-dir'.")
|
stored in `persp-save-dir'.")
|
||||||
|
|
||||||
|
(defun +workspaces-restore-last-session (&rest _)
|
||||||
|
(add-hook 'emacs-startup-hook #'+workspace/load-session 'append))
|
||||||
|
(map-put command-switch-alist '"--restore" #'+workspaces-restore-last-session)
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Plugins
|
;; Plugins
|
||||||
|
@ -105,7 +109,13 @@ Uses `+workspaces-main' to determine the name of the main workspace."
|
||||||
(advice-remove #'doom-buffer-list #'+workspace-buffer-list))))
|
(advice-remove #'doom-buffer-list #'+workspace-buffer-list))))
|
||||||
(add-hook 'persp-mode-hook #'+workspaces|init-persp-mode)
|
(add-hook 'persp-mode-hook #'+workspaces|init-persp-mode)
|
||||||
|
|
||||||
|
(defun +workspaces|leave-nil-perspective (&rest _)
|
||||||
|
(when (string= (+workspace-current-name) persp-nil-name)
|
||||||
|
(persp-frame-switch +workspaces-main)))
|
||||||
|
(add-hook 'persp-after-load-state-functions #'+workspaces|leave-nil-perspective)
|
||||||
|
|
||||||
;; Modify `delete-window' to close the workspace if used on the last window
|
;; Modify `delete-window' to close the workspace if used on the last window
|
||||||
|
(define-key persp-mode-map [remap restart-emacs] #'+workspace/restart-emacs-then-restore)
|
||||||
(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)
|
||||||
(define-key persp-mode-map [remap evil-delete-window] #'+workspace/close-window-or-workspace)
|
(define-key persp-mode-map [remap evil-delete-window] #'+workspace/close-window-or-workspace)
|
||||||
;; only auto-save when real buffers are present
|
;; only auto-save when real buffers are present
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue