refactor(workspaces): +workspace/delete: rename to +workspace/kill

To be more consistent with other uses of the verb in the Emacs
ecosystem. Also done in preparation for a new +workspaces/delete command
for #7869.

Ref: #7869
This commit is contained in:
Henrik Lissner 2024-07-05 16:59:41 -04:00
parent 934141a01e
commit 5289861109
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
10 changed files with 24 additions and 24 deletions

View file

@ -36,7 +36,7 @@
(interactive) (interactive)
(if (modulep! :ui workspaces) (if (modulep! :ui workspaces)
(when (+workspace-exists-p +calendar-workspace-name) (when (+workspace-exists-p +calendar-workspace-name)
(+workspace/delete +calendar-workspace-name)) (+workspace/kill +calendar-workspace-name))
(when (window-configuration-p +calendar--wconf) (when (window-configuration-p +calendar--wconf)
(set-window-configuration +calendar--wconf)) (set-window-configuration +calendar--wconf))
(setq +calendar--wconf nil)) (setq +calendar--wconf nil))

View file

@ -60,7 +60,7 @@ workspace for it."
(mapc #'kill-buffer (doom-buffers-in-mode 'circe-mode (buffer-list) t)) (mapc #'kill-buffer (doom-buffers-in-mode 'circe-mode (buffer-list) t))
(when (modulep! :ui workspaces) (when (modulep! :ui workspaces)
(when (equal (+workspace-current-name) +irc--workspace-name) (when (equal (+workspace-current-name) +irc--workspace-name)
(+workspace/delete +irc--workspace-name))))) (+workspace/kill +irc--workspace-name)))))
;;;###autoload ;;;###autoload
(defun +irc/jump-to-channel (&optional this-server) (defun +irc/jump-to-channel (&optional this-server)

View file

@ -109,7 +109,7 @@
(mapc #'kill-buffer show-buffers)) (mapc #'kill-buffer show-buffers))
(if (and (modulep! :ui workspaces) (if (and (modulep! :ui workspaces)
(+workspace-exists-p +rss-workspace-name)) (+workspace-exists-p +rss-workspace-name))
(+workspace/delete +rss-workspace-name) (+workspace/kill +rss-workspace-name)
(when (window-configuration-p +rss--wconf) (when (window-configuration-p +rss--wconf)
(set-window-configuration +rss--wconf)) (set-window-configuration +rss--wconf))
(setq +rss--wconf nil) (setq +rss--wconf nil)

View file

@ -412,7 +412,7 @@
:desc "Rename workspace" "r" #'+workspace/rename :desc "Rename workspace" "r" #'+workspace/rename
:desc "Create workspace" "c" #'+workspace/new :desc "Create workspace" "c" #'+workspace/new
:desc "Create named workspace" "C" #'+workspace/new-named :desc "Create named workspace" "C" #'+workspace/new-named
:desc "Delete workspace" "k" #'+workspace/delete :desc "Delete workspace" "k" #'+workspace/kill
:desc "Save workspace" "S" #'+workspace/save :desc "Save workspace" "S" #'+workspace/save
:desc "Switch to other workspace" "o" #'+workspace/other :desc "Switch to other workspace" "o" #'+workspace/other
:desc "Switch to left workspace" "p" #'+workspace/switch-left :desc "Switch to left workspace" "p" #'+workspace/switch-left

View file

@ -379,8 +379,8 @@
:desc "New named workspace" "N" #'+workspace/new-named :desc "New named workspace" "N" #'+workspace/new-named
:desc "Load workspace from file" "l" #'+workspace/load :desc "Load workspace from file" "l" #'+workspace/load
:desc "Save workspace to file" "s" #'+workspace/save :desc "Save workspace to file" "s" #'+workspace/save
:desc "Delete session" "x" #'+workspace/kill-session :desc "Kill session" "x" #'+workspace/kill-session
:desc "Delete this workspace" "d" #'+workspace/delete :desc "Kill this workspace" "d" #'+workspace/kill
:desc "Rename workspace" "r" #'+workspace/rename :desc "Rename workspace" "r" #'+workspace/rename
:desc "Restore last session" "R" #'+workspace/restore-last-session :desc "Restore last session" "R" #'+workspace/restore-last-session
:desc "Next workspace" "]" #'+workspace/switch-right :desc "Next workspace" "]" #'+workspace/switch-right

View file

@ -365,7 +365,7 @@ When otherwise called, open a dired buffer and enable `dired-mu4e-attach-ctrl-c-
;; (prolusion-mail-hide) ;; (prolusion-mail-hide)
(cond (cond
((and (modulep! :ui workspaces) (+workspace-exists-p +mu4e-workspace-name)) ((and (modulep! :ui workspaces) (+workspace-exists-p +mu4e-workspace-name))
(+workspace/delete +mu4e-workspace-name)) (+workspace/kill +mu4e-workspace-name))
(+mu4e--old-wconf (+mu4e--old-wconf
(set-window-configuration +mu4e--old-wconf) (set-window-configuration +mu4e--old-wconf)

View file

@ -32,7 +32,7 @@
;; (+popup/close (get-buffer-window "*notmuch-hello*")) ;; (+popup/close (get-buffer-window "*notmuch-hello*"))
(doom-kill-matching-buffers "^\\*notmuch") (doom-kill-matching-buffers "^\\*notmuch")
(when (modulep! :ui workspaces) (when (modulep! :ui workspaces)
(+workspace/delete +notmuch-workspace-name))) (+workspace/kill +notmuch-workspace-name)))
(defun +notmuch-get-sync-command () (defun +notmuch-get-sync-command ()
"Return a shell command string to synchronize your notmuch mail with." "Return a shell command string to synchronize your notmuch mail with."

View file

@ -86,7 +86,7 @@ in [[../../editor/evil/+commands.el][config/default/+evil-commands.el]]).
| ~+workspace/other~ | [[kbd:][SPC TAB `]] | Switch to last workspace | | ~+workspace/other~ | [[kbd:][SPC TAB `]] | Switch to last workspace |
| ~+workspace/switch-left~ | [[kbd:][SPC TAB []] / [[kbd:][[ w]] / [[kbd:][gT]] | Switch to previous workspace | | ~+workspace/switch-left~ | [[kbd:][SPC TAB []] / [[kbd:][[ w]] / [[kbd:][gT]] | Switch to previous workspace |
| ~+workspace/switch-right~ | [[kbd:][SPC TAB ]]] / [[kbd:][] w]] / [[kbd:][gt]] | Switch to next workspace | | ~+workspace/switch-right~ | [[kbd:][SPC TAB ]]] / [[kbd:][] w]] / [[kbd:][gt]] | Switch to next workspace |
| ~+workspace/delete~ | [[kbd:][SPC TAB d]] | Delete the current workspace | | ~+workspace/kill~ | [[kbd:][SPC TAB d]] | Delete the current workspace |
| ~+workspace/kill-session~ | [[kbd:][SPC TAB x]] / [[kbd:][:sclear]] | Clears the current session (kills all windows and buffers) | | ~+workspace/kill-session~ | [[kbd:][SPC TAB x]] / [[kbd:][:sclear]] | Clears the current session (kills all windows and buffers) |
* TODO Configuration * TODO Configuration
@ -120,6 +120,6 @@ in [[../../editor/evil/+commands.el][config/default/+evil-commands.el]]).
+ ~+workspace-save-session NAME~ + ~+workspace-save-session NAME~
+ ~+workspace-new NAME~ + ~+workspace-new NAME~
+ ~+workspace-rename NAME NEW-NAME~ + ~+workspace-rename NAME NEW-NAME~
+ ~+workspace-delete NAME &optional INHIBIT-KILL-P~ + ~+workspace-kill NAME &optional INHIBIT-KILL-P~
+ ~+workspace-switch NAME &optional AUTO-CREATE-P~ + ~+workspace-switch NAME &optional AUTO-CREATE-P~
+ ~+workspace-protected-p NAME~ -> bool + ~+workspace-protected-p NAME~ -> bool

View file

@ -23,8 +23,8 @@
;;;###autoload (autoload '+workspace:delete "ui/workspaces/autoload/evil" nil t) ;;;###autoload (autoload '+workspace:delete "ui/workspaces/autoload/evil" nil t)
(evil-define-command +workspace:delete () (evil-define-command +workspace:delete ()
"Ex wrapper around `+workspace/delete'." "Ex wrapper around `+workspace/kill'."
(interactive) (+workspace/delete (+workspace-current-name))) (interactive) (+workspace/kill (+workspace-current-name)))
;;;###autoload (autoload '+workspace:switch-next "ui/workspaces/autoload/evil" nil t) ;;;###autoload (autoload '+workspace:switch-next "ui/workspaces/autoload/evil" nil t)
(evil-define-command +workspace:switch-next (&optional count) (evil-define-command +workspace:switch-next (&optional count)

View file

@ -150,10 +150,10 @@ success, nil otherwise."
(persp-rename new-name (+workspace-get name))) (persp-rename new-name (+workspace-get name)))
;;;###autoload ;;;###autoload
(defun +workspace-delete (workspace &optional inhibit-kill-p) (defun +workspace-kill (workspace &optional inhibit-kill-p)
"Delete the workspace denoted by WORKSPACE, which can be the name of a perspective "Kill the workspace denoted by WORKSPACE, which can be the name of a
or its hash table. If INHIBIT-KILL-P is non-nil, don't kill this workspace's perspective or its hash table. If INHIBIT-KILL-P is non-nil, don't kill this
buffers." workspace's buffers."
(unless (stringp workspace) (unless (stringp workspace)
(setq workspace (persp-name workspace))) (setq workspace (persp-name workspace)))
(when (+workspace--protected-p workspace) (when (+workspace--protected-p workspace)
@ -231,14 +231,14 @@ workspace."
('error (+workspace-error ex t)))) ('error (+workspace-error ex t))))
;;;###autoload ;;;###autoload
(defun +workspace/delete (name) (defun +workspace/kill (name)
"Delete this workspace. If called with C-u, prompts you for the name of the "Delete this workspace. If called with C-u, prompts you for the name of the
workspace to delete." workspace to delete."
(interactive (interactive
(let ((current-name (+workspace-current-name))) (let ((current-name (+workspace-current-name)))
(list (list
(if current-prefix-arg (if current-prefix-arg
(completing-read (format "Delete workspace (default: %s): " current-name) (completing-read (format "Kill workspace (default: %s): " current-name)
(+workspace-list-names) (+workspace-list-names)
nil nil nil nil current-name) nil nil nil nil current-name)
current-name)))) current-name))))
@ -250,9 +250,9 @@ workspace to delete."
(cond ((delq (selected-frame) (persp-frames-with-persp (get-frame-persp))) (cond ((delq (selected-frame) (persp-frames-with-persp (get-frame-persp)))
(user-error "Can't close workspace, it's visible in another frame")) (user-error "Can't close workspace, it's visible in another frame"))
((not (equal (+workspace-current-name) name)) ((not (equal (+workspace-current-name) name))
(+workspace-delete name)) (+workspace-kill name))
((cdr workspaces) ((cdr workspaces)
(+workspace-delete name) (+workspace-kill name)
(+workspace-switch (+workspace-switch
(if (+workspace-exists-p +workspace--last) (if (+workspace-exists-p +workspace--last)
+workspace--last +workspace--last
@ -262,7 +262,7 @@ workspace to delete."
(t (t
(+workspace-switch +workspaces-main t) (+workspace-switch +workspaces-main t)
(unless (string= (car workspaces) +workspaces-main) (unless (string= (car workspaces) +workspaces-main)
(+workspace-delete name)) (+workspace-kill name))
(doom/kill-all-buffers (doom-buffer-list)))) (doom/kill-all-buffers (doom-buffer-list))))
(+workspace-message (format "Deleted '%s' workspace" name) 'success))) (+workspace-message (format "Deleted '%s' workspace" name) 'success)))
('error (+workspace-error ex t)))) ('error (+workspace-error ex t))))
@ -275,7 +275,7 @@ workspace to delete."
(persps (length (+workspace-list-names))) (persps (length (+workspace-list-names)))
(buffers 0)) (buffers 0))
(let ((persp-autokill-buffer-on-remove t)) (let ((persp-autokill-buffer-on-remove t))
(unless (cl-every #'+workspace-delete (+workspace-list-names)) (unless (cl-every #'+workspace-kill (+workspace-list-names))
(+workspace-error "Could not clear session"))) (+workspace-error "Could not clear session")))
(+workspace-switch +workspaces-main t) (+workspace-switch +workspaces-main t)
(setq buffers (doom/kill-all-buffers (buffer-list))) (setq buffers (doom/kill-all-buffers (buffer-list)))
@ -401,7 +401,7 @@ the next."
(let ((frame-persp (frame-parameter nil 'workspace))) (let ((frame-persp (frame-parameter nil 'workspace)))
(if (string= frame-persp (+workspace-current-name)) (if (string= frame-persp (+workspace-current-name))
(delete-frame) (delete-frame)
(+workspace/delete current-persp-name)))) (+workspace/kill current-persp-name))))
((+workspace-error "Can't delete last workspace" t))))))) ((+workspace-error "Can't delete last workspace" t)))))))
@ -490,7 +490,7 @@ created."
(setq frame (selected-frame))) (setq frame (selected-frame)))
(let ((frame-persp (frame-parameter frame 'workspace))) (let ((frame-persp (frame-parameter frame 'workspace)))
(when (string= frame-persp (+workspace-current-name)) (when (string= frame-persp (+workspace-current-name))
(+workspace/delete frame-persp))))) (+workspace/kill frame-persp)))))
;;;###autoload ;;;###autoload
(defun +workspaces-associate-frame-fn (frame &optional _new-frame-p) (defun +workspaces-associate-frame-fn (frame &optional _new-frame-p)