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

Use lyskom-read-text-no-prefix-arg in many places

Make it possible to configure which commands always prompt for a text
parent ec24fe68
2000-06-02 David Byers <davby@ida.liu.se>
Unify reading of text numbers:
* commands2.el (kom-add-no-comments): Changed default text number.
(kom-agree): Argument is not optional.
* lyskom-rest.el (kom-save-text-body): Handle null text-no.
* commands1.el (kom-view-commented-text): Argument is not
optional.
(kom-review-presentation): Use def-kom-command.
(kom-comment-previous): Use lyskom-read-text-no-prefix-arg.
(kom-write-footnote): Argument is not optional. Don't force prompt
for text.
(kom-private-answer-previous): Use lyskom-read-text-no-prefix-arg.
* review.el (kom-review-noconversion): Use def-kom-command.
(kom-review-tree): Use lyskom-read-text-no-prefix-arg.
(kom-find-root): Use lyskom-read-text-no-prefix-arg.
(kom-find-root-review): Use lyskom-read-text-no-prefix-arg.
(kom-review-comments): Use lyskom-read-text-no-prefix-arg.
* lyskom-rest.el (kom-view): Use lyskom-read-text-no-prefix-arg.
* commands1.el (lyskom-add-sub-footnote): Use
lyskom-read-text-no-prefix-arg.
(lyskom-add-sub-comment): Use lyskom-read-text-no-prefix-arg.
* utilities.el (lyskom-read-text-no-prefix-arg): Check
kom-prompt-for-text-no.
* commands1.el (lyskom-add-sub-recipient): Use
lyskom-read-text-no-prefix-arg.
* vars.el.in (kom-prompt-for-text-no): New variable.
* commands1.el (kom-delete-text): Use
lyskom-read-text-no-prefix-arg.
2000-05-31 David Byers <davby@sen2.ida.liu.se>
* Release av 0.46-BETA-J
......
......@@ -5,47 +5,59 @@ Att g
* INTRESSANTA SAKER
ALLA SOM ANVÄNDER LYSKOM-READ-TEXT-NO-PREFIX-ARG MÅSTE VARA BEREDDA PÅ
ATT RESULTATET ÄR NIL, VILKET DET BLIR OM MAN INTE HAR EN PROMPT MEN
HAR DEFAULTVÄRDE PÅ TEXTNUMRET!
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 ? Alltid
Återse inlägg Inget Ja
Återse omodifierat SL Nej
Återse urinlägget SL Nej
Återse det kommenterade SL Nej
Återse det föregående kommen NSL Nej
Kommentera inlägget SL Nej
Kommentera föregående inlägg NSL Nej
Fotnot till inlägg SS ?
Personligt svar SL Nej
Personligt svar på föregåend NSL Nej
Markera (inlägg) SL ?
Avmarkera (inlägg) ? ?
Addera mottagare SL ?
Addera extra kopiemottagare SL ?
Addera för kännedom SL ?
Subtrahera mottagare SL ?
Flytta inlägg SL Ja
Addera kommentar SL ?
Subtrahera kommentar SL ?
Arkivera inlägg (till fil) SL ?
Spara inläggstext (på fil) SL ?
Sätt loginmeddelande SS Ja
Kort replik SL Nej
Hålla med SL Nej
Addera FAQ SS Ja
Addera fotnot SS ?
Subtrahera fotnot SS ?
Förhindra kommentarer SS ?
Begär personligt svar SS ?
Begär läsbekräftelse SS ?
Återse brevhuvud SL Ja
-* Radera inlägg SL Alltid
-* Återse inlägg Inget Ja
-* Återse omodifierat SL Nej
* Återse urinlägget SL Nej
* Återse alla kommentarer SL Nej
* Återse alla kommentarer reku SL Nej
* Återse träd SL Nej
* Återse det kommenterade SL Nej
* Återse det föregående kommen NSL Nej
* Kommentera inlägget SL Nej
* Kommentera föregående inlägg NSL Nej
* Fotnot till inlägg SS Ja
* Personligt svar SL Nej
* 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
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
* Förhindra kommentarer SS Ja
* Begär personligt svar SS Ja
* Begär läsbekräftelse SS Ja
* Återse brevhuvud SL Nej
------------------------------------------------------
SL Senast lästa
NSL Näst senast lästa
SS Senast skrivna/eget läst
* Klart
- Hanterar kanske inte returvärde nil
X Borde inte vara med på listan
Bestäm vettig default och om kommandot skall fråga efter nummer eller
bara anta default om man inte ger prefixargument.
......
......@@ -111,45 +111,37 @@
;;; Author: Inge Wallin
(def-kom-command kom-delete-text (text-no-arg)
(def-kom-command kom-delete-text (text-no)
"Delete a text. Argument: TEXT-NO"
(interactive "P")
(let ((text-no (cond ((null text-no-arg) 0)
((integerp text-no-arg) text-no-arg)
((listp text-no-arg) (car text-no-arg))
(t 0)))
(do-delete t))
(if (zerop text-no)
(setq text-no
(lyskom-read-number (lyskom-get-string 'what-text-to-delete)
lyskom-current-text)))
(let* ((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))))))))
(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)))))))
(lyskom-unmark-text text-no))))))
......@@ -160,30 +152,24 @@
;;; Author: Inge Wallin
(defun kom-review-presentation (&optional who)
(def-kom-command kom-review-presentation (&optional who)
"Review the presentation for a person or a conference."
(interactive)
(lyskom-start-of-command 'kom-review-presentation)
(let ((end-of-command-taken-care-of))
(unwind-protect
(let ((conf-stat
(if who
(blocking-do 'get-conf-stat who)
(lyskom-read-conf-stat
(lyskom-get-string 'presentation-for-whom)
'(all)
nil "" t))))
(if (null conf-stat)
(lyskom-insert-string 'somebody-deleted-that-conf)
(lyskom-format-insert 'review-presentation-of
conf-stat)
(if (/= (conf-stat->presentation conf-stat) 0)
(lyskom-view-text (conf-stat->presentation conf-stat))
(lyskom-format-insert 'has-no-presentation
conf-stat))))
(if end-of-command-taken-care-of
nil
(lyskom-end-of-command)))))
(let ((conf-stat
(if who
(blocking-do 'get-conf-stat who)
(lyskom-read-conf-stat
(lyskom-get-string 'presentation-for-whom)
'(all)
nil "" t))))
(if (null conf-stat)
(lyskom-insert-string 'somebody-deleted-that-conf)
(lyskom-format-insert 'review-presentation-of
conf-stat)
(if (/= (conf-stat->presentation conf-stat) 0)
(lyskom-view-text (conf-stat->presentation conf-stat))
(lyskom-format-insert 'has-no-presentation
conf-stat)))))
......@@ -193,7 +179,7 @@
;;; Author: Inge Wallin
;;; Modified by: David Kågedal, Johan Sundström
(def-kom-command kom-view-commented-text (&optional text-no)
(def-kom-command kom-view-commented-text (text-no)
"View the commented text.
If the current text is comment to (footnote to) several text then the first
text is shown and a REVIEW list is built to shown the other ones. If the
......@@ -207,18 +193,18 @@ optional arg TEXT-NO is present review the text that text commented instead."
(lyskom-insert-string 'have-to-read)))
(def-kom-command kom-view-previous-commented-text ()
(def-kom-command kom-view-previous-commented-text (text-no)
"View the text the previous text commented.
If the previously viewed text is a comment to (footnote to) several
texts then the first text is shown and a REVIEW list is built to show
the other ones."
(interactive)
(if lyskom-previous-text
(progn
(lyskom-tell-internat 'kom-tell-read)
(lyskom-view-commented-text
(blocking-do 'get-text-stat lyskom-previous-text)))
(lyskom-insert-string 'confusion-what-to-view)))
(interactive (list (lyskom-read-text-no-prefix-arg 'review-commented-q nil
lyskom-previous-text)))
(cond (text-no
(lyskom-tell-internat 'kom-tell-read)
(lyskom-view-commented-text
(blocking-do 'get-text-stat lyskom-previous-text)))
(t (lyskom-insert-string 'confusion-what-to-view))))
(defun lyskom-view-commented-text (text-stat)
"Handles the return from the initiate-get-text-stat, displays and builds list."
......@@ -758,15 +744,16 @@ This does lyskom-end-of-command"
;;; ================================================================
;;; Kommentera - write comment
;;; Author: ???
;;; FIXME: Does not use def-kom-command
(defun kom-write-comment (&optional text-no)
(defun kom-write-comment (text-no)
"Write a comment to a text.
If optional arg TEXT-NO is present write a comment to that text instead."
(interactive (list
(lyskom-read-text-no-prefix-arg 'what-comment-no)))
(let ((lyskom-current-command 'kom-write-comment))
(lyskom-read-text-no-prefix-arg 'what-comment-no))))
(lyskom-start-of-command (concat
(lyskom-command-name 'kom-write-comment)
(if text-no
......@@ -786,21 +773,19 @@ If optional arg TEXT-NO is present write a comment to that text instead."
text-stat
text
text-no)
(lyskom-write-comment-soon
text-stat
text
text-no
'comment))))
(lyskom-write-comment-soon text-stat
text
text-no
'comment))))
(lyskom-insert-string 'confusion-what-to-comment))
(lyskom-end-of-command)))
(def-kom-command kom-write-footnote (&optional text-no)
(def-kom-command kom-write-footnote (text-no)
"Write a footnote to a text.
If optional arg TEXT-NO is present write a footnote to that text instead."
(interactive (list
(lyskom-read-text-no-prefix-arg 'what-footnote-no t
'last-seen-written)))
(interactive (list (lyskom-read-text-no-prefix-arg 'what-footnote-no nil
'last-seen-written)))
(if text-no
(lyskom-write-comment-soon
(blocking-do 'get-text-stat text-no)
......@@ -809,12 +794,13 @@ If optional arg TEXT-NO is present write a footnote to that text instead."
(lyskom-insert-string 'confusion-what-to-footnote)))
(def-kom-command kom-comment-previous ()
(def-kom-command kom-comment-previous (text-no)
"Write a comment to previously viewed text."
(interactive)
(if lyskom-previous-text
(blocking-do-multiple ((text-stat (get-text-stat lyskom-previous-text))
(text (get-text lyskom-previous-text)))
(interactive (list (lyskom-read-text-no-prefix-arg 'what-comment-no nil
lyskom-previous-text)))
(if text-no
(blocking-do-multiple ((text-stat (get-text-stat text-no))
(text (get-text text-no)))
(when (or (null text-stat)
(null text)
(null (text-stat-find-aux text-stat 4))
......@@ -826,12 +812,12 @@ If optional arg TEXT-NO is present write a footnote to that text instead."
(lyskom-private-answer-soon
text-stat
text
lyskom-previous-text)
(lyskom-write-comment-soon
text-stat
text
lyskom-previous-text
'comment))))
text-no)
(lyskom-write-comment-soon
text-stat
text
text-no
'comment))))
(lyskom-insert-string 'confusion-what-to-comment)))
......@@ -1018,16 +1004,17 @@ that text instead."
;;; Author: ceder
;;; Rewritten using blocking-do by: Linus Tolke
(def-kom-command kom-private-answer-previous ()
(def-kom-command kom-private-answer-previous (text-no)
"Write a private answer to previously viewed text."
(interactive)
(if lyskom-previous-text
(blocking-do-multiple ((text-stat (get-text-stat lyskom-previous-text))
(text (get-text lyskom-previous-text)))
(interactive (list (lyskom-read-text-no-prefix-arg 'what-private-no nil
lyskom-previous-text)))
(if text-no
(blocking-do-multiple ((text-stat (get-text-stat text-no))
(text (get-text text-no)))
(when (or (null (text-stat-find-aux text-stat 4))
(lyskom-j-or-n-p
(lyskom-get-string 'no-comments-q)))
(lyskom-private-answer-soon text-stat text lyskom-previous-text)))
(lyskom-private-answer-soon text-stat text text-no)))
(lyskom-insert-string 'confusion-who-to-reply-to)))
......@@ -1562,13 +1549,17 @@ If you are not member in the conference it will be flagged with an asterisk."
(def-kom-command kom-mark-text (&optional text-no)
"Mark the text TEXT-NO."
(interactive (list (lyskom-read-text-no-prefix-arg 'text-to-mark)))
(lyskom-mark-text text-no))
(if text-no
(lyskom-mark-text text-no)
(lyskom-insert 'have-to-read)))
(def-kom-command kom-unmark-text (&optional text-no)
"Unmark the text TEXT-NO."
(interactive (list (lyskom-read-text-no-prefix-arg 'text-to-unmark)))
(lyskom-unmark-text text-no))
(if text-no
(lyskom-unmark-text text-no)
(lyskom-insert 'have-to-read)))
(defun lyskom-unmark-text (text-no)
......@@ -2975,9 +2966,12 @@ 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
(lyskom-read-number prompt
(or text-no-arg lyskom-current-text))))
(text-stat (blocking-do 'get-text-stat text-no))
(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
......@@ -3108,8 +3102,8 @@ 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 (lyskom-read-number prompt
(or text-no-arg lyskom-current-text)))
(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))
......@@ -3147,8 +3141,8 @@ 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 (lyskom-read-number prompt
(or text-no-arg lyskom-current-text)))
(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
......@@ -3175,3 +3169,4 @@ DO-ADD: NIL if a footnote should be subtracted.
;;; Local Variables:
;;; eval: (put 'lyskom-traverse 'lisp-indent-hook 2)
;;; end:
Du måste läsa ett inlägg först.
......@@ -2074,7 +2074,7 @@ Return-value: 'no-session if there is no suitable session to switch to
((listp text) (lyskom-default-agree-string
(elt text (random (length kom-agree-text)))))))
(def-kom-command kom-agree (&optional text-no)
(def-kom-command kom-agree (text-no)
"Convenience function to add agreement."
(interactive (list (lyskom-read-text-no-prefix-arg 'what-agree-no)))
(if text-no
......@@ -2107,7 +2107,7 @@ Return-value: 'no-session if there is no suitable session to switch to
(def-kom-command kom-add-faq (&optional conf-no text-no)
"Add a FAQ to a conference"
(interactive (list (lyskom-read-conf-no 'conf-to-add-faq '(conf) nil nil t)
(lyskom-read-text-no-prefix-arg 'text-to-add-as-faq t 'last-seen-written)))
(lyskom-read-text-no-prefix-arg 'text-to-add-as-faq nil 'last-seen-written)))
(let ((text (blocking-do 'get-text-stat text-no)))
(if (null text)
(lyskom-format-insert 'no-such-text-no text-no)
......@@ -2204,7 +2204,8 @@ Return-value: 'no-session if there is no suitable session to switch to
(def-kom-command kom-add-no-comments (&optional text-no)
"Add a don't comment me please aux-item to a text."
(interactive (list (lyskom-read-text-no-prefix-arg 'what-no-comments-no t)))
(interactive (list (lyskom-read-text-no-prefix-arg 'what-no-comments-no nil
'last-seen-written)))
(let ((text-stat (blocking-do 'get-text-stat text-no)))
;; Make sure there is a text there in the first place
......@@ -2241,98 +2242,105 @@ Return-value: 'no-session if there is no suitable session to switch to
(cache-del-text-stat text-no)))))))
(def-kom-command kom-add-private-answer (&optional text-no)
(def-kom-command kom-add-private-answer (text-no)
"Add a private answer only please aux-item to a text."
(interactive (list (lyskom-read-text-no-prefix-arg 'what-private-answer-no t)))
(let ((text-stat (blocking-do 'get-text-stat text-no)))
;; Make sure there is a text there in the first place
(if (null text-stat)
(lyskom-format-insert 'no-such-text-no text-no)
;; Make sure that the text doesn't already have this kind of item
;; created by the same person
(if (lyskom-match-aux-items (text-stat->aux-items text-stat)
(lambda (el)
(and (eq (aux-item->tag el) 5)
(eq (aux-item->creator el)
lyskom-pers-no))))
(lyskom-format-insert 'already-private-answer text-no)
;; If the author of the text is not the current user, ask if the
;; user wants to try anyway (it might work...)
(if (or (eq (text-stat->author text-stat) lyskom-pers-no)
(lyskom-j-or-n-p 'not-author-try-anyway-p t))
(progn (lyskom-format-insert 'adding-private-answer
text-no)
(lyskom-report-command-answer
(blocking-do 'modify-text-info
text-no
nil
(list
(lyskom-create-aux-item
0 5 nil nil
(lyskom-create-aux-item-flags
nil nil nil nil nil nil nil nil) 0 ""))))
(cache-del-text-stat text-no)))))))
(def-kom-command kom-add-request-confirm (&optional text-no)
(interactive (list (lyskom-read-text-no-prefix-arg 'what-private-answer-no nil
'last-seen-written)))
(if text-no
(let ((text-stat (blocking-do 'get-text-stat text-no)))
;; Make sure there is a text there in the first place
(if (null text-stat)
(lyskom-format-insert 'no-such-text-no text-no)
;; Make sure that the text doesn't already have this kind of item
;; created by the same person
(if (lyskom-match-aux-items (text-stat->aux-items text-stat)
(lambda (el)
(and (eq (aux-item->tag el) 5)
(eq (aux-item->creator el)
lyskom-pers-no))))
(lyskom-format-insert 'already-private-answer text-no)
;; If the author of the text is not the current user, ask if the
;; user wants to try anyway (it might work...)
(if (or (eq (text-stat->author text-stat) lyskom-pers-no)
(lyskom-j-or-n-p 'not-author-try-anyway-p t))
(progn (lyskom-format-insert 'adding-private-answer
text-no)
(lyskom-report-command-answer
(blocking-do 'modify-text-info
text-no
nil
(list
(lyskom-create-aux-item
0 5 nil nil
(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)))
(def-kom-command kom-add-request-confirm (text-no)
"Add confirmation request aux-item to a text."
(interactive (list (lyskom-read-text-no-prefix-arg
'what-request-confirm-no t)))
(let ((text-stat (blocking-do 'get-text-stat text-no)))
;; Make sure there is a text there in the first place
(if (null text-stat)
(lyskom-format-insert 'no-such-text-no text-no)
;; Make sure that the text doesn't already have this kind of item
;; created by the same person
(if (lyskom-match-aux-items (text-stat->aux-items text-stat)
(lambda (el)
(and (eq (aux-item->tag el) 6)
(eq (aux-item->creator el)
lyskom-pers-no))))
(lyskom-format-insert 'already-request-confirm text-no)
;; If the author of the text is not the current user, ask if the
;; user wants to try anyway (it might work...)
(if (or (eq (text-stat->author text-stat) lyskom-pers-no)
(lyskom-j-or-n-p 'not-author-try-anyway-p t))
(progn (lyskom-format-insert 'adding-request-confirm
text-no)
(lyskom-report-command-answer
(blocking-do 'modify-text-info
text-no
nil
(list
(lyskom-create-aux-item
0 6 nil nil
(lyskom-create-aux-item-flags
nil nil nil nil nil nil nil nil) 0 ""))))
(cache-del-text-stat text-no)))))))
(def-kom-command kom-review-mail-headers (&optional text-no)
'what-request-confirm-no nil 'last-seen-written)))
(if text-no
(let ((text-stat (blocking-do 'get-text-stat text-no)))
;; Make sure there is a text there in the first place
(if (null text-stat)
(lyskom-format-insert 'no-such-text-no text-no)
;; Make sure that the text doesn't already have this kind of item
;; created by the same person
(if (lyskom-match-aux-items (text-stat->aux-items text-stat)
(lambda (el)