-(defvar multishell-buffer-name-path-history nil
- "Another multishell-pop-to-shell completion history container,
-including paths.")
+(defvar multishell-names-to-paths nil
+ "Multishell buffer name/path associations.")
+(defun multishell-register-buffer-name (name path)
+ "Associate NAME with PATH in `multishell-names-to-path'.
+
+Remove registration for NAME if PATH is nil (but not the empty string)."
+ (if path
+ (let* ((it (cons name path))
+ (got (member it multishell-buffer-name_path-history)))
+ (if got
+ (setcdr it path)
+ (setq multishell-buffer-name_path-history
+ (cons (cons name path) multishell-buffer-name_path-history))))
+ (let ((it (assoc name multishell-buffer-name_path-history)))
+ (if it
+ (setq multishell-buffer-name_path-history
+ (delete it multishell-buffer-name_path-history))))))