Commit d49b78fa authored by David Byers's avatar David Byers
Browse files

Fixed bug 1125:

Detailed changes:
> 	Fix bug 1125:
> 	* commands1.el (lyskom-read-cross-reference-and-get-aux-item): Use
> 	lyskom-a-or-b-or-c-p instead of completing-read.
>
> 	* edit-text.el (lyskom-read-link): Moved here from commands1.el
> 	since this is the only file that uses it.
> 	(lyskom-read-link): Use lyskom-a-or-b-or-c instead of
> 	completing-read.
>
> 	* commands1.el (kom-list-re): Ask what to search for before asking
> 	for the search string.
>
parent c3e8f21f
2004-02-22 David Byers <byers@lysator.liu.se>
Fix bug 1125:
* commands1.el (lyskom-read-cross-reference-and-get-aux-item): Use
lyskom-a-or-b-or-c-p instead of completing-read.
* edit-text.el (lyskom-read-link): Moved here from commands1.el
since this is the only file that uses it.
(lyskom-read-link): Use lyskom-a-or-b-or-c instead of
completing-read.
* commands1.el (kom-list-re): Ask what to search for before asking
for the search string.
Fix new bug in kom-is-person-member-of-conference:
* lyskom-rest.el (lyskom-get-read-texts-for-membership): Removed
this function again. It isn't used anywhere any more.
......
......@@ -2042,19 +2042,20 @@ CASE-SENSITIVE is true, that conversion will not be performed.
If the optional argument WHAT is 'person, only persons will be listed.
If it is 'conf, only conferences will be listed."
(interactive (list (lyskom-read-string
(lyskom-get-string 'search-re))
current-prefix-arg
(let ((sel (lyskom-a-or-b-or-c-p 'search-re-for-what
'(search-re-confs
search-re-persons
search-re-all)
'search-re-all)))
(cond
((eq sel 'search-re-all) nil)
((eq sel 'search-re-persons) 'pers)
((eq sel 'search-re-confs) 'conf)
(t nil)))))
(interactive (let ((xwhat (let ((sel (lyskom-a-or-b-or-c-p 'search-re-for-what
'(search-re-confs
search-re-persons
search-re-all)
'search-re-all)))
(cond
((eq sel 'search-re-all) nil)
((eq sel 'search-re-persons) 'pers)
((eq sel 'search-re-confs) 'conf)
(t nil)))))
(list (lyskom-read-string
(lyskom-get-string 'search-re))
current-prefix-arg
xwhat)))
(unless case-sensitive
(setq regexp (lyskom-make-re-case-insensitive regexp)))
(lyskom-format-insert (cond
......@@ -4110,22 +4111,15 @@ Arguments:
(defun lyskom-read-cross-reference-and-get-aux-item ()
"Query user about cross reference type and value, and return the
corresponding aux-item."
(let* ((completions (list (cons (lyskom-get-string 'Conference) 'conf)
(cons (lyskom-get-string 'Person) 'pers)
(cons (lyskom-get-string 'Text) 'text)))
(completion-ignore-case t)
(type (cdr (lyskom-string-assoc
(lyskom-completing-read
(lyskom-get-string 'xref-type)
(lyskom-maybe-frob-completion-table
completions)
nil
t)
completions)))
(let* ((type (lyskom-a-or-b-or-c-p 'xref-type
'(abc-conference
abc-person
abc-text)
nil))
(obj nil)
(char nil))
(cond
((eq type 'text)
((eq type 'abc-text)
(let ((prompt 'which-text-to-xref))
(while (null obj)
(setq obj (text-stat->text-no
......@@ -4133,11 +4127,11 @@ corresponding aux-item."
(lyskom-read-number prompt))))
(setq prompt 'which-text-to-xref-err )))
(setq char "T"))
((eq type 'conf)
((eq type 'abc-conference)
(while (null obj)
(setq obj (lyskom-read-conf-no 'which-conf-to-xref '(conf) nil nil t)))
(setq char "C"))
((eq type 'pers)
((eq type 'abc-person)
(while (null obj)
(setq obj (lyskom-read-conf-no 'which-pers-to-xref '(pers) nil nil t)))
(setq char "P")))
......@@ -4150,49 +4144,6 @@ corresponding aux-item."
(format "%s%d" char obj)))))
(defun lyskom-read-link ()
"Query user about link type and value, and return the corresponding
link as a string."
(let* ((completions (list (cons (lyskom-get-string 'Conference) 'conf)
(cons (lyskom-get-string 'Person) 'pers)
(cons (lyskom-get-string 'Text) 'text)))
(completion-ignore-case t)
(type (cdr (lyskom-string-assoc
(lyskom-completing-read
(lyskom-get-string 'link-type)
(lyskom-maybe-frob-completion-table
completions)
nil
t)
completions)))
(obj nil))
(cond
((eq type 'text)
(let ((prompt 'which-text-to-link))
(while (null obj)
(setq obj (blocking-do 'get-text-stat
(lyskom-read-number prompt)))
(setq prompt 'which-text-to-link-err )))
(let* ((text-no (text-stat->text-no obj))
(text (blocking-do 'get-text text-no))
(txt (text->decoded-text-mass text obj))
(eos (string-match (regexp-quote "\n") txt))
(subject (substring txt 0 eos)))
(format "<text %d: %s>" text-no subject)))
((eq type 'conf)
(while (null obj)
(setq obj (lyskom-read-conf-stat 'which-conf-to-link '(conf) nil nil t)))
(format "<möte %d: %s>" (conf-stat->conf-no obj)
(conf-stat->name obj)))
((eq type 'pers)
(while (null obj)
(setq obj (lyskom-read-conf-stat 'which-pers-to-link '(pers) nil nil t)))
(format "<person %d: %s>" (conf-stat->conf-no obj)
(conf-stat->name obj))))))
;;; ================================================================
;;; Local Variables:
;;; eval: (put 'lyskom-traverse 'lisp-indent-hook 2)
......
......@@ -1382,10 +1382,45 @@ RECPT-TYPE is the type of recipient to add."
(let ((item (lyskom-read-link)))
(when item
(insert item))))
(defun lyskom-read-link ()
"Query user about link type and value, and return the corresponding
link as a string."
(let* ((type (lyskom-a-or-b-or-c-p 'link-type
'(abc-conference
abc-person
abc-text)
nil))
(obj nil))
(cond
((eq type 'abc-text)
(let ((prompt 'which-text-to-link))
(while (null obj)
(setq obj (blocking-do 'get-text-stat
(lyskom-read-number prompt)))
(setq prompt 'which-text-to-link-err )))
(let* ((text-no (text-stat->text-no obj))
(text (blocking-do 'get-text text-no))
(txt (text->decoded-text-mass text obj))
(eos (string-match (regexp-quote "\n") txt))
(subject (substring txt 0 eos)))
(format "<text %d: %s>" text-no subject)))
((eq type 'abc-conference)
(while (null obj)
(setq obj (lyskom-read-conf-stat 'which-conf-to-link '(conf) nil nil t)))
(format "<mte %d: %s>" (conf-stat->conf-no obj)
(conf-stat->name obj)))
((eq type 'abc-person)
(while (null obj)
(setq obj (lyskom-read-conf-stat 'which-pers-to-link '(pers) nil nil t)))
(format "<person %d: %s>" (conf-stat->conf-no obj)
(conf-stat->name obj))))))
(defun lyskom-edit-insert-aux-item (item)
"Insert the aux item ITEM in the current buffer"
(save-excursion
......
......@@ -957,7 +957,7 @@ Help: \\[describe-mode] ---")
(transform-error . "Send unformatted (%#1s)? ")
(cant-find-info-node . "Can't find the info buffer")
(link-type . "What to you want to link to (text, conference or person)? ")
(link-type . "What to you want to link to? ")
(which-text-to-link . "Add link to text: ")
(which-text-to-link-err . "Text not found. Add link to text: ")
(which-pers-to-link . "Add link to user: ")
......@@ -1626,8 +1626,11 @@ Contents: \"%#9s\"
(Server . "Server")
(server . "server")
(servers . "servers")
(abc-person . "pPerson")
(abc-conference . "cConference")
(abc-text . "tText")
(xref-type . "What to you want to refer to (text, conference or person)? ")
(xref-type . "What to you want to refer to? ")
(which-text-to-xref . "Add reference to text: ")
(which-text-to-xref-err . "Text not found. Add reference to text: ")
(which-pers-to-xref . "Add reference to user: ")
......
......@@ -987,7 +987,7 @@ Annat se \\[describe-mode] ---")
(transform-error . "Skicka in oformatterat (%#1s)? ")
(cant-find-info-node . "Hittar inte info-bufferten")
(link-type . "Vad vill du lnka till (inlgg, mte eller person)? ")
(link-type . "Vad vill du lnka till? ")
(which-text-to-link . "Lgg in lnk till text nummer: ")
(which-text-to-link-err . "Hittar inte texten. Lgg in lnk till text nummer: ")
(which-pers-to-link . "Lgg in lnk till person: ")
......@@ -1659,8 +1659,11 @@ Inneh
(Server . "Server")
(server . "server")
(servers . "servrar")
(abc-conference . "mMte")
(abc-person . "pPerson")
(abc-text . "iInlgg")
(xref-type . "Vad vill du referera till (inlgg, mte eller person)? ")
(xref-type . "Vad vill du referera till? ")
(which-text-to-xref . "Lgg till referens till text nummer: ")
(which-text-to-xref-err . "Hittar inte texten. Lgg till referens till text nummer: ")
(which-pers-to-xref . "Lgg till referens till person: ")
......
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