Add desktop-registry-rename-desktop

* desktop-registry.el (desktop-registry-rename-desktop): New function.
This commit is contained in:
Tom Willemse 2013-08-07 15:10:08 +02:00
parent 395277047e
commit 2fffd8cc37
3 changed files with 18 additions and 0 deletions

2
NEWS
View file

@ -8,3 +8,5 @@
- Add =desktop-registry-current-desktop= function to get the name of - Add =desktop-registry-current-desktop= function to get the name of
the currently loaded desktop. the currently loaded desktop.
- Add =desktop-registry-rename-desktop= command to rename a desktop.

View file

@ -28,6 +28,10 @@ to fix that.
When you're done with a desktop or want to get rid of a desktop for 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=. another reason you can use =desktop-registry-remove-desktop=.
If you've registered a desktop and you don't like what it made of
the name you can use =desktop-registry-rename-desktop= to give it a
new name.
** With org-capture-templates ** With org-capture-templates
The =desktop-registry-current-desktop= can be used to insert the The =desktop-registry-current-desktop= can be used to insert the

View file

@ -95,6 +95,18 @@ Returns an empty string when `desktop-dirname' is nil."
(delete spec desktop-registry-registry)) (delete spec desktop-registry-registry))
(error "Unknown desktop: %s" desktop)))) (error "Unknown desktop: %s" desktop))))
;;;###autoload
(defun desktop-registry-rename-desktop (old new)
"Rename DESKTOP."
(interactive (list (desktop-registry--completing-read)
(read-string "to: ")))
(let ((spec (assoc old desktop-registry-registry)))
(if (not spec)
(error "Unknown desktop: %s" old)
(setf (car spec) new)
(customize-save-variable 'desktop-registry-registry
desktop-registry-registry))))
;;;###autoload ;;;###autoload
(defun desktop-registry-change-desktop (name) (defun desktop-registry-change-desktop (name)
"Change to the desktop named NAME." "Change to the desktop named NAME."