[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master d68099d 7/9: multishell - Suppress trivial duplicates in c
From: |
ken manheimer |
Subject: |
[elpa] master d68099d 7/9: multishell - Suppress trivial duplicates in completions list presentation. |
Date: |
Fri, 12 Feb 2016 09:23:43 +0000 |
branch: master
commit d68099dadbc82e6cbd604f717620b1b305372830
Author: Ken Manheimer <address@hidden>
Commit: Ken Manheimer <address@hidden>
multishell - Suppress trivial duplicates in completions list presentation.
The duplicates are useful in minibuffer, distinguishing active shells,
but not useful in multishell listing, where active shells are sorted
early and with "+" signs before them.
---
multishell-list.el | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/multishell-list.el b/multishell-list.el
index d2765dd..8d1cb42 100644
--- a/multishell-list.el
+++ b/multishell-list.el
@@ -247,6 +247,22 @@ Initial sort is from most to least recently used:
tabulated-list-entries #'multishell-list-entries)
(tabulated-list-init-header))
+(defun multishell-list-cull-dups (entries)
+ "Return list of multishell ENTRIES sans ones with duplicate names.
+
+For duplicates, we prefer the ones that have paths."
+ (let ((tally (make-hash-table :test #'equal))
+ got name already)
+ (mapcar #'(lambda (entry)
+ (setq name (multishell-name-from-entry entry)
+ already (gethash name tally nil))
+ (when (or (not already) (< (length already) (length entry)))
+ ;; Add new or replace shorter prior entry for name:
+ (puthash name entry tally)))
+ entries)
+ (maphash #'(lambda (key value) (push value got)) tally)
+ got))
+
;;;###autoload
(defun multishell-list (&optional completing)
"Edit your current and historic list of shell buffers.
@@ -278,13 +294,11 @@ You can get to the shells listing by recursively invoking
(progv
;; Temporarily assign multishell-history only when completing:
(when completing '(multishell-history))
- (when completing (list (mapcar 'substring-no-properties completing)))
+ (when completing
+ (list (multishell-list-cull-dups (mapcar 'substring-no-properties
+ completing))))
(tabulated-list-print))
(when completing
- ;; XXX Do proper completion prep.
- ;; - looks like stuff in minibuffer.el.gz is too hairy w/too little gain.
- ;; - Add a buffer-change hook that throws a 'multishell-completion-done,
- ;; and revise the catch in multishell-pop-to-shell
)
(when from-entry
(multishell-list-goto-item-by-entry from-entry))))
- [elpa] master updated (1abce8e -> b19288e), ken manheimer, 2016/02/12
- [elpa] master 378b866 1/9: Rough stab at using tabulated-list-mode for minibuffer-completion-help, ken manheimer, 2016/02/12
- [elpa] master 996d534 2/9: multishell - roughly working draft using multishell-list for completions, ken manheimer, 2016/02/12
- [elpa] master 4802f57 3/9: Clarify scheme for using multishell-list for completions help buffer., ken manheimer, 2016/02/12
- [elpa] master fd514d3 4/9: multishell - method to conclude minibuffer interaction from multishell-list, ken manheimer, 2016/02/12
- [elpa] master 7b66048 5/9: multishell - Use better names for completing read and dispatch provisions., ken manheimer, 2016/02/12
- [elpa] master 1220cdc 6/9: multishell - Be more specific about why we use tramp-cleanup-connection., ken manheimer, 2016/02/12
- [elpa] master d68099d 7/9: multishell - Suppress trivial duplicates in completions list presentation.,
ken manheimer <=
- [elpa] master f245821 8/9: multishell - 1.1.4, resolves several TODO items., ken manheimer, 2016/02/12
- [elpa] master b19288e 9/9: Merge commit 'f2458211bc25749f07e0d70addde7c7745dcc79d', ken manheimer, 2016/02/12