From 4802f5736fd0ccd3db8ffc4627bb84756a8a2c2b Mon Sep 17 00:00:00 2001 From: Ken Manheimer Date: Wed, 10 Feb 2016 02:49:17 -0500 Subject: [PATCH] Clarify scheme for using multishell-list for completions help buffer. 1.1.4 - Use a custom version of display-completion-list - Via institution via cl-letf. - Remove now unnecessary keybindings - --- multishell-list.el | 17 ++++++++++------- multishell.el | 41 +++++++++++------------------------------ 2 files changed, 21 insertions(+), 37 deletions(-) diff --git a/multishell-list.el b/multishell-list.el index 6b8680c8c..496682080 100644 --- a/multishell-list.el +++ b/multishell-list.el @@ -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 diff --git a/multishell.el b/multishell.el index fe1787450..a0783ee5b 100644 --- a/multishell.el +++ b/multishell.el @@ -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 -;; 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*" - ;; ... ) - (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) -- 2.39.2