Commit 9a08c440 authored by David Byers's avatar David Byers
Browse files

Fixade bug 752

parent cf12a278
2002-09-14 David Byers <>
Fix bug 752:
* commands1.el (kom-list-re): Use lyskom-a-or-b-or-c-p to choose
what to search in.
* lyskom-rest.el (lyskom-a-or-b-or-c-p): New function. Generalized
y-or-n-p sort of.
2002-09-12 David Byers <>
* english-strings.el,swedish-strings.el: Fixed speling error for
......@@ -1863,13 +1863,16 @@ If it is 'conf, only conferences will be listed."
(interactive (list (lyskom-read-string
(lyskom-get-string 'search-re))
(let ((pers (lyskom-j-or-n-p 'include-persons))
(conf (lyskom-j-or-n-p 'include-conferences)))
((and pers conf) nil)
(pers 'pers)
(conf 'conf)
(t (error "This user interface is stupid."))))))
(let ((sel (lyskom-a-or-b-or-c-p 'search-re-for-what
((eq sel 'search-re-all) nil)
((eq sel 'search-re-persons) 'pers)
((eq sel 'search-re-confs) 'conf)
(t nil)))))
(unless case-sensitive
(setq regexp (lyskom-make-re-case-insensitive regexp)))
(lyskom-format-insert (cond
......@@ -379,8 +379,10 @@ and you have finished reading. Please come back later.
(search-for-pers . "Enter search key (RETURN for all users): ")
(search-for-conf . "Enter search key (RETURN for all conferences): ")
(search-re . "Enter search regexp: ")
(include-persons . "Search among persons? ")
(include-conferences . "Search among conferences? ")
(search-re-for-what . "What do you want to search for? ")
(search-re-persons . "ppersons")
(search-re-confs . "cconferences")
(search-re-all . "bboth")
(no-matching-confs . "No conferences match \"%#1s\".\n")
(no-matching-perss . "No persons match \"%#1s\".\n")
......@@ -1194,6 +1196,8 @@ You should set it to a better value.\n")
(j-or-n . "(y or n) ")
(y-instring . "yY ")
(a-or-b-or-c-nag . "Pleas press a valid key. ")
(person-does-not-exist . "User %#1d (does not exist).")
(conference-does-not-exist . "Conference %#1d (does not exist).")
(conf-no-does-not-exist-r . "Conference %#1d does not exist.")
......@@ -3520,6 +3520,80 @@ lyskom-get-string to retrieve regexps for answer and string for repeated query."
(ja-or-nej-p prompt initial-input)
(quit (signal 'quit nil))))
(defun lyskom-a-or-b-or-c-p (prompt alternatives &optional default)
"Like y-or-n-p but choose among several options.
Display PROMPT and ask user to choose among ALTERNATIVES.
ALTERNATIVES are symbols. Each alternative must be found as a string
in lyskom-messages. The first character of the string is the character
to enter to select the alternative and is not displayed.
If non-nil DEFAULT is the default alternative and is selected when the
user types RET.
Returns the selected alternative (a symbol)"
(when (symbolp prompt) (setq prompt (lyskom-get-string prompt)))
(let* ((input-char 0)
(cursor-in-echo-area t)
(lyskom-inhibit-minibuffer-messages t)
(alts (mapcar (lambda (alt)
(let ((string (lyskom-get-string alt)))
(list (elt string 0)
(substring string 1)
(alts-string (format "(%s) " (mapconcat (lambda (c)
(format "%c: %s"
(elt c 0)
(elt c 1)))
", ")))
(nagging nil))
(while (and (not (assq input-char alts))
(not (or (eq input-char ?\C-g)
(eq 'keyboard-quit
(lyskom-lookup-key (current-local-map)
(not (and default (eq input-char ?\C-m))))
(lyskom-message "%s" (concat (if nagging
(lyskom-get-string 'a-or-b-or-c-nag)
(if nagging (beep))
;; Workaround for Emacs whose read-char does not accept C-g
(setq input-char
(let ((inhibit-quit t))
(prog1 (read-char-exclusive)
(setq quit-flag nil))))
;; Redisplay prompt on C-l
(if (or (eq input-char ?\C-l)
(eq 'recenter (lyskom-lookup-key (current-local-map)
(setq nagging nil)
(setq nagging t)))
(when (or (eq input-char ?\C-g)
(eq 'keyboard-quit (lyskom-lookup-key (current-local-map)
(signal 'quit nil))
(lyskom-message "%s" (concat prompt (elt (assq input-char alts) 1)))
(if (eq input-char ?\C-m)
(elt (assq input-char alts) 2))))
(defun lyskom-membership-< (a b)
......@@ -349,8 +349,10 @@ du har l
(search-for-pers . "Ange skvillkor (RETURN fr alla personer): ")
(search-for-conf . "Ange skvillkor (RETURN fr alla mten): ")
(search-re . "Ange skuttryck (reguljrt uttryck): ")
(include-persons . "Sk bland personer? ")
(include-conferences . "Sk bland mten? ")
(search-re-for-what . "Vad vill du ska? ")
(search-re-persons . "pSk personer")
(search-re-confs . "mSk mten")
(search-re-all . "bSk alla")
(no-matching-confs . "Inga mten uppfyller skvillkoret \"%#1s\".\n")
(no-matching-perss . "Inga personer uppfyller skvillkoret \"%#1s\".\n")
......@@ -1208,6 +1210,8 @@ Du b
(j-or-n . "(j eller n) ")
(y-instring . "jJ ")
(a-or-b-or-c-nag . "Ge ett giltigt alternativ. ")
(person-does-not-exist . "Person %#1d (finns inte).")
(conference-does-not-exist . "Mte %#1d (finns inte).")
(conf-no-does-not-exist-r . "Mte %#1d finns inte.")
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