diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..b9ba2f2 --- /dev/null +++ b/NEWS @@ -0,0 +1,7 @@ +# -*- mode: org; -*- +#+STARTUP: showall + +* Development + + - Add =desktop-registry-remove-desktop= command to remove desktops you + no longer (want to) use. diff --git a/README.org b/README.org index 8d31e3e..aefc2b1 100644 --- a/README.org +++ b/README.org @@ -24,3 +24,6 @@ to fix that. To switch between desktops you can use =desktop-registry-change-desktop=, this will prompt (with completion) for the directory you would like to load. + + When you're done with a desktop or want to get rid of a desktop for + another reason you can use =desktop-registry-remove-desktop=. diff --git a/desktop-registry.el b/desktop-registry.el index 6aaef14..c8bc55e 100644 --- a/desktop-registry.el +++ b/desktop-registry.el @@ -63,12 +63,26 @@ (error "No desktop loaded")) (desktop-registry-add-directory desktop-dirname)) +(defun desktop-registry--completing-read () + "Ask the user to pick a desktop directory." + (completing-read "Directory: " desktop-registry-registry nil nil + nil 'desktop-registry--history)) + +;;;###autoload +(defun desktop-registry-remove-desktop (desktop) + "Remove DESKTOP from the desktop registry." + (interactive (list (desktop-registry--completing-read))) + (let ((spec (assoc desktop desktop-registry-registry))) + (if spec + (customize-save-variable + 'desktop-registry-registry + (delete spec desktop-registry-registry)) + (error "Unknown desktop: %s" desktop)))) + ;;;###autoload (defun desktop-registry-change-desktop (name) "Change to the desktop named NAME." - (interactive - (list (completing-read "Directory: " desktop-registry-registry nil nil - nil 'desktop-registry--history))) + (interactive (list (desktop-registry--completing-read))) (desktop-change-dir (cdr (assoc name desktop-registry-registry)))) ;;;###autoload