current-prefix-arg
(liece-channel-virtual
(if (eq liece-command-buffer-mode 'chat)
- (liece-minibuffer-completing-default-read
+ (liece-minibuffer-completing-read
(_ "Start private conversation with: ")
- liece-nick-alist
- nil nil liece-privmsg-partner)
- (liece-minibuffer-completing-default-read
+ liece-nick-alist nil nil nil nil liece-privmsg-partner)
+ (liece-minibuffer-completing-read
(_ "Join channel: ")
(append liece-channel-alist liece-nick-alist)
- nil nil liece-default-channel-candidate)))))
+ nil nil nil nil liece-default-channel-candidate)))))
(if (and current-prefix-arg
(not (numberp current-prefix-arg)))
(setq key
(setq part-channel-var
(liece-channel-virtual
(if (eq liece-command-buffer-mode 'chat)
- (liece-minibuffer-completing-default-read
+ (liece-minibuffer-completing-read
(_ "End private conversation with: ")
(list-to-alist liece-current-chat-partners)
- nil nil liece-current-chat-partner)
- (liece-minibuffer-completing-default-read
+ nil nil nil nil liece-current-chat-partner)
+ (liece-minibuffer-completing-read
(_ "Part channel: ")
(list-to-alist liece-current-channels)
- nil nil liece-current-channel))))
+ nil nil nil nil liece-current-channel))))
(when current-prefix-arg
(setq part-msg (read-string (_ "Part Message: "))))
(list part-channel-var part-msg)))
(concat nick "!" (liece-nick-get-user-at-host nick)))))
nicks))
ban nick msg)
- (setq ban (liece-minibuffer-completing-default-read
- (_ "Ban pattern: ") uahs nil nil
+ (setq ban (liece-minibuffer-completing-read
+ (_ "Ban pattern: ") uahs nil nil nil nil
(concat nick "!" (liece-nick-get-user-at-host nick))))
(list ban)))
(liece-send "MODE %s :+b %s"
ban nick msg)
(setq nick (completing-read (_ "Kick out nickname: ")
(list-to-alist nicks))
- ban (liece-minibuffer-completing-default-read
- (_ "Ban pattern: ") uahs nil nil
+ ban (liece-minibuffer-completing-read
+ (_ "Ban pattern: ") uahs nil nil nil nil
(concat nick "!" (liece-nick-get-user-at-host nick))))
(if current-prefix-arg
(setq msg (concat " :" (read-string (_ "Kick Message: "))))
(if (eq current-prefix-arg '-)
(list current-prefix-arg))
(let ((completion-ignore-case t) channel)
- (setq channel (liece-minibuffer-completing-default-read
+ (setq channel (liece-minibuffer-completing-read
(_ "LIST channel: ")
- liece-channel-alist nil nil liece-current-channel))
+ liece-channel-alist nil nil nil nil liece-current-channel))
(unless (string-equal "" channel)
(list channel)))))
liece-minibuffer-complete-function prompt)
(if current-prefix-arg
(setq chnl
- (liece-minibuffer-completing-default-read
+ (liece-minibuffer-completing-read
(_ "Channel/User: ")
(append liece-channel-alist liece-nick-alist)
- nil nil liece-current-channel)))
+ nil nil nil nil liece-current-channel)))
(cond
((liece-channel-p (liece-channel-real chnl))
(setq prompt (format
(setq nicks (filter-elements
nick nicks
(not (liece-nick-member nick opers)))
- opers (liece-minibuffer-completing-sequential-read
- (_ "Set Operator for") 0
- (list-to-alist nicks)))
+ opers (liece-minibuffer-completing-read-multiple
+ (_ "Assign operational privilege to: ") (list-to-alist nicks)))
(list opers)))
(let (ops)
(dolist (oper opers)
(interactive
(let ((completion-ignore-case t)
(opers (liece-channel-get-operators)) oper nicks)
- (setq nicks (liece-minibuffer-completing-sequential-read
- (_ "Unset Operator for") 0
- (list-to-alist opers)))
+ (setq nicks (liece-minibuffer-completing-read-multiple
+ (_ "Divest operational privilege from: ") (list-to-alist opers)))
(list nicks)))
(let (ops)
(dolist (oper opers)
(count 0))
(setq nicks (filter-elements nick nicks
(not (string-assoc-ignore-case nick voices)))
- voices (liece-minibuffer-completing-sequential-read
- (_ "Set Voice for") 0 (list-to-alist nicks)))
+ voices (liece-minibuffer-completing-read-multiple
+ (_ "Allow to speak: ") (list-to-alist nicks)))
(list voices)))
(let (vcs)
(dolist (voice voices)
(interactive
(let ((completion-ignore-case t)
(voices (liece-channel-get-voices)) voice nicks)
- (setq nicks (liece-minibuffer-completing-sequential-read
- (_ "Unset Voice for") 0 (list-to-alist voices)))
+ (setq nicks (liece-minibuffer-completing-read-multiple
+ (_ "Forbid to speak: ") (list-to-alist voices)))
(list nicks)))
(let (vcs)
(dolist (voice voices)
(let ((completion-ignore-case t) address)
(setq address
(liece-channel-virtual
- (liece-minibuffer-completing-default-read
+ (liece-minibuffer-completing-read
(_ "Private message to: ")
(append liece-nick-alist liece-channel-alist)
- nil nil liece-privmsg-partner)))
+ nil nil nil nil liece-privmsg-partner)))
(list address
(read-string
(format
(let ((completion-ignore-case t))
(setq liece-privmsg-partner
(liece-channel-virtual
- (liece-minibuffer-completing-default-read
+ (liece-minibuffer-completing-read
(_ "To whom: ")
(append liece-nick-alist liece-channel-alist)
- nil nil liece-privmsg-partner)))
+ nil nil nil nil liece-privmsg-partner)))
(list liece-privmsg-partner)))
(let ((message (buffer-substring (progn (beginning-of-line) (point))
(progn (end-of-line) (point)))))
(if (eq current-prefix-arg '-)
(list current-prefix-arg))
(let ((completion-ignore-case t) expr)
- (setq expr (liece-minibuffer-completing-default-read
+ (setq expr (liece-minibuffer-completing-read
(_ "Names on channel: ")
- liece-channel-alist nil nil liece-current-channel))
+ liece-channel-alist nil nil nil nil liece-current-channel))
(unless (string-equal "" expr)
(list expr)))))
(when (or (and (eq expr '-)
(if (eq current-prefix-arg '-)
(list current-prefix-arg))
(let ((completion-ignore-case t) expr)
- (setq expr (liece-minibuffer-completing-default-read
+ (setq expr (completing-read
(_ "WHO expression: ")
(append liece-channel-alist liece-nick-alist)))
(unless (string-equal "" expr)
(if current-prefix-arg
;; prefixed, ask where to continue
(if (eq liece-command-buffer-mode 'chat)
- (liece-minibuffer-completing-default-read
+ (liece-minibuffer-completing-read
(_ "Return to channel: ")
(append liece-channel-alist liece-nick-alist)
- nil nil liece-current-channel)
+ nil nil nil nil liece-current-channel)
(completing-read
(_ "Start private conversation with: ")
liece-nick-alist nil nil))
"IsON users NICKS."
(interactive
(let (nicks (completion-ignore-case t))
- (setq nicks (liece-minibuffer-completing-sequential-read
- "IsON" 0 liece-nick-alist))
+ (setq nicks (liece-minibuffer-completing-read-multiple
+ "IsON" liece-nick-alist))
(list nicks)))
(liece-send "ISON :%s" (mapconcat #'identity nicks " ")))
(interactive
(let (nicks (completion-ignore-case t))
(setq nicks
- (liece-minibuffer-completing-sequential-read
- (_ "Friend") 0
+ (liece-minibuffer-completing-read-multiple
+ (_ "Friend")
(filter-elements nick liece-nick-alist
(not (string-list-member-ignore-case
(car nick) liece-friends)))))
"Ask for the hostnames of NICKS."
(interactive
(let (nicks (completion-ignore-case t))
- (setq nicks (liece-minibuffer-completing-sequential-read
- (_ "Userhost nick") 0
+ (setq nicks (liece-minibuffer-completing-read-multiple
+ (_ "Userhost nick")
(list-to-alist liece-nick-alist)))
(list nicks)))
(liece-send "USERHOST :%s" (mapconcat 'identity nicks ",")))
(defvar liece-minibuffer-map nil)
(defvar liece-minibuffer-complete-function nil)
+(autoload 'completing-read-multiple "crm")
+(defvar crm-separator)
+
(unless liece-minibuffer-map
(setq liece-minibuffer-map
(let ((map (make-sparse-keymap)))
(_ "[Modes are: %s]")
(mapconcat (function car) liece-supported-user-mode-alist ""))))
-(defun liece-minibuffer-completing-default-read
- (prompt table &optional predicate require-match initial-input)
- "Completing-read w/ default argument like in 'kill-buffer'."
- (let ((default-read
- (completing-read
- (if initial-input
- (format "%s(default %s) " prompt initial-input)
- prompt)
- table predicate require-match nil)))
- (if (and (string= default-read "") initial-input)
- initial-input
- default-read)))
-
-(defun liece-minibuffer-completing-sequential-read
- (prompt &optional count table predicate require-match multiple-candidate)
- "Execute completing-read w/ default argument consequently."
- (let ((count (or count 0)) string result)
- (while (progn
- (setq string
- (completing-read
- (format "%s (%d): " prompt (incf count))
- table predicate require-match nil))
- (or multiple-candidate
- (remove-alist 'table string))
- (not (string= "" string)))
- (push string result))
- result))
+(defun liece-minibuffer-completing-read
+ (prompt table &optional predicate require-match initial-input history default)
+ (completing-read
+ (if default
+ (format "%s(default %s) " prompt default)
+ prompt)
+ table predicate require-match nil))
+
+(defvar liece-minibuffer-completion-separator ","
+ "Separator used for separating strings in `liece-minibuffer-completing-read-multiple'.
+It should be regular expression which doesn't match word-continuent characters.")
+
+(defvar liece-minibuffer-completion-table nil)
+
+(defun liece-minibuffer-completing-read-multiple-1 (string predicate flag)
+ "Function used by `liece-minibuffer-completing-read-multiple'.
+The value of STRING is the string to be completed.
+
+The value of PREDICATE is a function to filter possible matches, or
+nil if none.
+
+The value of FLAG is used to specify the type of completion operation.
+A value of nil specifies `try-completion'. A value of t specifies
+`all-completions'. A value of lambda specifes a test for an exact match.
+
+For more information on STRING, PREDICATE, and FLAG, see the Elisp
+Reference sections on 'Programmed Completion' and 'Basic Completion
+Functions'."
+ (let ((except
+ (butlast
+ (split-string string liece-minibuffer-completion-separator)))
+ (table
+ (copy-sequence liece-minibuffer-completion-table))
+ lead)
+ (when (string-match
+ (concat ".*" liece-minibuffer-completion-separator)
+ string)
+ (setq lead (substring string 0 (match-end 0))
+ string (substring string (match-end 0))))
+ (while except
+ (setq table (remassoc (car except) table)
+ except (cdr except)))
+ (if (null flag)
+ (progn
+ (setq string (try-completion string table predicate))
+ (or (eq t string)
+ (concat lead string)))
+ (if (eq flag 'lambda)
+ (eq t (try-completion string table predicate))
+ (if flag
+ (all-completions string table predicate))))))
+
+(defun liece-minibuffer-completing-read-multiple
+ (prompt table &optional predicate require-match initial-input
+ history default multiple-candidate)
+ "Execute `completing-read' consequently.
+
+See the documentation for `completing-read' for details on the arguments:
+PROMPT, TABLE, PREDICATE, REQUIRE-MATCH, INITIAL-INPUT, HISTORY, DEFAULT."
+ (let ((prompt
+ (format "%s(punctuate by \"%s\") "
+ prompt liece-minibuffer-completion-separator)))
+ (if multiple-candidate
+ (let ((crm-separator
+ liece-minibuffer-completion-separator))
+ (completing-read-multiple
+ prompt table predicate require-match initial-input
+ history default))
+ (let ((liece-minibuffer-completion-table
+ table))
+ (completing-read
+ prompt #'liece-minibuffer-completing-read-multiple-1
+ predicate require-match initial-input history default)))))
(provide 'liece-minibuf)