feature/workspaces: remove +workspace-change-hook
persp-mode provides the following hooks already (among many others): + persp-{before,after}-switch-functions + persp-renamed-functions + persp-created-functions + persp-before-kill-functions This makes +workspace-change-hook redundant.
This commit is contained in:
parent
ea97600507
commit
10167b85b5
1 changed files with 6 additions and 17 deletions
|
@ -3,9 +3,6 @@
|
|||
(defvar +workspace-data-file "_workspaces"
|
||||
"The file basename in which to store single workspace perspectives.")
|
||||
|
||||
(defvar +workspace-change-hook ()
|
||||
"Hooks run when workspaces are added, removed, renamed or switched to.")
|
||||
|
||||
(defvar +workspace--last nil)
|
||||
(defvar +workspace--index 0)
|
||||
|
||||
|
@ -155,9 +152,7 @@ Otherwise return t on success, nil otherwise."
|
|||
(error "Can't create a new '%s' workspace" name))
|
||||
(when (+workspace-exists-p name)
|
||||
(error "A workspace named '%s' already exists" name))
|
||||
(when (persp-add-new name)
|
||||
(run-hooks '+workspace-change-hook)
|
||||
t))
|
||||
(persp-add-new name))
|
||||
|
||||
;;;###autoload
|
||||
(defun +workspace-rename (name new-name)
|
||||
|
@ -165,9 +160,7 @@ Otherwise return t on success, nil otherwise."
|
|||
success, nil otherwise."
|
||||
(when (+workspace--protected-p name)
|
||||
(error "Can't rename '%s' workspace" name))
|
||||
(when (persp-rename new-name (+workspace-get name))
|
||||
(run-hooks '+workspace-change-hook)
|
||||
name))
|
||||
(persp-rename new-name (+workspace-get name)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +workspace-delete (name &optional inhibit-kill-p)
|
||||
|
@ -178,9 +171,7 @@ buffers."
|
|||
(error "Can't delete '%s' workspace" name))
|
||||
(+workspace-get name) ; error checking
|
||||
(persp-kill name inhibit-kill-p)
|
||||
(unless (+workspace-exists-p name)
|
||||
(run-hooks '+workspace-change-hook)
|
||||
t))
|
||||
(not (+workspace-exists-p name)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +workspace-switch (name &optional auto-create-p)
|
||||
|
@ -193,11 +184,9 @@ buffers."
|
|||
(setq +workspace--last
|
||||
(or (and (not (string= old-name persp-nil-name))
|
||||
old-name)
|
||||
+workspaces-main)))
|
||||
+workspaces-main))
|
||||
(persp-frame-switch name)
|
||||
(when (equal (+workspace-current-name) name)
|
||||
(run-hooks '+workspace-change-hook)
|
||||
t))
|
||||
(equal (+workspace-current-name) name)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +workspace-on-new-frame (frame &optional _new-frame-p)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue