parent
450eed7268
commit
5eeb362610
2 changed files with 11 additions and 7 deletions
|
@ -68,13 +68,14 @@ error if NAME doesn't exist."
|
||||||
"Return a list of workspace structs (satisifes `+workspace-p')."
|
"Return a list of workspace structs (satisifes `+workspace-p')."
|
||||||
;; We don't use `hash-table-values' because it doesn't ensure order in older
|
;; We don't use `hash-table-values' because it doesn't ensure order in older
|
||||||
;; versions of Emacs
|
;; versions of Emacs
|
||||||
(cdr (cl-loop for persp being the hash-values of *persp-hash*
|
(cl-loop for name in persp-names-cache
|
||||||
collect persp)))
|
if (gethash name *persp-hash*)
|
||||||
|
collect it))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +workspace-list-names ()
|
(defun +workspace-list-names ()
|
||||||
"Return the list of names of open workspaces."
|
"Return the list of names of open workspaces."
|
||||||
(mapcar #'safe-persp-name (+workspace-list)))
|
persp-names-cache)
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +workspace-buffer-list (&optional persp)
|
(defun +workspace-buffer-list (&optional persp)
|
||||||
|
|
|
@ -76,10 +76,13 @@ stored in `persp-save-dir'.")
|
||||||
"Ensure a main workspace exists."
|
"Ensure a main workspace exists."
|
||||||
(when persp-mode
|
(when persp-mode
|
||||||
(let (persp-before-switch-functions)
|
(let (persp-before-switch-functions)
|
||||||
;; The default perspective persp-mode creates (`persp-nil-name') is
|
;; The default perspective persp-mode creates is special and doesn't
|
||||||
;; special and doesn't represent a real persp object, so buffers can't
|
;; represent a real persp object, so buffers can't really be assigned
|
||||||
;; really be assigned to it, among other quirks. We create a *real* main
|
;; to it, among other quirks. We hide the nil persp...
|
||||||
;; workspace to fill this role.
|
(when (equal (car persp-names-cache) persp-nil-name)
|
||||||
|
(pop persp-names-cache))
|
||||||
|
;; ...and create a *real* main workspace to fill this role, and hide
|
||||||
|
;; the nil perspective.
|
||||||
(unless (or (persp-get-by-name +workspaces-main)
|
(unless (or (persp-get-by-name +workspaces-main)
|
||||||
;; Start from 2 b/c persp-mode counts the nil workspace
|
;; Start from 2 b/c persp-mode counts the nil workspace
|
||||||
(> (hash-table-count *persp-hash*) 2))
|
(> (hash-table-count *persp-hash*) 2))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue