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

Fixed bugs 567, 506.

More work on bug 468.
Fixed some other minor undocumented bugs.
parent def7a32c
2002-05-22 David Byers <>
More work on 468:
* commands2.el (kom-compare-texts): Use ediff-diff-program and
diff-command for the error message since ediff seems to use
ediff-diff-program, but diff-command is a good backup guess.
Fix bug 506:
* commands2.el (lyskom-display-help-item): Print key binding for
each command.
* startup.el (kom-start-anew): Set default global language
(default bindings for kom-default-language and lyskom-language) on
first login. This is usually what we want.
* commands2.el (kom-status-person): Print motd after aux-items.
Otherwise it looks really bad.
* faqs.el (lyskom-startup-check-faqs): Rewrote completely.
* commands1.el (lyskom-go-to-empty-conf): Use
lyskom-enter-conf-print-unread to print data on entry to conf.
* lyskom-rest.el (lyskom-enter-conf-print-unread): New function
prints number of unreads and unread faqs when entering a
(lyskom-enter-conf): Call it.
* faqs.el (lyskom-get-unread-faqs): New function split from
(lyskom-presend-unread-faqs): Ditto.
* commands1.el (lyskom-go-to-empty-conf): Use
Fix bug 567:
* startup.el (kom-start-anew): It seems that the forms inside an
unwind-protect were a bit off. There were several unwind-forms,
where I think there should have only been one (I know for sure
that some of the code was not intended to be an unwind-form). I
moved forms so lyskom-end-of-command is the only unwind-form.
(lyskom-refetch): Moved updating of read FAQs and rejected
invitations here.
(kom-start-anew): Moved call to lyskom-refetch to late in the
body. Thus we will not clear any caches after starting the
prefetch and we can put other forms into lyskom-refetch that rely
on lyskom-pers-no being set.
* commands2.el (kom-help): Don't allow the user to enter an empty
string for the category since this causes a failure.
(lyskom-fast-reply): Prevent creation of fast-reply aux-items that
contain line breaks or are otherwise inappropriate.
(lyskom-check-fast-reply-message): New function to define what
inappropriate is.
* utilities.el (lyskom-get-color-highlight): Handle the case of
the color parameter being nil.
......@@ -62,7 +62,7 @@
(defun lcs-check-face-schemes ()
"Check that all face schemes seem to be OK."
(lyskom-traverse scheme lyskom-face-schemes
(let ((faces (mapcar 'car (cdr scheme)))
(let ((faces (delq 'property (mapcar 'car (cdr scheme))))
(tmp nil))
(lyskom-traverse expected-face lyskom-faces
(if (setq tmp (memq expected-face faces))
......@@ -1542,15 +1542,13 @@ Args: CONF-STAT MEMBERSHIP"
(conf-stat->conf-no conf-stat))
(setq lyskom-current-conf (conf-stat->conf-no conf-stat))
(lyskom-format-insert 'conf-all-read
(lyskom-enter-conf-print-unread conf-stat 0)
(lyskom-run-hook-with-args 'lyskom-after-change-conf-hook
(conf-stat->conf-no conf-stat))
(lyskom-run-hook-with-args 'kom-after-change-conf-hook
(conf-stat->conf-no conf-stat))
(lyskom-change-conf-check-faqs conf-stat))
(conf-stat->conf-no conf-stat)))
......@@ -435,17 +435,20 @@ author of that text will be shown."
(lyskom-format-insert 'presentation
(conf-stat->presentation conf-stat))
(if (not (zerop (conf-stat->msg-of-day conf-stat)))
(lyskom-format-insert 'has-motd conf-stat)
(lyskom-view-text (conf-stat->msg-of-day conf-stat))))
;; Show aux items
(lyskom-traverse-aux item
(conf-stat->aux-items conf-stat)
(lyskom-aux-item-call item 'status-print item conf-stat))
;; Show motd
(if (not (zerop (conf-stat->msg-of-day conf-stat)))
(lyskom-format-insert 'has-motd conf-stat)
(lyskom-view-text (conf-stat->msg-of-day conf-stat))))
;; "Show all conferences CONF-STAT is a member of if the user so wishes."
(if (null (lyskom-j-or-n-p (lyskom-get-string
......@@ -2204,6 +2207,7 @@ global effect, including changes to key binding."
(defun lyskom-fast-reply (text-no message)
"To text TEXT-NO add MESSAGE as a fast reply."
(cache-del-text-stat text-no)
(if (lyskom-check-fast-reply-message message)
(blocking-do 'modify-text-info
......@@ -2211,7 +2215,13 @@ global effect, including changes to key binding."
(list (lyskom-create-aux-item 0 2 0 0
nil nil nil nil nil nil nil nil)
0 message)))))
0 message))))
(lyskom-insert 'nope)
(lyskom-insert 'fast-reply-too-long)))
(defun lyskom-check-fast-reply-message (message)
"Return non-nil if MESSAGE is a valid fast reply."
(not (string-match "\n" message)))
;;; ============================================================
......@@ -2445,16 +2455,21 @@ The variable kom-keep-alive-interval controls the frequency of the request."
(cons (lyskom-get-string (car x) 'lyskom-help-strings)
(car x)))
(category nil))
(while (null category)
(setq category
(lyskom-completing-read (lyskom-get-string 'help-with-what)
(lyskom-format-insert "Hjlp fr %#1s\n\n" (car (lyskom-string-assoc category table)))
(cdr (lyskom-string-assoc category table)))))
(lyskom-format-insert "Hjlp fr %#1s\n\n"
(car category))
(lyskom-display-help-category (cdr category))))
(defun lyskom-display-help-category (category &optional flags)
"Display help category CATEGORY."
......@@ -2473,13 +2488,25 @@ The variable kom-keep-alive-interval controls the frequency of the request."
(let ((type (elt item 0)))
(cond ((eq type 'command)
(let* ((command (elt item 1))
(command-name (lyskom-get-string command 'lyskom-command)))
(lyskom-format-insert "%#1@%[%#2s%]\n"
(keys (delq nil
(mapcar (lambda (x)
(if (and (arrayp x)
(eq (elt x 0) 'menu-bar))
(where-is-internal command))))
(command-name (lyskom-get-string command 'lyskom-command))
(heading (lyskom-format "%#1@%[%#2s%]%#3?b%[ (%#3s)%]%[%]\n"
'(face italic)
(and keys
(mapconcat 'key-description
"; ")))))
(lyskom-insert heading)
(unless (memq 'summary flags)
(lyskom-format-insert "%#1s\n%#2s\n\n"
(make-string (length command-name) ?-)
(make-string (1- (length heading)) ?-)
(lyskom-get-string command
......@@ -2521,6 +2548,7 @@ configurable variable `kom-review-marks-texts-as-read' in the current buffer."
(defvar diff-command)
(defvar ediff-diff-program)
(def-kom-command kom-compare-texts (old new)
"Show differences between text OLD and NEW.
When called interactively, it will prompt for the NEW text first,
......@@ -2544,9 +2572,9 @@ to the first text that NEW is a comment or footnote to."
(lyskom-create-text-buffer old old-text old-text-stat)
(lyskom-create-text-buffer new new-text new-text-stat))
(file-error (lyskom-error (lyskom-get-string 'external-program-missing)
(if (boundp 'diff-command)
(cond ((boundp 'ediff-diff-program) ediff-diff-program)
((boundp 'diff-command) diff-command)
(t "diff (gissningsvis)")))))))
;;; ================================================================
;;; Se diff - View diff
......@@ -370,7 +370,7 @@ and you have finished reading. Please come back later.
(who-to-remove-motd-for . "Remove notice from whom/what: ")
(conf-all-read . "%#1M - no unread texts.\n")
(conf-all-read . "no unread texts")
(no-in-conf . "You are not present in any conference.\n")
(search-for-pers . "Enter search key (RETURN for all users): ")
......@@ -1129,9 +1129,8 @@ You should set it to a better value.\n")
(all-conf-unread-r . "You have nothing unread.\n")
(all-conf-unread-s . "You have nothing unread. ")
(one-unread . "%#1M - one unread text\n")
(several-unread . "%#1M - %#2d unread texts\n")
(enter-conf . "%#1M\n")
(enter-conf-unread . "%#1d unread text%#1?d%[%]%[s%]")
(enter-conf-unread-faq . "%#1d unread FAQ%#1?d%[%]%[s%]")
(save-one-on-file-q . "Save copy of text %#1n in file: ")
(save-many-on-file-q . "Save copies of %#1d texts in file: ")
......@@ -1422,6 +1421,7 @@ On since %#8s%#9s")
(author-fast-reply-aux . " \"%#1t\"")
(other-fast-replies . "Remarks:")
(other-fast-reply-aux . " \"%#1t\" /%#2P/")
(fast-reply-too-long . "Can't create remarks that consist of more than one line.\n")
(faq-for-conf-aux . "FAQ for %#1M <%#1m>")
(faq-for-server-aux . "FAQ for the LysKOM-server")
......@@ -1442,7 +1442,8 @@ On since %#8s%#9s")
(faq-in-text . "FAQ in text %#1n %#3s%#4s")
(faq-in-text-by . "FAQ in text %#1n %#5s %#3sby %#2P %#4s")
(there-are-faqs . "You have %#1?d%[is%]%[are%] %#1d unread FAQ%#1?d%[%]%[s%] for %#2?b%[%#2M%]%[the server%]::\n")
(server-has-new-faq . "\nThere %#1?d%[is a new FAQ%]%[are %#1d new FAQs%] for the server.\n")
(unread-faqs-header . "\nUnread FAQ%#1?d%[%]%[s%] for %#2?b%[%#2M%]%[the server%]::\n")
(too-many-languages . "Cannot code that many character sets. Send uncoded? ")
(too-many-content-types . "Cannot figure out what content type you want. Simplify the text.")
......@@ -358,14 +358,18 @@ The text to add is passed in TEXT-NO"
;;; Special have-you-read-the-FAQ-checking stuff
(defun lyskom-startup-check-faqs ()
(lyskom-check-for-read-faqs 0 (server-info->aux-item-list lyskom-server-info)))
(defun lyskom-change-conf-check-faqs (conf-stat)
(lyskom-check-for-read-faqs (conf-stat->conf-no conf-stat)
(conf-stat->aux-items conf-stat)))
(let ((faq-list (lyskom-get-unread-faqs nil)))
(when faq-list
(lyskom-format-insert 'server-has-new-faq (length faq-list))
(lyskom-present-unread-faqs nil faq-list))))
(defun lyskom-check-for-read-faqs (conf-no aux-list)
(let ((faq-list
(defun lyskom-get-unread-faqs (conf-stat)
"Return a list of unread FAQs for conf CONF-STAT."
(let* ((conf-no (and conf-stat (conf-stat->conf-no conf-stat)))
(aux-list (if conf-stat
(conf-stat->aux-items conf-stat)
(server-info->aux-item-list lyskom-server-info)))
(filter-list (lambda (faq)
(not (lyskom-faq-is-read conf-no faq)))
(mapcar (lambda (aux)
......@@ -387,11 +391,16 @@ The text to add is passed in TEXT-NO"
(lyskom-wait-queue 'background)
(setq faq-list (nreverse (collector->value collector))))
(defun lyskom-present-unread-faqs (conf-stat faq-list)
"Present a list of unread FAQs in an appropriate manner."
(when faq-list
(when kom-auto-list-faqs
(lyskom-format-insert 'there-are-faqs (length faq-list) conf-no)
(lyskom-format-insert 'unread-faqs-header (length faq-list)
(and conf-stat (conf-stat->conf-no conf-stat)))
(lyskom-do-list-summary faq-list))
(when kom-auto-review-faqs
(lyskom-do-review-faq faq-list)))))
(lyskom-do-review-faq faq-list))))
......@@ -185,8 +185,10 @@ be used to get a description of the corresponding error."
(defun kom-recover (&optional refetch)
"Try to recover from an error.
If the optional argument REFETCH is non-nil, all caches are cleared and
`lyskom-refetch' is called."
(interactive "p")
`lyskom-refetch' is called. Note that when called interactively,
REFETCH is always non-nil, regardless of the prefix argument. This is
by design."
(interactive (list t))
(lyskom-init-parse lyskom-buffer)
(setq lyskom-call-data nil)
(setq lyskom-pending-calls nil)
......@@ -744,17 +746,32 @@ Args: CONF-STAT READ-INFO"
(initiate-pepsi 'main nil to-conf))
(setq lyskom-current-conf to-conf)
(let ((num-unread (text-list->length (read-info->text-list read-info))))
(lyskom-format-insert (if (not kom-print-number-of-unread-on-entrance)
(if (= num-unread 1)
(lyskom-enter-conf-print-unread conf-stat num-unread)
(lyskom-run-hook-with-args 'lyskom-after-change-conf-hook
(lyskom-change-conf-check-faqs conf-stat))
(defun lyskom-enter-conf-print-unread (conf num)
"Print information about unread (if requested) when entering a conf.
CONF is the conference and NUM is the number of unread in the conference."
(let ((faq-list (lyskom-get-unread-faqs conf)))
(lyskom-format-insert "%#1M" conf)
(when (or (eq num 0) kom-print-number-of-unread-on-entrance faq-list)
(lyskom-insert " - "))
(cond ((eq num 0)
(lyskom-format-insert 'conf-all-read conf))
(lyskom-format-insert 'enter-conf-unread num)))
(when faq-list
(when (or (eq num 0) kom-print-number-of-unread-on-entrance)
(lyskom-insert ", "))
(lyskom-format-insert 'enter-conf-unread-faq (length faq-list)))
(lyskom-format-insert ".\n")
(lyskom-present-unread-faqs conf faq-list)))
(defun lyskom-leave-current-conf ()
"Leave the current conference without going to another one."
......@@ -551,8 +551,6 @@ shown to other users."
;; fill the cache?
(let ((lyskom-who-am-i (blocking-do 'who-am-i)))
(if lyskom-who-am-i (setq lyskom-session-no lyskom-who-am-i))))
;; Start the prefetch
;; If login succeeded, clear the caches and set the language
......@@ -561,8 +559,10 @@ shown to other users."
(unless (eq lyskom-language kom-default-language)
(when (lyskom-set-language kom-default-language 'local)
(unless lyskom-have-one-login
(lyskom-set-language kom-default-language 'global))
(lyskom-set-language kom-default-language 'global)
(setq-default kom-default-language kom-default-language)
(setq-default lyskom-language kom-default-language))
(lyskom-language-name kom-default-language))))
(setq lyskom-have-one-login t))
......@@ -583,14 +583,8 @@ shown to other users."
(setq lyskom-is-new-user nil)
;; Do some FAQ handling
(condition-case nil
(progn (lyskom-update-read-faqs)
(error nil)
(quit nil))
;; Start the prefetch and update some basic caches
......@@ -628,7 +622,14 @@ This is called at login and after prioritize and set-unread."
(lyskom-traverse conf-no (nreverse (conf-no-list->conf-nos unreads))
(lyskom-prefetch-one-membership conf-no lyskom-pers-no))))
(condition-case nil
(progn (lyskom-update-read-faqs)
(error nil)
(quit nil)))
(defun lyskom-set-membership (membership)
......@@ -340,7 +340,7 @@ du har l
(who-to-remove-motd-for . "Vilket mte/person vill du ta bort lapp p drr fr (dig sjlv): ")
(conf-all-read . "%#1M - inga olsta.\n")
(conf-all-read . "inga olsta")
(no-in-conf . "Du r inte nrvarande i ngot mte.\n")
(search-for-pers . "Ange skvillkor (RETURN fr alla personer): ")
......@@ -1140,9 +1140,8 @@ Du b
(all-conf-unread-r . "Du har lst ut alla mten.\n")
(all-conf-unread-s . "Du har lst ut alla mten. ")
(one-unread . "%#1M - 1 olst\n")
(several-unread . "%#1M - %#2d olsta\n")
(enter-conf . "%#1M\n")
(enter-conf-unread . "%#1d olst%#1?d%[%]%[a%]")
(enter-conf-unread-faq . "%#1d olst%#1?d%[%]%[a%] FAQ")
(save-one-on-file-q . "Arkivera inlgg %#1n till fil: ")
(save-many-on-file-q . "Arkivera %#1d inlgg till fil: ")
......@@ -1434,6 +1433,7 @@ Uppkopplad sedan %#8s%#9s")
(author-fast-reply-aux . " \"%#1t\"")
(other-fast-replies . "Anmrkningar:")
(other-fast-reply-aux . " \"%#1t\" /%#2P/")
(fast-reply-too-long . "Kan inte skapa anmrkningar som bestr av mer n en rad.\n")
(faq-for-conf-aux . "Texten r FAQ fr %#1M <%#1m>")
(faq-for-server-aux . "Texten r FAQ fr LysKOM-servern")
......@@ -1454,7 +1454,8 @@ Uppkopplad sedan %#8s%#9s")
(faq-in-text . "FAQ i text %#1n %#3s%#4s")
(faq-in-text-by . "FAQ i text %#1n %#5s %#3sav %#2P %#4s")
(there-are-faqs . "Du har %#1d olsta%#1?d%[%]%[%] FAQ%#1?d%[%]%[er%] till %#2?b%[%#2M%]%[servern%]:\n")
(server-has-new-faq . "\nDet finns %#1d ny%#1?d%[%]%[a%] FAQ till servern.\n")
(unread-faqs-header . "\nOlst%#1?d%[%]%[a%] FAQ till %#2?b%[%#2M%]%[servern%]:\n")
(too-many-languages . "Fr mnga teckenuppsttningar fr att koda. Skicka in okodat? ")
(too-many-content-types . "Kan inte avgra innehllstyp. Frenkla inlgget.")
Supports Markdown
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