Commit 3556f983 authored by David Byers's avatar David Byers

Changed defaults for kom-add-faq and kom-write-footnote

parent 79b07b71
2000-05-04 David Byers <davby@ida.liu.se>
* commands2.el (kom-add-faq): Default text is the most recently
seen text the user wrote, or the most recently written one.
* commands1.el (kom-write-footnote): Default text is the most
recently seen text the user wrote, or the most recently written
one.
* view-text.el (lyskom-print-text): Update
lyskom-last-seen-written.
* commands2.el (kom-add-faq): Use lyskom-read-text-no-prefix-arg.
* vars.el.in (lyskom-last-seen-written): New variable.
* commands1.el (kom-write-footnote): Use
lyskom-read-text-no-prefix-arg.
* utilities.el (lyskom-read-text-no-prefix-arg): Added default
parameter.
Thu May 4 15:05:51 2000 David Byers <davby@sen2.ida.liu.se>
* Release av 0.46-BETA-I
......
......@@ -799,38 +799,15 @@ If optional arg TEXT-NO is present write a comment to that text instead."
(def-kom-command kom-write-footnote (&optional text-no)
"Write a footnote to a text.
If optional arg TEXT-NO is present write a footnote to that text instead."
(interactive)
(let ((text-stat nil))
(setq text-no
(cond ((and (null current-prefix-arg)
lyskom-current-text
(setq text-stat
(blocking-do 'get-text-stat lyskom-current-text))
(eq (text-stat->author text-stat) lyskom-pers-no))
(setq text-no lyskom-current-text))
((and (null current-prefix-arg)
lyskom-last-written
(setq text-stat
(blocking-do 'get-text-stat lyskom-last-written)))
(lyskom-read-number (lyskom-get-string 'what-footnote-no)
lyskom-last-written))
((integerp current-prefix-arg)
current-prefix-arg)
((listp current-prefix-arg)
(lyskom-read-number (lyskom-get-string 'what-footnote-no)
(lyskom-text-at-point)))
(t (signal 'lyskom-internal-error '(kom-write-footnote)))))
(interactive (list
(lyskom-read-text-no-prefix-arg 'what-footnote-no t
'last-seen-written)))
(if text-no
(lyskom-write-comment-soon
(blocking-do 'get-text-stat text-no)
(blocking-do 'get-text text-no)
text-no 'footnote)
(lyskom-insert-string 'confusion-what-to-footnote))))
(lyskom-insert-string 'confusion-what-to-footnote)))
(def-kom-command kom-comment-previous ()
......
......@@ -2038,7 +2038,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-number 'text-to-add-as-faq)))
(lyskom-read-text-no-prefix-arg 'text-to-add-as-faq t 'last-seen-written)))
(let ((text (blocking-do 'get-text-stat text-no)))
(if (null text)
(lyskom-format-insert 'no-such-text-no text-no)
......
......@@ -1666,7 +1666,7 @@ Point must be located on the line where the subject is."
;; Record the text number
(lyskom-setq-default lyskom-last-written text-no)
(lyskom-setq-default lyskom-last-seen-written text-no)
;; Select the old configuration.
......
......@@ -482,34 +482,47 @@ The value is actually the element of LIST whose car equals KEY."
;;; ============================================================
;;; Prefix arguments
(defun lyskom-read-text-no-prefix-arg (prompt &optional always-read)
(defun lyskom-read-text-no-prefix-arg (prompt &optional always-read default)
"Call in interactive list to read text-no.
If optional argument ALWAYS-READ is non-nil the user is prompted if
an explicit prefix argument was not given. A positive prefix argument
is interpreted as a text-no, whereas a negative prefix argument will
try to find the text-no of the text `arg' messages above point from
the current kom buffer."
(cond
((null current-prefix-arg)
(if always-read
(lyskom-read-number prompt lyskom-current-text)
lyskom-current-text))
((or (integerp current-prefix-arg)
(eq '- current-prefix-arg))
(let ((current-prefix-arg
(if (eq '- current-prefix-arg) -1 current-prefix-arg)))
(if (> current-prefix-arg 0)
current-prefix-arg
(save-excursion
(backward-text (- 1 current-prefix-arg))
(if (looking-at "\\([0-9]+\\)\\s-")
(string-to-int (match-string 1))
(lyskom-error (lyskom-get-string 'bad-text-no-prefix)
current-prefix-arg))))))
((listp current-prefix-arg)
(lyskom-read-number prompt (lyskom-text-at-point)))
(t (lyskom-error (lyskom-get-string 'bad-text-no-prefix)
current-prefix-arg))))
the current kom buffer. DEFAULT specifies the default text to use. If
it is nil, the most recently read text is the default. The symbol
last-written means use the text most recently written. The symbol
last-seen-written means use the text in lyskom-last-seen-written.
A number means use that text as the default."
(let ((default (cond ((numberp default) default)
((eq default 'last-written)
(or (lyskom-default-value 'lyskom-last-seen-written)
(lyskom-default-value 'lyskom-current-text)))
((eq default 'last-seen-written)
(or (lyskom-default-value 'lyskom-last-seen-written)
(lyskom-default-value 'lyskom-current-text)))
((null default)
(lyskom-default-value 'lyskom-current-text)))))
(cond
((null current-prefix-arg)
(if always-read
(lyskom-read-number prompt default)
default))
((or (integerp current-prefix-arg)
(eq '- current-prefix-arg))
(let ((current-prefix-arg
(if (eq '- current-prefix-arg) -1 current-prefix-arg)))
(if (> current-prefix-arg 0)
current-prefix-arg
(save-excursion
(backward-text (- 1 current-prefix-arg))
(if (looking-at "\\([0-9]+\\)\\s-")
(string-to-int (match-string 1))
(lyskom-error (lyskom-get-string 'bad-text-no-prefix)
current-prefix-arg))))))
((listp current-prefix-arg)
(lyskom-read-number prompt (lyskom-text-at-point)))
(t (lyskom-error (lyskom-get-string 'bad-text-no-prefix)
current-prefix-arg)))))
;;; ============================================================
;;; Set functions
......
......@@ -1692,6 +1692,13 @@ This is used by the command kom-busy-wait."
"Text-no of last text written. nil means no text written."
local)
(def-kom-var lyskom-last-seen-written nil
"Text-no of last text read or written by the current user.
When a new text is written, this is set to the text number of that text.
When a text is read that was written by the current user, this is
set to that text."
local)
(def-kom-var lyskom-previous-text nil
"Text-no of previous text. Nil means no text."
local)
......
......@@ -711,6 +711,8 @@ Args: TEXT-STAT TEXT MARK-AS-READ TEXT-NO FLAT-REVIEW."
(setq lyskom-previous-text lyskom-current-text)
(setq lyskom-current-text text-no))
(t
(when (eq (text-stat->author text-stat) lyskom-pers-no)
(setq lyskom-last-seen-written (text-stat->text-no text-stat)))
(let* ((str (text->decoded-text-mass text text-stat))
(truncated nil)
;; s1 s2 t1 t2
......
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