]> code.delx.au - gnu-emacs-elpa/commitdiff
Clarify scheme for using multishell-list for completions help buffer.
authorKen Manheimer <ken.manheimer@gmail.com>
Wed, 10 Feb 2016 07:49:17 +0000 (02:49 -0500)
committerKen Manheimer <ken.manheimer@gmail.com>
Wed, 10 Feb 2016 07:49:17 +0000 (02:49 -0500)
1.1.4

- Use a custom version of display-completion-list
  - Via institution via  cl-letf.
- Remove now unnecessary keybindings
-

multishell-list.el
multishell.el

index 6b8680c8cc41a521301203794fbb117ecd0c49ec..496682080d575d304b510695d11299baa836fad5 100644 (file)
@@ -158,8 +158,8 @@ 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 (or rest "") 'localname)
-                                rest))
+                       (dir (and rest (or (file-remote-p rest 'localname)
+                                          rest)))
                        (hops (and dir
                                   (file-remote-p rest 'localname)
                                   (substring
@@ -239,11 +239,15 @@ Initial sort is from most to least recently used:
 (defun multishell-list (&optional buffer-name)
   "Edit your current and historic list of shell buffers.
 
-Hit ? for a list of commands.
+Optional BUFFER-NAME specifies buffer to use for list. When a
+buffer is specified, we do not select the buffer, just fill
+it. Otherwise, we pop to the *Shells* buffer.
 
-You can get to this shell listing manager by
-recursively invoking \\[multishell-pop-to-shell] at either of the
-`multishell-pop-to-shell' universal argument prompts."
+In the buffer, hit ? or h for a list of commands.
+
+You can get to the shell listing manager by recursively invoking
+\\[multishell-pop-to-shell] at the `multishell-pop-to-shell'
+`universal-argument' prompts."
   (interactive)
   (let ((from-entry (car (multishell-history-entries
                           (multishell-unbracket (buffer-name
@@ -261,4 +265,3 @@ recursively invoking \\[multishell-pop-to-shell] at either of the
 (require 'multishell)
 
 ;;; multishell-list.el ends here
-o
\ No newline at end of file
index fe1787450a546b0def6311423eef45d0da1d740c..a0783ee5b07705879ca4ea923756125a1e9b5b22 100644 (file)
@@ -1,9 +1,9 @@
-;;; multishell.el --- facilitate multiple local and remote shell buffers
+;;; multishell.el --- Easily use multiple shell buffers, local and remote.
 
 ;; Copyright (C) 1999-2016 Free Software Foundation, Inc.
 
 ;; Author: Ken Manheimer <ken.manheimer@gmail.com>
-;; Version: 1.1.3
+;; Version: 1.1.4
 ;; Created: 1999 -- first public availability
 ;; Keywords: processes
 ;; URL: https://github.com/kenmanheimer/EmacsMultishell
@@ -59,6 +59,8 @@
 ;;
 ;; Change Log:
 ;;
+;; * 2016-02-10 1.1.4 Ken Manheimer:
+;;   - hookup multishell-list as completion help buffer.
 ;; * 2016-02-09 1.1.3 Ken Manheimer:
 ;;   multishell-list:
 ;;   - add some handy operations, like cloning new entry from existing
@@ -603,32 +605,8 @@ 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)
-  "Present COMPLETIONS using multishell-list for `display-completion-list'.
-
-This currently doesn't work, because `tabulated-list-mode' isn't
-meant for transient buffers."
+  "Present COMPLETIONS using multishell-list for `display-completion-list'."
   (let ((multishell-history (mapcar 'substring-no-properties completions)))
     (multishell-list "*Completions*")))
 
@@ -645,9 +623,12 @@ 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 (flet ((display-completion-list
-                      (completions)
-                      (multishell-display-completion-list completions)))
+         (got (cl-letf
+                  ;; Engage our custom display-completion-list, for
+                  ;; minibuffer-completion-help. `cl-letf' for dynamic
+                  ;; binding; cl-flet's lexical doesn't do what's needed.
+                  (((symbol-function 'display-completion-list)
+                    #'multishell-display-completion-list))
                 (completing-read prompt
                                  ;; COLLECTION:
                                  (reverse candidates)