emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 378b866 1/9: Rough stab at using tabulated-list-mode for m


From: ken manheimer
Subject: [elpa] master 378b866 1/9: Rough stab at using tabulated-list-mode for minibuffer-completion-help
Date: Fri, 12 Feb 2016 09:20:57 +0000

branch: master
commit 378b866d860092bef7c75153bd6150612131a817
Author: Ken Manheimer <address@hidden>
Commit: Ken Manheimer <address@hidden>

    Rough stab at using tabulated-list-mode for minibuffer-completion-help
    
    A few big problems with what's implemented here:
    
    - looks like tabulated-list-mode is incongruous with temp display
      operation.
    - using flet is no good - it's deprecated - but cl-flet lexical scoping
      doesn't have needed effect.
---
 multishell.el |   56 +++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 45 insertions(+), 11 deletions(-)

diff --git a/multishell.el b/multishell.el
index 8d19a05..8e19029 100644
--- a/multishell.el
+++ b/multishell.el
@@ -603,6 +603,36 @@ completions."
         (append multishell-history active-names)
       multishell-history)))
 
+(defvar multishell-local-must-match-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map minibuffer-local-must-match-map)
+    (define-key map (kbd "?") 'multishell-minibuffer-completion-help)
+    (define-key map (kbd " ") 'multishell-minibuffer-complete-word)
+    (define-key map [tab] 'multishell-read-minibuffer-complete)
+    map))
+
+(defun multishell-minibuffer-completion-help (&optional start end)
+  "Multishell version of `minibuffer-completion-help'."
+  (interactive)
+  ;; Call all-completions on minibuffer-completion-table and
+  ;; minibuffer-completion-predicate
+  ;; Display using (with-output-to-temp-buffer "*Completions*"
+  ;; ... <multishell-list stuff>)
+  (minibuffer-completion-help start end))
+(defun multishell-minibuffer-complete-word ()
+  "Multishell version of `minibuffer-completion-help'."
+  (interactive)
+  (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)))
+
 (defun multishell-read-unbracketed-entry (prompt &optional initial no-record)
   "PROMPT for shell buffer name, sans asterisks.
 
@@ -616,17 +646,21 @@ 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))
-         (got (completing-read prompt
-                               ;; COLLECTION:
-                               (reverse candidates)
-                               ;; PREDICATE:
-                               nil
-                               ;; REQUIRE-MATCH:
-                               'confirm
-                               ;; INITIAL-INPUT
-                               initial
-                               ;; HIST:
-                               'multishell-history)))
+;;         (minibuffer-local-must-match-map multishell-local-must-match-map)
+         (got (flet ((display-completion-list
+                      (completions)
+                      (multishell-display-completion-list completions)))
+                (completing-read prompt
+                                 ;; COLLECTION:
+                                 (reverse candidates)
+                                 ;; PREDICATE:
+                                 nil
+                                 ;; REQUIRE-MATCH:
+                                 'confirm
+                                 ;; INITIAL-INPUT
+                                 initial
+                                 ;; HIST:
+                                 'multishell-history))))
     (when no-record
       (setq multishell-history was-multishell-history))
     (if (not (string= got ""))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]