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

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