Commit 0159b7d5 authored by David Byers's avatar David Byers
Browse files

> Fix problems entering conferences in the edit buffer:

>       * completing-read.el (lyskom-default-conference-saved): Read the
>       value of lyskom-read-conf-saved-inputs in the LysKOM buffer.
>       (lyskom-read-conf-save-input): Same here.
>       (lyskom-get-initial-conf-strategy): Print warning about missing
>       strategy in LysKOM buffer.
>
>       * vars.el.in (lyskom-read-conf-saved-inputs): Moved here from
>       completing-read.el and made it buffer-local.
>
>       * completing-read.el (lyskom-read-conf): Create dynamic binding of
>       lyskom-current-command to lyskom-current-command or this-command
>       so lyskom-read-conf-guess-initial has good data to operate on even
>       if this-command is changed during execution of lyskom-read-conf.
parent 65115ed7
2003-08-25 David Byers <davby@ida.liu.se>
Fix problems entering conferences in the edit buffer:
* completing-read.el (lyskom-default-conference-saved): Read the
value of lyskom-read-conf-saved-inputs in the LysKOM buffer.
(lyskom-read-conf-save-input): Same here.
(lyskom-get-initial-conf-strategy): Print warning about missing
strategy in LysKOM buffer.
* vars.el.in (lyskom-read-conf-saved-inputs): Moved here from
completing-read.el and made it buffer-local.
* completing-read.el (lyskom-read-conf): Create dynamic binding of
lyskom-current-command to lyskom-current-command or this-command
so lyskom-read-conf-guess-initial has good data to operate on even
if this-command is changed during execution of lyskom-read-conf.
* vars.el.in (lyskom-last-personal-message-sender): Default to
nil.
(lyskom-last-group-message-recipient): Default to nil.
......
......@@ -39,8 +39,6 @@
"$Id$\n"))
(defvar lyskom-name-hist nil)
(defvar lyskom-read-conf-saved-inputs nil)
;;; ============================================================
......@@ -214,8 +212,11 @@ See lyskom-read-conf for a description of the parameters."
(defun lyskom-default-conference-saved (sym &rest args)
(and (cdr (assq (car sym) lyskom-read-conf-saved-inputs))
(list (conf-z-info->conf-no (cdr (assq (car sym) lyskom-read-conf-saved-inputs))))))
(save-excursion
(when lyskom-buffer (set-buffer lyskom-buffer))
(and (cdr (assq (car sym) lyskom-read-conf-saved-inputs))
(list (conf-z-info->conf-no
(cdr (assq (car sym) lyskom-read-conf-saved-inputs)))))))
(defun lyskom-default-conference-not-self (uc &rest args)
(not (eq (uconf-stat->conf-no uc) lyskom-pers-no)))
......@@ -234,12 +235,15 @@ See lyskom-read-conf for a description of the parameters."
(prompt-spec (cdr (assq prompt spec-1)))
(cmd-spec (cdr (assq t spec-1))))
(lyskom-debug-forms
(unless spec-1 (lyskom-format-insert-before-prompt
"%[%#2@%#1s%]\n"
(format "Warning: no strategy for %S/%S"
(or lyskom-current-command this-command)
prompt)
`(face ,kom-warning-face))))
(unless spec-1
(save-excursion
(when lyskom-buffer (set-buffer lyskom-buffer))
(lyskom-format-insert-before-prompt
"%[%#2@%#1s%]\n"
(format "Warning: no strategy for %S/%S"
(or lyskom-current-command this-command)
prompt)
`(face ,kom-warning-face)))))
(list (or (assq 'default prompt-spec)
(assq 'default cmd-spec)
(assq 'default default-spec))
......@@ -282,12 +286,14 @@ See lyskom-read-conf for a description of the parameters."
(defun lyskom-read-conf-save-input (prompt input)
"Save INPUT as input for the current completing read command."
(lyskom-traverse sym (cdr (assq 'save (lyskom-get-initial-conf-strategy prompt)))
(if (assq sym lyskom-read-conf-saved-inputs)
(setcdr (assq sym lyskom-read-conf-saved-inputs) input)
(setq lyskom-read-conf-saved-inputs
(cons (cons sym input) lyskom-read-conf-saved-inputs))
)))
(save-excursion
(when lyskom-buffer (set-buffer lyskom-buffer))
(lyskom-traverse sym (cdr (assq 'save (lyskom-get-initial-conf-strategy prompt)))
(if (assq sym lyskom-read-conf-saved-inputs)
(setcdr (assq sym lyskom-read-conf-saved-inputs) input)
(setq lyskom-read-conf-saved-inputs
(cons (cons sym input) lyskom-read-conf-saved-inputs))
))))
(defun lyskom-read-conf (prompt type &optional empty initial mustmatch)
"Completing read a conference or person from the minibuffer.
......@@ -324,53 +330,59 @@ A conf-z-info: The conf-z-info associated with the name entered,
nil: Nothing was entered, or
A string: A name that matched nothing in the database."
(lyskom-completing-clear-cache)
(setq initial
(cond ((integerp initial)
(uconf-stat->name (blocking-do 'get-uconf-stat initial)))
((stringp initial) initial)
((lyskom-conf-stat-p initial)
(conf-stat->name initial))
((lyskom-uconf-stat-p initial)
(uconf-stat->name initial))
((lyskom-conf-z-info-p initial)
(conf-z-info->name initial))
((consp initial) initial)
((lyskom-read-conf-guess-initial prompt type))
(t nil)))
(let* ((completion-ignore-case t)
(minibuffer-local-completion-map
lyskom-minibuffer-local-completion-map)
(minibuffer-local-must-match-map
lyskom-minibuffer-local-must-match-map)
(read-string nil)
(old-prompt prompt)
(result nil)
(keep-going t))
(setq prompt (cond ((stringp prompt) prompt)
((symbolp prompt) (lyskom-get-string prompt))
((listp prompt) (apply 'lyskom-format prompt))
(t (lyskom-get-string 'conf-prompt))))
(while keep-going
(setq read-string (lyskom-completing-read prompt
'lyskom-read-conf-internal
type
mustmatch
(if (listp initial)
initial
(cons initial 0))
'lyskom-name-hist))
(setq result
(cond ((null read-string) nil)
((string= "" read-string) nil)
(t (lyskom-lookup-conf-by-name read-string type))))
(setq keep-going (and (not empty)
(null result))))
(lyskom-read-conf-save-input old-prompt result)
result))
;; We bind lyskom-current-command here so that changes to
;; this-command will not confuse our guesses for the initial value
;; (particularly at the end of this function, where we sometimes
;; save the value the user entered).
(let ((lyskom-current-command (or lyskom-current-command this-command)))
(lyskom-completing-clear-cache)
(setq initial
(cond ((integerp initial)
(uconf-stat->name (blocking-do 'get-uconf-stat initial)))
((stringp initial) initial)
((lyskom-conf-stat-p initial)
(conf-stat->name initial))
((lyskom-uconf-stat-p initial)
(uconf-stat->name initial))
((lyskom-conf-z-info-p initial)
(conf-z-info->name initial))
((consp initial) initial)
((lyskom-read-conf-guess-initial prompt type))
(t nil)))
(let* ((completion-ignore-case t)
(minibuffer-local-completion-map
lyskom-minibuffer-local-completion-map)
(minibuffer-local-must-match-map
lyskom-minibuffer-local-must-match-map)
(read-string nil)
(old-prompt prompt)
(result nil)
(keep-going t))
(setq prompt (cond ((stringp prompt) prompt)
((symbolp prompt) (lyskom-get-string prompt))
((listp prompt) (apply 'lyskom-format prompt))
(t (lyskom-get-string 'conf-prompt))))
(while keep-going
(setq read-string (lyskom-completing-read prompt
'lyskom-read-conf-internal
type
mustmatch
(if (listp initial)
initial
(cons initial 0))
'lyskom-name-hist))
(setq result
(cond ((null read-string) nil)
((string= "" read-string) nil)
(t (lyskom-lookup-conf-by-name read-string type))))
(setq keep-going (and (not empty)
(null result))))
(lyskom-read-conf-save-input old-prompt result)
result)))
(defun lyskom-read-conf-get-logins ()
......
......@@ -4121,6 +4121,11 @@ texts that is to be sent to the server.")
"Saved value of buffer-read-only when in slow mode."
local)
(def-kom-var lyskom-read-conf-saved-inputs nil
"Saved inputs from lyskom-read-conf."
local)
(defvar lyskom-line-start-chars-string
"\"$&'()*+-./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]_`abcdefghijklmnopqrstuvwxyz¡£¤¥§©ª«­®±²³µ¶¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ"
"Characters that may start a line in a paragraph to be broken.")
......
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