From 2fffd8cc37ac7f506b0add172221a4b86fdc1332 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 7 Aug 2013 15:10:08 +0200 Subject: [PATCH] Add desktop-registry-rename-desktop * desktop-registry.el (desktop-registry-rename-desktop): New function. --- NEWS | 2 ++ README.org | 4 ++++ desktop-registry.el | 12 ++++++++++++ 3 files changed, 18 insertions(+) diff --git a/NEWS b/NEWS index 18a8ce4..7053a7f 100644 --- a/NEWS +++ b/NEWS @@ -8,3 +8,5 @@ - Add =desktop-registry-current-desktop= function to get the name of the currently loaded desktop. + + - Add =desktop-registry-rename-desktop= command to rename a desktop. diff --git a/README.org b/README.org index bb2ac62..04b7a78 100644 --- a/README.org +++ b/README.org @@ -28,6 +28,10 @@ to fix that. 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=. + 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 The =desktop-registry-current-desktop= can be used to insert the diff --git a/desktop-registry.el b/desktop-registry.el index 71c8b4b..c4393b2 100644 --- a/desktop-registry.el +++ b/desktop-registry.el @@ -95,6 +95,18 @@ Returns an empty string when `desktop-dirname' is nil." (delete spec desktop-registry-registry)) (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 (defun desktop-registry-change-desktop (name) "Change to the desktop named NAME."