+(defun multishell-list-clone-entry (&optional arg)
+ "Create a new list entry based on editing the current one.
+
+You will be left in the list at the entry, not yet launched.
+
+Providing a universal argument will also open the new shell.
+
+The already existing current entry is left untouched."
+ (interactive "P")
+ (let* ((prototype (tabulated-list-get-id))
+ (name (multishell-name-from-entry prototype))
+ (new (multishell-read-unbracketed-entry
+ (format "Clone new shell spec from %s: " name)
+ prototype
+ 'no-record))
+ (new-name (multishell-name-from-entry new))
+ (new-path (cadr (multishell-split-entry new))))
+ (when (not (string= new prototype))
+ (multishell-register-name-to-path new-name new-path)
+ (revert-buffer)
+ (goto-char (point-min))
+ (re-search-forward (format "^ . \\b%s\\b"
+ (regexp-quote new-name)))
+ (beginning-of-line))))
+