mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
refactor(ibuffer): +ibuffer/visit-workspace-buffer
This commit is contained in:
@ -18,18 +18,17 @@
|
||||
"Visit buffer, but switch to its workspace if it exists."
|
||||
(interactive "P")
|
||||
(let ((buf (ibuffer-current-buffer t)))
|
||||
(if (not (buffer-live-p buf))
|
||||
(user-error "Not a valid or live buffer: %s" buf)
|
||||
(when-let (workspaces
|
||||
(unless (buffer-live-p buf)
|
||||
(user-error "Not a valid or live buffer: %s" buf))
|
||||
(if-let (workspaces
|
||||
(cl-loop for wk in (+workspace-list)
|
||||
if (+workspace-contains-buffer-p buf wk)
|
||||
collect wk))
|
||||
(+workspace-switch
|
||||
(persp-name
|
||||
(if (and (not select-first) (cdr workspaces))
|
||||
(+workspace-get
|
||||
(or (completing-read "Select workspace: " (mapcar #'persp-name workspaces))
|
||||
(user-error "Aborted")))
|
||||
(car workspaces)))))
|
||||
(persp-add-buffer buf) ; then add the buffer to the current workspace
|
||||
(switch-to-buffer buf))))
|
||||
(user-error "Aborted"))
|
||||
(persp-name (car workspaces))))
|
||||
;; Or add the buffer to the current workspace
|
||||
(persp-add-buffer buf))
|
||||
(switch-to-buffer buf)))
|
||||
|
Reference in New Issue
Block a user