Commit 246d024d authored by David Byers's avatar David Byers
Browse files

Better completion of LysKOM commands. Now minibuffer completion of

commands works the same way completion with slow commands works.
parent 3d2177cf
2002-06-23 David Byers <david.byers@swipnet.se>
Try to fix bug 429 (sort of):
* command.el (lyskom-command-minibuffer-local-completion-map): New
variable.
(lyskom-command-minibuffer-local-must-match-map): New variable.
(lyskom-read-extended-command): Use new minibuffer maps when
reading command names. Do completion using
lyskom-complete-command.
(lyskom-ok-command): Support vectors from
lyskom-read-extended-command as inputs.
2002-06-22 David Byers <david.byers@swipnet.se> 2002-06-22 David Byers <david.byers@swipnet.se>
* doc/NEWS-0.47: Uppdaterad till denna punkt i ChangeLog infr
release av 0.47-BETA-3 ngon gng snart.
* startup.el (lyskom): Renamed all proxy-* variables to * startup.el (lyskom): Renamed all proxy-* variables to
www-proxy-*. Changed open-network-stream to www-proxy-*. Changed open-network-stream to
lyskom-open-network-stream in order to support ssh proxies. lyskom-open-network-stream in order to support ssh proxies.
......
...@@ -189,6 +189,8 @@ ...@@ -189,6 +189,8 @@
(defun lyskom-ok-command (alternative administrator) (defun lyskom-ok-command (alternative administrator)
"Returns non-nil if it is ok to do such a command right now." "Returns non-nil if it is ok to do such a command right now."
(when (vectorp alternative)
(setq alternative (cons (elt alternative 0) (elt alternative 1))))
(if administrator (if administrator
(not (memq (cdr alternative) lyskom-admin-removed-commands)) (not (memq (cdr alternative) lyskom-admin-removed-commands))
(not (memq (cdr alternative) lyskom-noadmin-removed-commands)))) (not (memq (cdr alternative) lyskom-noadmin-removed-commands))))
...@@ -201,6 +203,22 @@ ...@@ -201,6 +203,22 @@
(fnc (call-interactively fnc)) (fnc (call-interactively fnc))
(t (kom-next-command)))) ) (t (kom-next-command)))) )
(defvar lyskom-command-minibuffer-local-completion-map
(let ((map (copy-keymap minibuffer-local-completion-map)))
(define-key map " " (lookup-key map (kbd "TAB")))
map)
"Keymap used for reading LysKOM names.")
(defvar lyskom-command-minibuffer-local-must-match-map
(let ((map (copy-keymap minibuffer-local-must-match-map)))
(lyskom-xemacs-or-gnu
(progn (set-keymap-parent map lyskom-minibuffer-local-completion-map)
(define-key map " "
(lookup-key lyskom-minibuffer-local-completion-map (kbd "TAB"))))
(define-key map " " (lookup-key map (kbd "TAB"))))
map)
"Keymap used for reading LysKOM names.")
(defun lyskom-read-extended-command (&optional prefix-arg prompt) (defun lyskom-read-extended-command (&optional prefix-arg prompt)
"Reads and returns a command" "Reads and returns a command"
(let* ((completion-ignore-case t) (let* ((completion-ignore-case t)
...@@ -229,18 +247,23 @@ ...@@ -229,18 +247,23 @@
(concat prefix-text base-prompt) (concat prefix-text base-prompt)
base-prompt))) base-prompt)))
(lyskom-with-lyskom-minibuffer (let ((minibuffer-local-completion-map
(setq name (lyskom-completing-read prompt lyskom-command-minibuffer-local-completion-map)
(lyskom-maybe-frob-completion-table (minibuffer-local-must-match-map
alternatives) lyskom-command-minibuffer-local-must-match-map))
;; lyskom-is-administrator is buffer-local and (lyskom-with-lyskom-minibuffer
;; must be evalled before the call to (setq name (lyskom-completing-read prompt
;; completing-read 'lyskom-complete-command
;; Yes, this is not beautiful ; (lyskom-maybe-frob-completion-table
(list 'lambda '(alternative) ; alternatives)
(list 'lyskom-ok-command 'alternative ;; lyskom-is-administrator is buffer-local and
lyskom-is-administrator)) ;; must be evalled before the call to
t nil 'lyskom-command-history))) ;; completing-read
;; Yes, this is not beautiful
(list 'lambda '(alternative)
(list 'lyskom-ok-command 'alternative
lyskom-is-administrator))
t nil 'lyskom-command-history))))
(cdr (lyskom-string-assoc name alternatives)))) (cdr (lyskom-string-assoc name alternatives))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment