From: Ken Manheimer Date: Tue, 9 Feb 2016 18:52:25 +0000 (-0500) Subject: multishell - roughly working draft using multishell-list for completions X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/996d5347c80289d6eb97a7fc620b40e2724b14cc multishell - roughly working draft using multishell-list for completions Workable, need to resolve pending issues: - depends on flet - what do i need to do about that? - adaptation of multishell-list to purpose needs doc update, maybe rethink - likewise hacking of multishell-list-entries - inhibit duplicates from organized listing, preferring detailed one - get mouse click so it ~properly concludes minibuffer activity --- diff --git a/multishell-list.el b/multishell-list.el index 69299f272..6b8680c8c 100644 --- a/multishell-list.el +++ b/multishell-list.el @@ -158,9 +158,10 @@ The already existing original entry is left untouched." multishell-list-active-flag) (t multishell-list-inactive-flag))) (rest (cadr splat)) - (dir (or (file-remote-p rest 'localname) + (dir (or (file-remote-p (or rest "") 'localname) rest)) - (hops (and (file-remote-p rest 'localname) + (hops (and dir + (file-remote-p rest 'localname) (substring rest 0 (- (length rest) (length dir)))))) (when (not name) @@ -235,7 +236,7 @@ Initial sort is from most to least recently used: (tabulated-list-init-header)) ;;;###autoload -(defun multishell-list () +(defun multishell-list (&optional buffer-name) "Edit your current and historic list of shell buffers. Hit ? for a list of commands. @@ -247,8 +248,10 @@ recursively invoking \\[multishell-pop-to-shell] at either of the (let ((from-entry (car (multishell-history-entries (multishell-unbracket (buffer-name (current-buffer)))))) - (buffer (get-buffer-create "*Shells*"))) - (pop-to-buffer buffer) + (buffer (get-buffer-create (or buffer-name "*Shells*")))) + (if buffer-name + (set-buffer buffer) + (pop-to-buffer buffer)) (multishell-list-mode) (tabulated-list-print) (when from-entry @@ -258,3 +261,4 @@ recursively invoking \\[multishell-pop-to-shell] at either of the (require 'multishell) ;;; multishell-list.el ends here +o \ No newline at end of file diff --git a/multishell.el b/multishell.el index 8e1902991..fe1787450 100644 --- a/multishell.el +++ b/multishell.el @@ -625,13 +625,12 @@ completions." (minibuffer-complete-word)) (defun multishell-display-completion-list (completions) - (let* ((completions-extracted - (mapcar #'(lambda (text) - (set-text-properties 0 (length text) nil text) - text) - completions)) - (multishell-history completions-extracted)) - (multishell-list-mode))) + "Present COMPLETIONS using multishell-list for `display-completion-list'. + +This currently doesn't work, because `tabulated-list-mode' isn't +meant for transient buffers." + (let ((multishell-history (mapcar 'substring-no-properties completions))) + (multishell-list "*Completions*"))) (defun multishell-read-unbracketed-entry (prompt &optional initial no-record) "PROMPT for shell buffer name, sans asterisks. @@ -646,7 +645,6 @@ Input and completion can include associated path, if any. Return what's provided, if anything, else nil." (let* ((was-multishell-history multishell-history) (candidates (multishell-all-entries 'active-duplicated)) -;; (minibuffer-local-must-match-map multishell-local-must-match-map) (got (flet ((display-completion-list (completions) (multishell-display-completion-list completions)))