ui/workspaces: conform to new hook/advice conventions

This commit is contained in:
Henrik Lissner 2019-07-22 00:52:05 +02:00
parent 951a414ca4
commit 5e0177d667
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 87 additions and 97 deletions

View file

@ -441,7 +441,7 @@ the next."
;;; Hooks
;;;###autoload
(defun +workspaces|delete-associated-workspace (&optional frame)
(defun +workspaces-delete-associated-workspace-h (&optional frame)
"Delete workspace associated with current frame.
A workspace gets associated with a frame when a new frame is interactively
created."
@ -453,17 +453,7 @@ created."
(+workspace/delete frame-persp)))))
;;;###autoload
(defun +workspaces|cleanup-unassociated-buffers ()
"Kill leftover buffers that are unassociated with any perspective."
(when persp-mode
(cl-loop for buf in (buffer-list)
unless (or (persp--buffer-in-persps buf)
(get-buffer-window buf))
if (kill-buffer buf)
sum 1)))
;;;###autoload
(defun +workspaces|associate-frame (frame &optional _new-frame-p)
(defun +workspaces-associate-frame-fn (frame &optional _new-frame-p)
"Create a blank, new perspective and associate it with FRAME."
(when persp-mode
(if (not (persp-frame-list-without-daemon))
@ -479,13 +469,13 @@ created."
(defvar +workspaces--project-dir nil)
;;;###autoload
(defun +workspaces|set-project-action ()
(defun +workspaces-set-project-action-fn ()
"A `projectile-switch-project-action' that sets the project directory for
`+workspaces|switch-to-project'."
`+workspaces-switch-to-project-h'."
(setq +workspaces--project-dir default-directory))
;;;###autoload
(defun +workspaces|switch-to-project (&optional dir)
(defun +workspaces-switch-to-project-h (&optional dir)
"Creates a workspace dedicated to a new project. If one already exists, switch
to it. If in the main workspace and it's empty, recycle that workspace, without
renaming it.
@ -527,7 +517,7 @@ This be hooked to `projectile-after-switch-project-hook'."
;;; Advice
;;;###autoload
(defun +workspaces*autosave-real-buffers (orig-fn &rest args)
(defun +workspaces-autosave-real-buffers-a (orig-fn &rest args)
"Don't autosave if no real buffers are open."
(when (doom-real-buffer-list)
(apply orig-fn args))