+ (multishell-list-goto-item-by-entry revised))))
+
+(defun multishell-list-clone-entry (&optional arg)
+ "Create a new list entry, edited from the current one, ready to launch.
+
+If you provide an optional `universal-argument', the new entry
+will be launched when it's created.
+
+The already existing original 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)
+ (multishell-list-goto-item-by-entry new)
+ (when arg
+ (multishell-list-dispatch-selected new-name t)))))
+
+(defun multishell-list-mouse-select (event)
+ "Select the shell whose line is clicked."
+ (interactive "e")
+ (select-window (posn-window (event-end event)))
+ (let ((entry (tabulated-list-get-id (posn-point (event-end event)))))
+ (multishell-list-dispatch-selected entry nil)))
+
+(defun multishell-list-dispatch-selected (entry pop &optional set-primary)
+ "Go to multishell ENTRY, popping to window if POP is non-nil.
+
+Optional arg SET-PRIMARY non-nil sets `multishell-primary-name' to entry.
+
+Provide for concluding minibuffer interaction if we're in completing mode."
+ (let ((set-primary-as-arg (and set-primary '(16))))
+ (if multishell-completing-read
+ ;; In multishell completing-read, arrange to conclude minibuffer input:
+ (throw 'multishell-minibuffer-exit (list entry pop set-primary-as-arg))
+ (multishell-pop-to-shell set-primary-as-arg entry (not pop)))))