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

Better error messages when no text number is read.

Better handling of no default text number.
parent da40ac89
2000-06-02 David Byers <davby@ida.liu.se>
* review.el (kom-find-root): Better error message.
(kom-find-root-review): Better error message.
* commands2.el (kom-add-request-confirm): Better error messages.
(kom-review-mail-headers): Better error message.
* lyskom-rest.el (kom-save-text-body): Better error message.
* commands2.el (kom-add-private-answer): Better error message.
* commands1.el (lyskom-add-sub-comment): Handle failure to read
text-no.
(lyskom-add-sub-footnote): Handle failure to read text-no.
(lyskom-add-sub-recipient): Same here.
(kom-mark-text): Better error message.
(kom-unmark-text): Same here.
* review.el (kom-review-noconversion): Better error message.
Handle failure to read text-no.
* lyskom-rest.el (kom-view): Better error message. Handle failure
to read text-no.
* commands1.el (kom-delete-text): Better error message. Handle
failure to read text-no.
* utilities.el (lyskom-read-text-no-prefix-arg): Zero default is
the same as no default. Prompt for text number if there is no
default.
Unify reading of text numbers:
* commands2.el (kom-add-no-comments): Changed default text number.
(kom-agree): Argument is not optional.
......
......@@ -10,15 +10,18 @@ ALLA SOM ANV
ATT RESULTATET ÄR NIL, VILKET DET BLIR OM MAN INTE HAR EN PROMPT MEN
HAR DEFAULTVÄRDE PÅ TEXTNUMRET!
Kontrollera alla användningar av (lyskom-insert 'have-to-read). En del
borde vara egna strängar.
Använd lyskom-read-text-no-prefix arg i alla funktioner där det är
meningsfullt. Följande är relevanta:
Kommando Default Prompt
------------------------------------------------------
-* Radera inlägg SL Alltid
-* Återse inlägg Inget Ja
-* Återse omodifierat SL Nej
* Radera inlägg SL Alltid
* Återse inlägg SL Ja
* Återse omodifierat SL Nej
* Återse urinlägget SL Nej
* Återse alla kommentarer SL Nej
* Återse alla kommentarer reku SL Nej
......@@ -32,21 +35,21 @@ meningsfullt. F
* Personligt svar på föregåend NSL Nej
* Markera (inlägg) SL Ja
* Avmarkera (inlägg) SL Ja
-* Addera mottagare SL Ja
-* Addera extra kopiemottagare SL Ja
-* Addera för kännedom SL Ja
-* Subtrahera mottagare SL Ja
-* Flytta inlägg SL Ja
-* Addera kommentar SL Ja
-* Subtrahera kommentar SL Ja
* Addera mottagare SL Ja
* Addera extra kopiemottagare SL Ja
* Addera för kännedom SL Ja
* Subtrahera mottagare SL Ja
* Flytta inlägg SL Ja
* Addera kommentar SL Ja
* Subtrahera kommentar SL Ja
X Arkivera inlägg (till fil) SL Ja
* Spara inläggstext (på fil) SL Ja
X Sätt loginmeddelande SS Ja
* Kort replik SL Nej
* Hålla med SL Nej
* Addera FAQ SS Ja
-* Addera fotnot SS Ja
-* Subtrahera fotnot SS Ja
* Addera fotnot SS Ja
* Subtrahera fotnot SS Ja
* Förhindra kommentarer SS Ja
* Begär personligt svar SS Ja
* Begär läsbekräftelse SS Ja
......
......@@ -113,35 +113,35 @@
(def-kom-command kom-delete-text (text-no)
"Delete a text. Argument: TEXT-NO"
(interactive (list (lyskom-read-text-no-prefix-arg 'what-text-to-delete
nil
lyskom-current-text)))
(let* ((do-delete t)
(text-stat (blocking-do 'get-text-stat text-no))
(num-marks (text-stat->no-of-marks text-stat))
(is-marked-by-me (cache-text-is-marked text-no)))
(cond ((null text-stat)
(lyskom-report-command-answer nil)
(setq do-delete nil))
((> (text-stat->no-of-marks text-stat) 0)
(setq do-delete
(lyskom-j-or-n-p
(lyskom-format 'delete-marked-text
(if (> num-marks 0)
(if is-marked-by-me
(if (= num-marks 1)
(lyskom-get-string 'delete-marked-by-you)
(lyskom-format 'delete-marked-by-you-and-others
(1- num-marks)))
(lyskom-format 'delete-marked-by-several
num-marks))))))))
(when do-delete
(lyskom-format-insert 'deleting-text text-no)
(when (lyskom-report-command-answer
(blocking-do 'delete-text text-no))
(when is-marked-by-me
(lyskom-unmark-text text-no))))))
(interactive (list (lyskom-read-text-no-prefix-arg 'what-text-to-delete)))
(if text-no
(let* ((do-delete t)
(text-stat (blocking-do 'get-text-stat text-no))
(num-marks (text-stat->no-of-marks text-stat))
(is-marked-by-me (cache-text-is-marked text-no)))
(cond ((null text-stat)
(lyskom-report-command-answer nil)
(setq do-delete nil))
((> (text-stat->no-of-marks text-stat) 0)
(setq do-delete
(lyskom-j-or-n-p
(lyskom-format 'delete-marked-text
(if (> num-marks 0)
(if is-marked-by-me
(if (= num-marks 1)
(lyskom-get-string 'delete-marked-by-you)
(lyskom-format 'delete-marked-by-you-and-others
(1- num-marks)))
(lyskom-format 'delete-marked-by-several
num-marks))))))))
(when do-delete
(lyskom-format-insert 'deleting-text text-no)
(when (lyskom-report-command-answer
(blocking-do 'delete-text text-no))
(when is-marked-by-me
(lyskom-unmark-text text-no)))))
(lyskom-insert 'confusion-what-to-delete)))
......@@ -190,7 +190,7 @@ optional arg TEXT-NO is present review the text that text commented instead."
(lyskom-tell-internat 'kom-tell-read)
(lyskom-view-commented-text
(blocking-do 'get-text-stat text-no)))
(lyskom-insert-string 'have-to-read)))
(lyskom-insert-string 'confusion-what-to-view)))
(def-kom-command kom-view-previous-commented-text (text-no)
......@@ -777,7 +777,7 @@ If optional arg TEXT-NO is present write a comment to that text instead."
text
text-no
'comment))))
(lyskom-insert-string 'confusion-what-to-comment))
(lyskom-insert-string 'confusion-who-to-reply-to))
(lyskom-end-of-command)))
......@@ -1551,7 +1551,7 @@ If you are not member in the conference it will be flagged with an asterisk."
(interactive (list (lyskom-read-text-no-prefix-arg 'text-to-mark)))
(if text-no
(lyskom-mark-text text-no)
(lyskom-insert 'have-to-read)))
(lyskom-insert 'confusion-what-to-mark)))
(def-kom-command kom-unmark-text (&optional text-no)
......@@ -1559,7 +1559,7 @@ If you are not member in the conference it will be flagged with an asterisk."
(interactive (list (lyskom-read-text-no-prefix-arg 'text-to-unmark)))
(if text-no
(lyskom-unmark-text text-no)
(lyskom-insert 'have-to-read)))
(lyskom-insert 'confusion-what-to-unmark)))
(defun lyskom-unmark-text (text-no)
......@@ -2951,6 +2951,9 @@ command argument."
default-to
default-from t))))))
;;; NOTE: If you add an action you need to add an foo-action-name
;;; string to the strings files.
(defun lyskom-add-sub-recipient (text-no-arg
prompt
action
......@@ -2964,111 +2967,112 @@ conference to add, remove or move from, CONF2 is thee conference to
move to (for move) and a non-nil TEXT-NO-IS-READ means that the user has
already been prompted for a text number so TEXT-NO-ARG contains the
actual text to do whatever on."
(let* ((text-no (if (and text-no-is-read text-no-arg)
text-no-arg
(let ((current-prefix-arg text-no-arg))
(lyskom-read-text-no-prefix-arg prompt
nil
lyskom-current-text))))
(text-stat (blocking-do 'get-text-stat text-no))
(was-read (lyskom-text-read-p text-stat))
;; Only for moving
(conf-to-move-from (if (eq action 'move)
(lyskom-read-conf-stat
(lyskom-get-string 'who-to-move-from-q)
'(all)
nil
(cons (if conf2 (conf-stat->name conf2) "") 0)
t)))
(conf-to-add-to (lyskom-read-conf-stat
(lyskom-get-string
(cond ((eq action 'add-rcpt) 'who-to-add-q)
((eq action 'add-copy) 'who-to-add-copy-q)
((eq action 'add-bcc) 'who-to-add-bcc-q)
((eq action 'sub) 'who-to-sub-q)
((eq action 'move) 'who-to-move-to-q)
(t (lyskom-error "internal error"))))
'(all)
nil
(cons (if conf (conf-stat->name conf) "") 0)
t))
(result nil))
;; Confirm add a full recipient
(when (and (eq action 'add-rcpt)
conf-to-add-to
(not (lyskom-j-or-n-p (lyskom-format 'really-add-as-recpt-q conf-to-add-to) t)))
(setq action 'add-copy))
(setq result
(cond ((eq action 'add-rcpt)
(lyskom-format-insert 'adding-name-as-recipient
conf-to-add-to
text-stat)
(setq lyskom-last-added-rcpt
(conf-stat->conf-no conf-to-add-to))
(blocking-do 'add-recipient
text-no
(conf-stat->conf-no conf-to-add-to)
'recpt))
((eq action 'add-copy)
(lyskom-format-insert 'adding-name-as-copy
conf-to-add-to
text-stat)
(setq lyskom-last-added-ccrcpt
(conf-stat->conf-no conf-to-add-to))
(blocking-do 'add-recipient
text-no
(conf-stat->conf-no conf-to-add-to)
'cc-recpt))
((eq action 'add-bcc)
(lyskom-format-insert 'adding-name-as-copy
conf-to-add-to
text-stat)
(setq lyskom-last-added-bccrcpt
(conf-stat->conf-no conf-to-add-to))
(blocking-do 'add-recipient
text-no
(conf-stat->conf-no conf-to-add-to)
'bcc-recpt))
(let ((text-no (if (and text-no-is-read text-no-arg)
text-no-arg
(let ((current-prefix-arg text-no-arg))
(lyskom-read-text-no-prefix-arg prompt)))))
(if text-no
(let* ((text-stat (blocking-do 'get-text-stat text-no))
(was-read (lyskom-text-read-p text-stat))
;; Only for moving
(conf-to-move-from (if (eq action 'move)
(lyskom-read-conf-stat
(lyskom-get-string 'who-to-move-from-q)
'(all)
nil
(cons (if conf2 (conf-stat->name conf2) "") 0)
t)))
(conf-to-add-to (lyskom-read-conf-stat
(lyskom-get-string
(cond ((eq action 'add-rcpt) 'who-to-add-q)
((eq action 'add-copy) 'who-to-add-copy-q)
((eq action 'add-bcc) 'who-to-add-bcc-q)
((eq action 'sub) 'who-to-sub-q)
((eq action 'move) 'who-to-move-to-q)
(t (lyskom-error "internal error"))))
'(all)
nil
(cons (if conf (conf-stat->name conf) "") 0)
t))
(result nil))
;; Confirm add a full recipient
(when (and (eq action 'add-rcpt)
conf-to-add-to
(not (lyskom-j-or-n-p (lyskom-format 'really-add-as-recpt-q conf-to-add-to) t)))
(setq action 'add-copy))
(setq result
(cond ((eq action 'add-rcpt)
(lyskom-format-insert 'adding-name-as-recipient
conf-to-add-to
text-stat)
(setq lyskom-last-added-rcpt
(conf-stat->conf-no conf-to-add-to))
(blocking-do 'add-recipient
text-no
(conf-stat->conf-no conf-to-add-to)
'recpt))
((eq action 'add-copy)
(lyskom-format-insert 'adding-name-as-copy
conf-to-add-to
text-stat)
(setq lyskom-last-added-ccrcpt
(conf-stat->conf-no conf-to-add-to))
(blocking-do 'add-recipient
text-no
(conf-stat->conf-no conf-to-add-to)
'cc-recpt))
((eq action 'add-bcc)
(lyskom-format-insert 'adding-name-as-copy
conf-to-add-to
text-stat)
(setq lyskom-last-added-bccrcpt
(conf-stat->conf-no conf-to-add-to))
(blocking-do 'add-recipient
text-no
(conf-stat->conf-no conf-to-add-to)
'bcc-recpt))
((eq action 'sub)
(lyskom-format-insert 'remove-name-as-recipient
conf-to-add-to
text-stat)
(blocking-do 'sub-recipient
text-no
(conf-stat->conf-no conf-to-add-to)))
((eq action 'move)
(lyskom-format-insert 'moving-name
conf-to-move-from
conf-to-add-to
text-stat)
(setq lyskom-last-added-rcpt
(conf-stat->conf-no conf-to-add-to))
(blocking-do-multiple
((add (add-recipient
text-no
(conf-stat->conf-no conf-to-add-to)
'recpt))
(sub (sub-recipient
text-no
(conf-stat->conf-no conf-to-move-from))))
(and add sub)))
((eq action 'sub)
(lyskom-format-insert 'remove-name-as-recipient
conf-to-add-to
text-stat)
(blocking-do 'sub-recipient
text-no
(conf-stat->conf-no conf-to-add-to)))
((eq action 'move)
(lyskom-format-insert 'moving-name
conf-to-move-from
conf-to-add-to
text-stat)
(setq lyskom-last-added-rcpt
(conf-stat->conf-no conf-to-add-to))
(blocking-do-multiple
((add (add-recipient
text-no
(conf-stat->conf-no conf-to-add-to)
'recpt))
(sub (sub-recipient
text-no
(conf-stat->conf-no conf-to-move-from))))
(and add sub)))
(t (lyskom-error "internal error"))))
(cache-del-text-stat text-no)
(if was-read (lyskom-mark-as-read (blocking-do 'get-text-stat text-no)))
(lyskom-report-command-answer result)))
(t (lyskom-error "internal error"))))
(cache-del-text-stat text-no)
(if was-read (lyskom-mark-as-read (blocking-do 'get-text-stat text-no)))
(lyskom-report-command-answer result))
(lyskom-format-insert 'confusion-what-to-add-sub-recipient
(lyskom-get-string (intern (concat (symbol-name action)
"-action-name")))))))
......@@ -3102,23 +3106,27 @@ Arguments: TEXT-NO-ARG: an argument as it is gotten from (interactive P)
PROMPT: A string that is used when prompting for a number.
DO-ADD: NIL if a comment should be subtracted.
Otherwise a comment is added"
(let* ((text-no (let ((current-prefix-arg text-no-arg))
(lyskom-read-text-no-prefix-arg prompt nil lyskom-current-text)))
(comment-text-no (lyskom-read-number
(lyskom-get-string
(if do-add 'text-to-add-q 'text-to-remove-q))
(if (eq text-no lyskom-current-text)
nil
lyskom-current-text))))
(lyskom-format-insert (if do-add 'add-comment-to 'sub-comment-to)
comment-text-no
text-no)
(cache-del-text-stat text-no)
(cache-del-text-stat comment-text-no)
(lyskom-report-command-answer
(blocking-do (if do-add 'add-comment 'sub-comment)
comment-text-no
text-no))))
(let ((text-no (let ((current-prefix-arg text-no-arg))
(lyskom-read-text-no-prefix-arg prompt nil lyskom-current-text))))
(if text-no
(let* ((comment-text-no (lyskom-read-number
(lyskom-get-string
(if do-add 'text-to-add-q 'text-to-remove-q))
(if (eq text-no lyskom-current-text)
nil
lyskom-current-text))))
(lyskom-format-insert (if do-add 'add-comment-to 'sub-comment-to)
comment-text-no
text-no)
(cache-del-text-stat text-no)
(cache-del-text-stat comment-text-no)
(lyskom-report-command-answer
(blocking-do (if do-add 'add-comment 'sub-comment)
comment-text-no
text-no)))
(lyskom-format-insert (if do-add
'confusion-what-to-add-comment-to
'confusion-what-to-sub-comment-from)))))
(def-kom-command kom-add-footnote (text-no-arg)
"Add a text as a footnote to another text."
......@@ -3141,25 +3149,29 @@ Arguments: TEXT-NO-ARG: an argument as it is gotten from (interactive P)
PROMPT: A string that is used when prompting for a number.
DO-ADD: NIL if a footnote should be subtracted.
Otherwise a footnote is added"
(let* ((text-no (let ((current-prefix-arg text-no-arg))
(lyskom-read-text-no-prefix-arg prompt nil lyskom-current-text)))
(footnote-text-no (lyskom-read-number
(lyskom-get-string
(if do-add
'text-to-add-footn-q
'text-to-remove-footn-q))
(if (eq text-no lyskom-current-text)
nil
lyskom-current-text))))
(lyskom-format-insert (if do-add 'add-footnote-to 'sub-footnote-to)
footnote-text-no
text-no)
(cache-del-text-stat text-no)
(cache-del-text-stat footnote-text-no)
(lyskom-report-command-answer
(blocking-do (if do-add 'add-footnote 'sub-footnote)
footnote-text-no
text-no))))
(let ((text-no (let ((current-prefix-arg text-no-arg))
(lyskom-read-text-no-prefix-arg prompt nil lyskom-current-text))))
(if text-no
(let* ((footnote-text-no (lyskom-read-number
(lyskom-get-string
(if do-add
'text-to-add-footn-q
'text-to-remove-footn-q))
(if (eq text-no lyskom-current-text)
nil
lyskom-current-text))))
(lyskom-format-insert (if do-add 'add-footnote-to 'sub-footnote-to)
footnote-text-no
text-no)
(cache-del-text-stat text-no)
(cache-del-text-stat footnote-text-no)
(lyskom-report-command-answer
(blocking-do (if do-add 'add-footnote 'sub-footnote)
footnote-text-no
text-no)))
(lyskom-insert (if do-add
'confusion-what-to-add-footnote-to
'confusion-what-to-sub-footnote-from)))))
......
......@@ -2281,7 +2281,7 @@ Return-value: 'no-session if there is no suitable session to switch to
(lyskom-create-aux-item-flags
nil nil nil nil nil nil nil nil) 0 ""))))
(cache-del-text-stat text-no))))))
(lyskom-insert 'have-to-read)))
(lyskom-insert 'confusion-what-to-comment)))
(def-kom-command kom-add-request-confirm (text-no)
"Add confirmation request aux-item to a text."
......@@ -2322,7 +2322,7 @@ Return-value: 'no-session if there is no suitable session to switch to
(lyskom-create-aux-item-flags
nil nil nil nil nil nil nil nil) 0 ""))))
(cache-del-text-stat text-no))))))
(lyskom-insert 'have-to-read)))
(lyskom-insert 'confusion-what-to-request-confirmation)))
(def-kom-command kom-review-mail-headers (text-no)
"Review the mail headers of an imported message"
......@@ -2340,7 +2340,7 @@ Return-value: 'no-session if there is no suitable session to switch to
(lyskom-format-insert "%#1t" (aux-item->data el))
(lyskom-insert "\n")))
headers))))
(lyskom-insert 'have-to-read)))
(lyskom-insert 'confusion-what-to-review-mail-headers)))
;;; ============================================================
......
......@@ -303,17 +303,16 @@ If the optional argument REFETCH is non-nil, all caches are cleared and
(lyskom-start-of-command 'kom-view)
(lyskom-tell-internat 'kom-tell-review))
(let ((current-prefix-arg text-no))
(setq text-no (lyskom-read-text-no-prefix-arg
'review-text-q
nil
lyskom-current-text)))
(if (or (not (listp kom-page-before-command))
(memq 'kom-view kom-page-before-command))
(recenter 1))
(lyskom-tell-internat 'kom-tell-review)
(lyskom-format-insert 'review-text-no text-no)
(lyskom-view-text text-no))
(setq text-no (lyskom-read-text-no-prefix-arg 'review-text-q)))
(cond (text-no
(if (or (not (listp kom-page-before-command))
(memq 'kom-view kom-page-before-command))
(recenter 1))
(lyskom-tell-internat 'kom-tell-review)
(lyskom-format-insert 'review-text-no text-no)
(lyskom-view-text text-no))
(t (lyskom-insert 'confusion-what-to-view))))
(lyskom-end-of-command)))
......@@ -2305,7 +2304,7 @@ The name of the file is read using the minibuffer and the default is kom-text."
(lyskom-insert (lyskom-get-string 'done)))
(quit (lyskom-insert (lyskom-get-string 'cancelled)))
(error (lyskom-insert (lyskom-get-string 'nope))))))))))))
(t (lyskom-insert 'have-to-read))))
(t (lyskom-insert 'confusion-what-to-save))))
......
......@@ -1011,7 +1011,7 @@ instead. In this case the text TEXT-NO is first shown."
)
)
(t
(lyskom-insert-string 'read-text-first))))
(lyskom-insert-string 'confusion-what-to-find-root))))
(def-kom-command kom-find-root-review (text-no)
......@@ -1029,7 +1029,7 @@ reviews the whole tree in deep-first order."
(lyskom-review-tree (car start)))
(start (lyskom-review-tree (car start)))
(t (signal 'lyskom-internal-error "Could not find root")))))
(t (lyskom-insert-string 'read-text-first))))
(t (lyskom-insert-string 'confusion-what-to-find-root-review))))
(defun lyskom-find-root (text-stat &optional all)
......@@ -1273,10 +1273,12 @@ text is shown and a REVIEW list is built to shown the other ones."
(def-kom-command kom-review-noconversion (text-no)
"Displays TEXT-NO or the last read text without any conversion."
(interactive (list (lyskom-read-text-no-prefix-arg 'review-noconversion-q)))
(let ((lyskom-format-special nil)
(kom-smileys nil)
(kom-autowrap nil))
(lyskom-view-text text-no)))
(if text-no
(let ((lyskom-format-special nil)
(kom-smileys nil)
(kom-autowrap nil))
(lyskom-view-text text-no))
(lyskom-insert 'confusion-what-to-view)))
......
......@@ -269,15 +269,7 @@ Skicka ett brev till %#2P f
(secret-members-allowed . "Fr man g med som hemlig medlem? ")
(what-comment-no . "Kommentera text nummer: ")
(what-footnote-no . "Fotnotera text nummer: ")
(confusion-what-to-reply-to . "Jag frstr inte vilken text du vill skriva en kort replik till.\n")
(confusion-what-to-agree-to . "Jag frstr inte vilken text du vill hlla med om.\n")
(confusion-what-to-comment . "Jag frstr inte vilken text du vill kommentera.\n")
(confusion-what-to-footnote . "Jag frstr inte vilken text du vill skriva en fotnot till.\n")
(what-private-no . "Personligt svar till text nummer: ")
(confusion-who-to-reply-to . "Jag frstr inte vems inlgg du vill skriva ett privat svar till.\n")
(confusion-what-to-answer-to . "Jag frstr inte vilken text du vill besvara.\n")
(confusion-what-to-view . "Jag frstr inte vilken text du vill terse.\n")
(quit-in-spite-of-unsent . "Vill du avsluta sessionen trots osnt meddelande? ")
(really-quit . "Vill du verkligen avsluta sessionen? ")
<