Commit 06145c59 authored by Joel Rosdahl's avatar Joel Rosdahl

Revived the minibuffer completion code from 0.46-BETA-P.

parent 5ff0ea96
2000-11-18 Joel Rosdahl <joel@rosdahl.net>
* command.el (lyskom-read-extended-command): Revived the
minibuffer completion code from 0.46-BETA-P.
(lyskom-ok-command): Ditto.
2000-11-18 Per Starbck (commit by Per Cederqvist <ceder@moria>)
* commands2.el (kom-status-person): Use mod instead of %, since
......
......@@ -36,7 +36,7 @@
# makefile too!
#
CLIENTVERSION = 0.46.1-BETA-2
CLIENTVERSION = 0.46.1-BETA-3
DOCFILES=NEWS-0.46 NEWS-0.46.1
DEBIANCLIENTVERSION = $(shell echo $(CLIENTVERSION) | tr - .)
......
......@@ -190,8 +190,8 @@
(defun lyskom-ok-command (alternative administrator)
"Returns non-nil if it is ok to do such a command right now."
(if administrator
(not (memq (elt alternative 1) lyskom-admin-removed-commands))
(not (memq (elt alternative 1) lyskom-noadmin-removed-commands))))
(not (memq (cdr alternative) lyskom-admin-removed-commands))
(not (memq (cdr alternative) lyskom-noadmin-removed-commands))))
(defun kom-extended-command ()
"Read a LysKOM function name and call the function."
......@@ -201,21 +201,18 @@
(fnc (call-interactively fnc))
(t (kom-next-command)))) )
(defvar lyskom-command-completion-map nil)
(if lyskom-command-completion-map
nil
(setq lyskom-command-completion-map (make-sparse-keymap))
(define-key lyskom-command-completion-map (kbd "SPC")
'lyskom-command-complete-word))
(defvar last-exact-completion)
(defun lyskom-read-extended-command (&optional prefix-arg)
"Reads and returns a command"
(let* ((completion-ignore-case t)
(minibuffer-setup-hook minibuffer-setup-hook)
(alternatives (mapcar
(lambda (pair)
(cons
(cdr pair)
(car pair)))
(lyskom-get-strings lyskom-commands
'lyskom-command)))
(name nil)
(last-exact-completion nil)
(prefix-text
(cond ((eq prefix-arg '-) "- ")
((equal prefix-arg '(4)) "C-u ")
......@@ -230,22 +227,18 @@
(lyskom-get-string 'extended-command))))
(lyskom-with-lyskom-minibuffer
(set-keymap-parent lyskom-command-completion-map
minibuffer-local-must-match-map)
(let ((minibuffer-completion-table 'lyskom-complete-command)
(minibuffer-completion-predicate (lambda (alt)
(lyskom-ok-command alt
lyskom-is-administrator)))
(minibuffer-completion-confirm nil))
(setq name (lyskom-read-from-minibuffer prompt
nil
lyskom-command-completion-map
nil
'lyskom-command-history
t)))
(lyskom-lookup-command-by-name name (lambda (alt)
(lyskom-ok-command
alt lyskom-is-administrator))))))
(setq name (lyskom-completing-read prompt
(lyskom-maybe-frob-completion-table
alternatives)
;; lyskom-is-administrator is buffer-local and
;; must be evalled before the call to
;; 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))))
(defun lyskom-update-command-completion ()
......
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