Commit 1bec99ee authored by Joel Rosdahl's avatar Joel Rosdahl
Browse files

Added "Add cross reference" command.

parent 9306af97
2001-03-15 Joel Rosdahl <joel@rosdahl.net>
* vars.el.in (lyskom-commands): Added kom-add-cross-reference.
(kom-prompt-for-text-no): Added kom-add-cross-reference.
* swedish-strings.el (lyskom-message): Added
text-to-add-cross-reference-to string.
(lyskom-command): Added kom-add-cross-reference.
* english-strings.el (lyskom-message): Added
text-to-add-cross-reference-to string.
(lyskom-command): Added kom-add-cross-reference.
* edit-text.el (kom-edit-add-cross-reference): Use
lyskom-read-cross-reference-and-get-aux-item.
* commands1.el (kom-add-cross-reference): New function.
(lyskom-add-cross-reference): New function.
(lyskom-read-cross-reference-and-get-aux-item): New function.
* Makefile: Include build date in client version if built from a
checked-out CVS module. Somewhat crude, but maybe nice.
......
......@@ -3504,7 +3504,83 @@ DO-ADD: NIL if a footnote should be subtracted.
'confusion-what-to-add-footnote-to
'confusion-what-to-sub-footnote-from)))))
;;; ================================================================
;;; Addera referens - Add cross reference
;;; Author: Joel Rosdahl
(def-kom-command kom-add-cross-reference (text-no-arg)
"Add a cross reference to a text."
(interactive "P")
(lyskom-add-cross-reference text-no-arg
(lyskom-get-string
'text-to-add-cross-reference-to)))
(defun lyskom-add-cross-reference (text-no-arg prompt)
"Get the number of the text that is going to have a cross reference
added to it, ask the user about cross reference type and value, and
add the cross reference.
Arguments:
TEXT-NO-ARG: An argument as gotten from (interactive \"P\").
PROMPT: A string that is used when prompting for a text number."
(let ((text-no (let ((current-prefix-arg text-no-arg))
(lyskom-read-text-no-prefix-arg prompt
nil
lyskom-current-text)))
(aux-item (lyskom-read-cross-reference-and-get-aux-item)))
(when (and text-no aux-item)
(cache-del-text-stat text-no)
(lyskom-report-command-answer
(blocking-do 'modify-text-info
text-no
nil
(list aux-item))))))
(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)))
(obj nil)
(prompt nil)
(char nil))
(cond
((eq type 'text)
(setq prompt (lyskom-get-string 'which-text-to-xref))
(while (null obj)
(setq obj (text-stat->text-no
(blocking-do 'get-text-stat
(lyskom-read-number prompt))))
(setq prompt (lyskom-get-string 'which-text-to-xref-err )))
(setq char "T"))
((eq type 'conf)
(setq prompt (lyskom-get-string 'which-conf-to-xref))
(while (null obj)
(setq obj (lyskom-read-conf-no prompt '(conf) nil nil t)))
(setq char "C"))
((eq type 'pers)
(setq prompt (lyskom-get-string 'which-pers-to-xref))
(while (null obj)
(setq obj (lyskom-read-conf-no prompt '(pers) nil nil t)))
(setq char "P")))
(when obj
(lyskom-create-aux-item 0 3 0 0
(lyskom-create-aux-item-flags
nil nil nil nil nil nil nil nil)
0
(format "%s%d" char obj)))))
......
......@@ -1281,56 +1281,9 @@ RECPT-TYPE is the type of recipient to add."
(defun kom-edit-add-cross-reference ()
(interactive)
(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)))
(obj nil)
(prompt nil)
(item nil))
(cond
((eq type 'text)
(setq prompt (lyskom-get-string 'which-text-to-xref))
(while (null obj)
(setq obj (blocking-do 'get-text-stat
(lyskom-read-number prompt)))
(setq prompt (lyskom-get-string 'which-text-to-xref-err )))
(setq item
(lyskom-create-aux-item 0 3 0 0
(lyskom-create-aux-item-flags
nil nil nil nil nil nil nil nil)
0 (format "T%d"
(text-stat->text-no obj)))))
((eq type 'conf)
(setq prompt (lyskom-get-string 'which-conf-to-xref))
(while (null obj)
(setq obj (lyskom-read-conf-no prompt '(conf) nil nil t))
(setq item
(lyskom-create-aux-item 0 3 0 0
(lyskom-create-aux-item-flags
nil nil nil nil nil nil nil nil)
0 (format "C%d" obj)))))
((eq type 'pers)
(setq prompt (lyskom-get-string 'which-pers-to-xref))
(while (null obj)
(setq obj (lyskom-read-conf-no prompt '(pers) nil nil t))
(setq item
(lyskom-create-aux-item 0 3 0 0
(lyskom-create-aux-item-flags
nil nil nil nil nil nil nil nil)
0 (format "P%d" obj)))))
(t nil))
(lyskom-edit-insert-aux-item item)))
(let ((item (lyskom-read-cross-reference-and-get-aux-item)))
(when item
(lyskom-edit-insert-aux-item item))))
(defun kom-edit-add-read-confirm-request ()
(interactive)
......
......@@ -394,6 +394,7 @@ and you have finished reading. Please come back later.
(text-to-delete-comment-from . "Remove comment from which text:")
(text-to-add-footnote-to . "Add footnote to which text:")
(text-to-delete-footnote-from . "Remove footnote from which text:")
(text-to-add-cross-reference-to . "Add cross reference to which text:")
(text-has-no-recipients-r . "Text %#1n has no recipients\n")
(where-on-list-q . "Placement in your list? (0-%#1d) ")
......@@ -1401,8 +1402,7 @@ Contents: \"%#9s\"
(default-agree-string . "I agree")
(what-agree-no . "Agree with which text? ")
;; Aux-item stuff from edit-text
;; Cross-reference stuff
(person . "User")
(conference . "Conference")
......@@ -1414,6 +1414,8 @@ Contents: \"%#9s\"
(which-pers-to-xref . "Add reference to user: ")
(which-conf-to-xref . "Add reference to conference: ")
;; Aux-item stuff from edit-text
(no-comments-q . "The author doesn't want comments. Comment anyway? ")
(private-answer-q . "The author wants private replies. Write private reply? ")
......@@ -1633,6 +1635,7 @@ You must become an active member of the conference to enter it.\n")
(kom-move-text . "Move text")
(kom-add-comment . "Add comment")
(kom-sub-comment . "Remove comment")
(kom-add-cross-reference . "Add cross reference")
(kom-add-member . "Add (a) member")
(kom-sub-member . "Remove (a) member")
(kom-change-conf-motd . "(Post) notice (on the) conference")
......
......@@ -370,6 +370,7 @@ du har l
(text-to-delete-comment-from . "Vilket inlgg vill du subtrahera en kommentar frn:")
(text-to-add-footnote-to . "Vilket inlgg vill du addera en fotnot till:")
(text-to-delete-footnote-from . "Vilket inlgg vill du subtrahera en fotnot frn:")
(text-to-add-cross-reference-to . "Vilket inlgg vill du addera en referens till:")
(text-has-no-recipients-r . "Inlgg %#1n har inga mottagare\n")
(where-on-list-q . "Placering p listan? (0-%#1d) ")
......@@ -1398,7 +1399,7 @@ Inneh
(default-agree-string . "Hller med")
(what-agree-no . "Hll med vilket inlgg? ")
;; Aux-item stuff from edit-text
;; Cross-reference stuff
(person . "Person")
(conference . "Mte")
......@@ -1410,6 +1411,8 @@ Inneh
(which-pers-to-xref . "Lgg till referens till person: ")
(which-conf-to-xref . "Lgg till referens till mte: ")
;; Aux-item stuff from edit-text
(no-comments-q . "Frfattaren vill inte ha kommentarer. Kommentera nd? ")
(private-answer-q . "Frfattaren har bett om personliga svar. Skriv personligt svar? ")
......@@ -1630,6 +1633,7 @@ Du m
(kom-move-text . "Flytta inlgg")
(kom-add-comment . "Addera kommentar")
(kom-sub-comment . "Subtrahera kommentar")
(kom-add-cross-reference . "Addera referens")
(kom-add-member . "Addera medlem")
(kom-sub-member . "Uteslut medlem")
(kom-change-conf-motd . "Stt lapp p drren")
......
......@@ -1323,6 +1323,7 @@ Users are encouraged to use their best sense of humor."
kom-move-text
kom-add-comment
kom-sub-comment
kom-add-cross-reference
kom-add-member
kom-sub-member
kom-change-conf-motd
......@@ -1905,6 +1906,7 @@ set to that text."
kom-move-text
kom-add-comment
kom-sub-comment
kom-add-cross-reference
kom-save-text-body
kom-add-footnote
kom-sub-footnote
......
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