Commit 96805a83 authored by David Byers's avatar David Byers
Browse files

New features:

    kom-review-stack prints more inforamtion
    kom-list-news takes a new prefix argument
    kom-who-is-on prints a timestamp
    kom-change-auto-reply offers the last message as editable default
    Commenting functions offer the text point is in as default when
        called with a simple (single C-u) prefix argument.

Internal features:
    Predicates in format strings.

Fixes:
    Name reading recognizes exact matches more often.
    Several string fixes (plural endings, bad speling.)
    The client can be loaded many times in the same Emacs.
parent 9bf233ef
1999-06-25 David Byers <davby@ida.liu.se>
* review.el (kom-review-stack): Print information about all kinds
of things on the stack, not just review commands.
* completing-read.el (lyskom-completing-strip-name): New function.
(lyskom-completing-member): Ignore parens.
* lyskom-rest.el: lyskom-format has capability to use embedded
predicates. Wohoo!
* utilities.el (lyskom-client-date-string): New function.
* lyskom-rest.el (lyskom-current-text): New function.
1999-06-24 David Byers <davby@ida.liu.se>
* lyskom-rest.el (lyskom-insert-string): Allow literal strings in
calls to lyskom-insert-string.
1999-06-23 David Byers <davby@ida.liu.se>
* english-strings.el: Synched up with Swedish.
......
......@@ -476,7 +476,9 @@ bilder f
Skriv ihop hantera medlemskap (prioritize-new.el.) Den skall
utnyttja den nya medlemskapsstrukturen.
Implementera anonyma medlemskap i klienten.
Implementera anonyma medlemskap i klienten. Detta är inte långt
ifrån klart. Vi har hemliga medlemskap och behöver bara en hook
att bli anonym när man går in i mötet.
Implementera re-z-lookup med re-lookup-X så att vi kan återinföra
maximal kompatibilitet.
......@@ -606,12 +608,16 @@ Naturligtvis b
vad för meddelande man vill ha, med det förra meddelandet som
default. Typ: Meddelande ("Lunch") ? _
Klart.
- Det vore kul om man kunde påverka lista nyheter så den listar möten
med mer än foo olästa. Då kunde man ju kunna skriva C-u 0 ln för att
få se alla möten. Varför? För att status person är plågsamt långsamt
(jag förmodar att det frågar lyskomservern i stället för att glo i
sin egen cache).
Klart.
......@@ -684,6 +690,8 @@ f
matchar mig exakt, men bara halvdant på den andra personen. Är det en
bra eller dålig idé?
Klart.
......@@ -703,6 +711,8 @@ Internal Lyskom format error.: lyskom-format, ": argument error"
Inget mera ploppar ut som resultat.
Antagligen klart. Vem vet.
......@@ -1115,6 +1125,7 @@ f
dvs information om det kommentarsträd jag just håller på att läsa.
KLART.
......@@ -1166,7 +1177,7 @@ efter att jag loggat in. D
>
> Jag förstår inte vems inlägg du vill
> skriva ett privat svar till.
Klart
......
......@@ -59,7 +59,9 @@
(interactive)
(let ((message (or message
(read-from-minibuffer
(lyskom-get-string 'ansaphone-new-message))))
(lyskom-get-string 'ansaphone-new-message)
(if (stringp kom-ansaphone-default-reply)
(cons kom-ansaphone-default-reply 0)))))
(lyskom-last-text-format-flags nil))
(setq kom-ansaphone-default-reply message)
(lyskom-format-insert (lyskom-get-string-sol 'ansaphone-message)
......
......@@ -140,15 +140,10 @@
(if is-marked-by-me
(if (= num-marks 1)
(lyskom-get-string 'delete-marked-by-you)
(if (= num-marks 2)
(lyskom-get-string
'marked-by-you-and-one)
(lyskom-format 'delete-marked-by-you-and-several
(1- num-marks))))
(if (= num-marks 1)
(lyskom-get-string 'delete-marked-by-one)
(lyskom-format 'delete-marked-by-you-and-others
(1- num-marks)))
(lyskom-format 'delete-marked-by-several
num-marks)))))))))
num-marks))))))))
(when do-delete
(lyskom-format-insert 'deleting-text text-no)
(when (lyskom-report-command-answer
......@@ -687,7 +682,8 @@ If optional arg TEXT-NO is present write a comment to that text instead."
((null current-prefix-arg) lyskom-current-text)
((integerp current-prefix-arg) current-prefix-arg)
((listp current-prefix-arg)
(lyskom-read-number (lyskom-get-string 'what-comment-no)))
(lyskom-read-number (lyskom-get-string 'what-comment-no)
(lyskom-text-at-point)))
(t (signal 'lyskom-internal-error '(kom-write-comment))))))
(lyskom-start-of-command (concat
(lyskom-command-name 'kom-write-comment)
......@@ -741,7 +737,8 @@ If optional arg TEXT-NO is present write a footnote to that text instead."
current-prefix-arg)
((listp current-prefix-arg)
(lyskom-read-number (lyskom-get-string 'what-footnote-no)))
(lyskom-read-number (lyskom-get-string 'what-footnote-no)
(lyskom-text-at-point)))
(t (signal 'lyskom-internal-error '(kom-write-footnote)))))
......@@ -923,7 +920,8 @@ that text instead."
((null current-prefix-arg) lyskom-current-text)
((integerp current-prefix-arg) current-prefix-arg)
((listp current-prefix-arg)
(lyskom-read-number (lyskom-get-string 'what-private-no)))
(lyskom-read-number (lyskom-get-string 'what-private-no)
(lyskom-text-at-point)))
(t (signal 'lyskom-internal-error '(kom-private-answer))))))
(if text-no
(blocking-do-multiple ((text-stat (get-text-stat text-no))
......@@ -2235,7 +2233,9 @@ Uses Protocol A version 8 calls"
(lyskom-insert (concat (make-string (- (lyskom-window-width) 2) ?-)
"\n"))
(lyskom-insert (lyskom-format 'total-visible-users total-users))))
(lyskom-insert (lyskom-format 'total-visible-users total-users
(lyskom-client-date-string
'time-format-exact)))))
(defun lyskom-who-is-on-9 (arg &optional conf-stat)
......@@ -2395,7 +2395,8 @@ Uses Protocol A version 9 calls"
'total-visible-users)
(t
'total-visible-active-users))
total-users))))
total-users
(lyskom-client-date-string 'time-format-exact)))))
(defun lyskom-who-is-on-check-membership-8 (who-info-list conf-stat)
"Returns a list of those in WHO-INFO-LIST which is member in CONF-STAT."
......
......@@ -717,41 +717,47 @@ send. If DONTSHOW is non-nil, don't display the sent message."
(sit-for 0)
(lyskom-prefetch-all-confs))
(let ((num-arg (cond
(let* ((num-arg (cond
((numberp num) num)
((and (listp num)
(numberp (car num))) (car num))
(t nil)))
(sum 0))
(sum 0)
(mship-confs (and (numberp num-arg)
(< num-arg 1)
(mapcar 'membership->conf-no lyskom-membership)))
(nconfs 0))
(when num-arg
(lyskom-format-insert 'list-unread-with-n-unread num-arg))
(mapcar
(function
(lambda (info)
(let ((un (length (cdr (read-info->text-list info))))
(name (conf-stat->name (read-info->conf-stat info)))
(conf-stat (read-info->conf-stat info)))
(setq mship-confs (delq (conf-stat->conf-no conf-stat) mship-confs))
(cond
((eq (read-info->type info) 'CONF)
(if (or (not num-arg)
(>= (-- num-arg) 0))
(>= un num-arg))
(lyskom-insert
(if (and (boundp 'lyskom-special-conf-name)
(stringp lyskom-special-conf-name)
(string-match lyskom-special-conf-name name))
(if (/= un 1)
(lyskom-format 'you-have-unreads-special un conf-stat)
(lyskom-format 'you-have-an-unread-special conf-stat))
(if (/= un 1)
(lyskom-format 'you-have-unreads un conf-stat)
(lyskom-format 'you-have-an-unread conf-stat)))))
(setq sum (+ sum un)))))))
(lyskom-format 'you-have-unreads un conf-stat))))
(setq sum (+ sum un)
nconfs (1+ nconfs)))))))
(read-list->all-entries lyskom-to-do-list))
(mapcar
(lambda (conf-no)
(lyskom-format-insert 'you-have-no-unreads conf-no))
mship-confs)
(if (= 0 sum)
(lyskom-insert-string 'you-have-read-everything)
(lyskom-insert
(if (/= sum 1)
(lyskom-format 'total-unreads
sum)
(format (lyskom-get-string 'total-unread)))))))
(lyskom-format-insert 'total-unreads sum nconfs))))
;;; ================================================================
......
......@@ -496,18 +496,28 @@ function work as a name-to-conf-stat translator."
candidate-list)
(list string))))))))))))
(defun lyskom-completing-member (string list)
"Check case-insensitively if STRING is a member of LIST"
(let (result)
(let ((string (lyskom-unicase (lyskom-completing-strip-name string)))
(result nil))
(while (and list (not result))
(if (string= (lyskom-unicase string) (lyskom-unicase (car list)))
(if (string= string (lyskom-unicase
(lyskom-completing-strip-name (car list))))
(setq result list)
(setq list (cdr list))))
result))
(defun lyskom-completing-strip-name (string)
"Strip parens and crap from a name"
(while (string-match "([^()]*)" string)
(setq string (replace-match " " t t string)))
(while (string-match "\\s-\\s-+" string)
(setq string (replace-match " " t t string)))
(if (string-match "^\\s-*\\(.*\\S-\\)\\s-*$" string)
(match-string 1 string)
string))
(defun lyskom-read-conf-internal-verify-type (conf-no
conf-type
predicate
......
......@@ -215,6 +215,8 @@ local-hook A hook variable that is made local in LysKOM buffers."
(setq arglist (cdr arglist)))
(` (progn (dont-compile (if (and (boundp (quote (, name)))
(or (not (boundp lyskom-is-loaded))
(not lyskom-is-loaded))
(listp kom-dont-read-saved-variables))
(add-to-list 'kom-dont-read-saved-variables
(quote (, name)))))
......
......@@ -399,6 +399,7 @@ and you have finished reading. Please come back later.
(weekdays . ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday"
"Friday" "Saturday" "Sunday"])
(weekdays-short . ["Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun"])
(time-is . "The time is %#1s %#2s(according to the server).")
(time-format-exact . "%#7s %4#1d-%02#2d-%02#3d %02#4d:%02#5d:%02#6d")
......@@ -412,11 +413,11 @@ On this day, in 1973, the Lysator Academic Computer Society was
formed, and it was a great day in the history of computing in Sweden.
Read all about it at http://www.lysator.liu.se/history/")
(total-users . " A total of %#1d users.\n")
(total-visible-users . " A total of %#1d visible users.\n")
(total-active-users . " A total of %#1d active users.\n")
(total-users . " A total of %#1d users (%#2s.)\n")
(total-visible-users . " A total of %#1d visible users (%#2s.)\n")
(total-active-users . " A total of %#1d active users (%#2s.)\n")
(total-visible-active-users
. " A total of %#1d visible active users.\n")
. " A total of %#1d visible active users (%#2s.)\n")
(who-to-add-q . "Add who/what as a recipient? ")
(who-to-add-copy-q . "Add which conference/user as recipient of a carbon copy? ")
(who-to-sub-q . "Remove who/what as a recipient? ")
......@@ -587,6 +588,7 @@ The message you were sending to %#1M was:
(you-have-read-everything . "No news (is bad news).\n")
(total-unreads . "\nYou have %#1d unread articles.\n")
(total-unread . "\nYou have 1 unread article.\n")
(list-unread-with-n-unread . "Listing conferences with at least %#1d unread.\n")
(waiting-for-anything .
"You are waiting for an article in any conference.\n")
(waiting-higher-than .
......
......@@ -887,12 +887,14 @@ Args: FORMAT-STRING &rest ARGS"
(defvar lyskom-format-format
"%\\(=\\)?\\(-?[0-9]+\\)?\\(#\\([0-9]+\\)\\)?\\(:\\)?\\(&\\)?\\([][@MmPpnrtsdoxcCSDF]\\)"
"%\\(=\\)?\\(-?[0-9]+\\)?\\(#\\([0-9]+\\)\\)?\\(:\\)?\\(&\\)?\\([][@MmPpnrtsdoxcCSDF?]\\)"
"regexp matching format string parts.")
(defun lyskom-insert-string (atom)
"Find the string corresponding to ATOM and insert it into the LysKOM buffer."
(lyskom-insert (lyskom-get-string atom)))
(if (stringp atom)
(lyskom-insert atom)
(lyskom-insert (lyskom-get-string atom))))
(defun lyskom-format (format-string &rest argl)
(format-state->result (lyskom-do-format format-string argl)))
......@@ -1050,6 +1052,7 @@ Note that it is not allowed to use deferred insertions in the text."
(format-state->format-string
format-state)))))
;;
;; If the format letter is an end-of-group letter, abort
;; formatting and return to the caller.
......@@ -1197,6 +1200,42 @@ Note that it is not allowed to use deferred insertions in the text."
(setq format-state (lyskom-format-aux format-state allow-defer)
result nil))
;; A predicate
;; Get the predicate type and then parse the format string
;; accordingly
((= format-letter ?\?)
(unless (string-match "[db]"
(format-state->format-string format-state)
(format-state->start format-state))
(lyskom-error "Unknown predicate in format string %s (%d)"
(format-state->format-string format-state)
(format-state->start format-state)))
(set-format-state->start format-state (match-end 0))
(let ((predicate-type (elt (match-string 0
(format-state->format-string format-state))
0)))
(cond
;; Plural/singular predicate
;; arg is an integer. Use the first subformat if it is one
;; and the second if it is other than one.
((= predicate-type ?d)
(setq format-state
(lyskom-format-do-binary-predicate (= arg 1)
format-state
allow-defer)
result nil))
;; True/false predicate
((= predicate-type ?b)
(setq format-state
(lyskom-format-do-binary-predicate arg
format-state
allow-defer)
result nil))
)))
((= format-letter ?F)
(setq result
(if (lyskom-conf-stat-p arg)
......@@ -1457,6 +1496,60 @@ Note that it is not allowed to use deferred insertions in the text."
format-state)
(defun lyskom-format-do-binary-predicate (option format-state allow-defer)
(cond (option
(setq format-state
(lyskom-format-enter-subformat format-state allow-defer))
(lyskom-format-skip-subformat format-state))
(t
(lyskom-format-skip-subformat format-state)
(setq format-state
(lyskom-format-enter-subformat format-state allow-defer))
))
format-state)
(defun lyskom-format-enter-subformat (format-state allow-defer)
"The format string should be just before a subformat. Enter it."
(unless (string-match "%\\["
(format-state->format-string format-state)
(format-state->start format-state))
(lyskom-error "Predicate syntax error in format string %s (%d)"
(format-state->format-string format-state)
(format-state->start format-state)))
(set-format-state->start format-state (match-end 0))
(lyskom-format-aux format-state allow-defer))
(defun lyskom-format-skip-subformat (format-state)
"Skip the subformat specification at the start of format-state"
;; Check that it looks like a subformat in the first place
(unless (string-match "%\\["
(format-state->format-string format-state)
(format-state->start format-state))
(lyskom-error "Predicate syntax error in format string %s (%d)"
(format-state->format-string format-state)
(format-state->start format-state)))
(set-format-state->start format-state (match-end 0))
;; We are now inside the start of the subformat
(let ((level 1))
(while (> level 0)
(setq tmp (substring (format-state->format-string format-state)
(format-state->start format-state)))
(if (null (string-match "\\(%\\[\\|%\\]\\)"
(format-state->format-string format-state)
(format-state->start format-state)))
(lyskom-error "Bad nesting in format string %s (%d)"
(format-state->format-string format-state)
(format-state->start format-state))
(let ((ch (elt (match-string
1 (format-state->format-string format-state)) 1)))
(cond ((= ?\[ ch) (setq level (1+ level)))
(t (setq level (1- level))))
(set-format-state->start format-state (match-end 0)))))))
(defun lyskom-tweak-format-state (format-state)
......@@ -2028,6 +2121,18 @@ A symbol other than t means call it as a function."
;;; Author: Linus
(defun lyskom-text-at-point ()
"Return the text that point is in, or nil it is impossible to determine."
(save-excursion
(let ((paragraph-start lyskom-text-start)
(paragraph-ignore-fill-prefix t))
(end-of-line)
(backward-paragraph 1))
(beginning-of-line)
(and (looking-at "[0-9]+")
(string-to-int (match-string 0)))))
(defun backward-text (&optional arg)
"Searches backwards for a text start and recenters with that text at the top."
(interactive "p")
......@@ -3128,24 +3233,15 @@ One parameter - the prompt string."
(format "LysKOM(%s)" server))))
;;; Validation of kom-tell-phrases
;;;
;;; Author: Roger Mikael Adolfsson
;;; This code removed (lyskom-tell-phrases-validate)
;;
(lyskom-set-language lyskom-language)
;; Build the menus
;; (lyskom-build-menus)
(if lyskom-is-loaded
nil
(or (memq 'lyskom-unread-mode-line global-mode-string)
(lyskom-set-language lyskom-language)
(or (memq 'lyskom-unread-mode-line global-mode-string)
(setq global-mode-string
(append '("" lyskom-unread-mode-line) global-mode-string)))
(setq lyskom-unread-mode-line
(setq lyskom-unread-mode-line
(list (list 'lyskom-sessions-with-unread
(lyskom-get-string 'mode-line-unread))
(list 'lyskom-sessions-with-unread-letters
......@@ -3158,9 +3254,7 @@ One parameter - the prompt string."
;;; loaded.
;;;
(setq lyskom-line-start-chars
;; (if (fboundp 'string-to-vector)
;; (string-to-vector lyskom-line-start-chars-string)
(setq lyskom-line-start-chars
(let ((tmp (make-vector 256 nil)))
(mapcar
(function
......@@ -3168,53 +3262,29 @@ One parameter - the prompt string."
(aset tmp (char-to-int x) t)))
lyskom-line-start-chars-string)
tmp))
;;)
;;; Formely lyskom-swascii-commands
;;(lyskom-define-language 'lyskom-command 'swascii
;; (mapcar
;; (function (lambda (pair)
;; (cons (car pair) (iso-8859-1-to-swascii (cdr pair)))))
;; (lyskom-get-strings lyskom-commands 'lyskom-command)))
;;(setq lyskom-swascii-header-separator
;; (iso-8859-1-to-swascii lyskom-header-separator))
;;(setq lyskom-swascii-header-subject
;; (iso-8859-1-to-swascii lyskom-header-subject))
;;(setq lyskom-swascii-filter-actions
;; (mapcar
;; (function (lambda (pair)
;; (cons (car pair) (iso-8859-1-to-swascii (cdr pair)))))
;; lyskom-filter-actions))
;;(setq lyskom-swascii-filter-what
;; (mapcar
;; (function (lambda (pair)
;; (cons (car pair) (iso-8859-1-to-swascii (cdr pair)))))
;; lyskom-filter-what))
;; Setup the queue priorities
(lyskom-set-queue-priority 'blocking 9)
(lyskom-set-queue-priority 'main 9)
(lyskom-set-queue-priority 'sending 9)
(lyskom-set-queue-priority 'follow 9)
(lyskom-set-queue-priority 'options 9)
(lyskom-set-queue-priority 'deferred 6)
(lyskom-set-queue-priority 'background 6)
(lyskom-set-queue-priority 'modeline 6)
(lyskom-set-queue-priority 'async 3)
(lyskom-set-queue-priority 'prefetch 0)
(run-hooks 'lyskom-after-load-hook)
(setq lyskom-is-loaded t))
;; Setup the queue priorities
(lyskom-set-queue-priority 'blocking 9)
(lyskom-set-queue-priority 'main 9)
(lyskom-set-queue-priority 'sending 9)
(lyskom-set-queue-priority 'follow 9)
(lyskom-set-queue-priority 'options 9)
(lyskom-set-queue-priority 'deferred 6)
(lyskom-set-queue-priority 'background 6)
(lyskom-set-queue-priority 'modeline 6)
(lyskom-set-queue-priority 'async 3)
(lyskom-set-queue-priority 'prefetch 0)
(provide 'lyskoom-rest)
(provide 'lyskom-rest)
;;; This should be the very last lines of lyskom.el Everything should
;;; be loaded now, so it's time to run the lyskom-after-load-hook.
(run-hooks 'lyskom-after-load-hook)
(lyskom-end-of-compilation)
......
......@@ -1152,23 +1152,30 @@ end."
(def-kom-command kom-review-stack ()
"Displays the review-stack."
(interactive)
(if (read-list->all-entries lyskom-reading-list)
(mapcar
(function
(lambda (info)
(let ((un (length (cdr (read-info->text-list info))))
(type (read-info->type info))
(cto (read-info->comm-to info)))
(cto (read-info->comm-to info))
(conf (read-info->conf-stat info)))
(cond
((eq type 'COMM-IN)
(lyskom-format-insert 'view-many-comments cto un))
((eq type 'CONF)
(lyskom-format-insert 'view-texts-in-conf un conf))
((eq type 'REVIEW)
(lyskom-format-insert 'review-n-texts un))
((eq type 'REVIEW-TREE)
; +++ Hmmm. Pluralformer. Besv{rligt!
(if (= un 1)
(lyskom-format-insert 'review-one-comment cto)
(lyskom-format-insert 'review-many-comments cto un)))
(lyskom-format-insert 'review-many-comments cto un))
((eq type 'REVIEW-MARK)
(lyskom-format-insert 'review-marked un))))))
(read-list->all-entries lyskom-reading-list)))
(read-list->all-entries lyskom-reading-list))
(cond (lyskom-current-conf
(lyskom-format-insert 'you-have-no-unreads lyskom-current-conf))
(lyskom-insert 'not-reading-anywhere))))
;;; ================================================================
......
......@@ -215,10 +215,8 @@ Guran vill helst s
(what-text-to-delete . "Vilket inlgg skall tas bort? ")
(delete-marked-text . "Inlgget r %#1s. Ta bort nd? ")
(delete-marked-by-you . "markerat av dig")
(delete-marked-by-you-and-one . "markerat av dig och ngon annan")
(delete-marked-by-you-and-several . "markerat av dig och %#1d andra")
(delete-marked-by-one . "markerat av 1 person")
(delete-marked-by-several . "markerat av %#1d personer")
(delete-marked-by-you-and-others . "markerad av dig och %#1?d%[ngon annan%]%[%#1d andra%]")
(delete-marked-by-several . "markerat av %#1d person%#1?d%[%]%[er%]")
(deleting-text . "Radering av text %#1:n...")
(presentation-for-whom . "Vilket mte/person? ")
......@@ -268,8 +266,7 @@ Skicka ett brev till %#2P f
(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-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? ")
......@@ -384,7 +381,7 @@ du har l
; (northward . "norrut")
; (southward . "sderut")
; (permanent-sundown . "Solen kommer inte att g upp. Flytta %#1s!")
; (permanent-sunup . "Solen kommer inte att g ned. Fytta %#1s!")
; (permanent-sunup . "Solen kommer inte att g ned. Flytta %#1s!")
; (sunup-soon . "Solen gr snart upp")
; (sundown-recently . "Solen gick nyligen ned")
; (after-sunset . "Solen har gtt ned")
......@@ -393,6 +390,7 @@ du har l