This commit changes some of the interactive functions to first look if
the desktop list is being shown and, if so, if there is a desktop
specified under the cursor. If either of these conditions is not true,
they fall back to asking the user for a name, as before.
- desktop-registry.el (desktop-registry-add-directory): Add an optional
NAME parameter which will be asked for (in an interactive context)
when the universal argument is used. Print a message if the specified
directory has already been registered, signal an error when the (given
or generated) name has already been used and only add the directory if
neither of these conditions occur.
(desktop-registry-add-current-desktop): Add optional NAME parameter
which will be asked for (in an interactive context) when the universal
argument is used and pass it on to `desktop-registry-add-directory'.
When asking the user for a desktop it is now easy to specify that the
default should be the current desktop.
- desktop-registry.el (desktop-registry-current-desktop): Add optional
DEFAULT parameter which specifies the return value when
`desktop-dirname' is `nil', instead of previously an empty string.
(desktop-registry--completing-read): Add optional DEFAULT-CURRENT
parameter which specifies that the current desktop should be the
default when asking for a desktop.
(desktop-registry-remove-desktop): (desktop-registry-rename-desktop):
Use the current desktop as default when asking the user to select a
desktop.
* desktop-registry.el (desktop-registry--canonicalize-dir):
(desktop-registry-current-desktop): New functions.
(desktop-registry-add-directory): Use
`desktop-registry--canonicalize-dir' to get the "clean" directory
name.
- desktop-registry.el (desktop-registry--completing-read):
(desktop-registry-remove-desktop): New functions.
(desktop-registry-change-desktop): Use
`desktop-registry--completing-read' to interactively ask the user
which desktop to switch to.