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