Commit 6b8d0e51 authored by David Kågedal's avatar David Kågedal
Browse files

Skrev om koden för fördröjda utskrifter.

parent 580b95df
Sat May 4 00:07:06 1996 David Kgedal <davidk@lysator.liu.se>
* lyskom-rest.el (lyskom-format-aux-help): Inga knappar p mte
0.
* vars.el.in (lyskom-default-conf-string): Ny variabel.
* commands1.el (kom-who-is-on): Stt lyskom-default-conf-string
lokalt.
Fri May 3 10:13:12 1996 David Byers <davby@sen2.ida.liu.se>
* english-strings.el,swedish-strings.el (lyskom-prioritize-mode-map):
......@@ -23,6 +33,54 @@ Fri May 3 10:13:12 1996 David Byers <davby@sen2.ida.liu.se>
lyskom-fetch-map-nos, kontrollera att man verkligen fr lsa
conf-mappen. (lyskom-check-review-access): Ny funktion.
Fri May 3 03:24:38 1996 David Kgedal <davidk@lysator.liu.se>
* view-text.el (lyskom-print-header-comm): Ny defer-hantering.
(lyskom-insert-deferred-header-comm): Ny funktion.
(lyskom-insert-header-comm): Detta r
lyskom-print-delayed-header-comm i ny skepnad.
* vars.el.in (kom-deferred-printing): Bytte namn frn
kom-delayed-printing.
* lyskom-rest.el (lyskom-format-insert): Ny defer-kod
(lyskom-format-insert-at-point): Dito.
(lyskom-format-aux-help): Dito.
* swedish-strings.el (lyskom-button-actions): Bytte -> .
* lyskom-rest.el (lyskom-delayed-print-conf): Tog bort.
* deferred-insert.el: Ny fil.
(lyskom-deferred-insert-conf): Ny funktion, eller snarare
lyskom-delayed-print-conf under nytt namn.
* lyskom-rest.el (lyskom-format-aux-help):
* commands2.el (lyskom-list-summary): Justerade formatering.
(lyskom-print-summary-line): Anvnd lyskom-format-insert.
* completing-read.el (lyskom-read-session-resolve-ambiguity):
Skrev om.
* lyskom-rest.el (lyskom-queue-print-name): Tog bort.
(lyskom-queue-print-name-2): Tog bort.
* swedish-strings.el (lyskom-commands): La till kommandot "Lista
klienter".
* english-strings.el (lyskom-commands): Dito.
* cache.el (lyskom-set-who-info-buffer-2): Kommenterade bort
innehllet..
(lyskom-set-session-info): Dito.
* commands1.el (lyskom-info-line-format-string): Ny funktion.
(kom-who-is-on): Skrev om med hjlp av den.
(lyskom-return-who-info-line): Tog bort.
(lyskom-fix-str): Tog bort.
(lyskom-return-who-info-line-as-state): Tog bort.
Thu May 2 18:47:18 1996 David Kgedal <davidk@lysator.liu.se>
* 0.41 release
......
......@@ -44,7 +44,7 @@ PARTS-EL = komtypes.el clienttypes.el utilities.el startup.el \
filter.el filter-edit.el lyskom-buttons.el \
view-text.el async.el completing-read.el \
prioritize.el flags.el messages.el ansaphone.el remote-control.el \
elib-string.el \
elib-string.el deferred-insert.el \
lyskom-rest.el
HEADER-EL = vars.el macros.el
HEADER-ELC = vars.elc macros.elc
......
......@@ -38,6 +38,8 @@ Buggar
Allmänna förbättringar
Återinför "Lista (med) regexpar", eller vad den nu hette.
Inläggsnumren borde vara mer kontextkänsliga. Om man klickar på
ett inläggs eget nummer, alltså det som står precis innan datumet
och det som står inom parentesen precis efter inläggstexten, så
......
......@@ -287,52 +287,54 @@ ARG: session-info"
(defun lyskom-set-who-info-buffer-2 (pers-conf-stat conf-conf-stat who-info)
"Inserts a who-buffer-info into lyskom-who-info-cache"
;We can use lyskom-insert (not beautiful)
;we insert everything at the end of the buffer.
;defensive programming and it will work:
(if (and lyskom-who-info-buffer-is-on
lyskom-who-info-buffer)
(let ((sesno lyskom-session-no)
min max
(where (cache-assoc (who-info->connection who-info)
lyskom-who-info-cache)))
(lyskom-save-excursion
(set-buffer lyskom-who-info-buffer)
(save-restriction
(if where
(progn
(narrow-to-region (marker-position
(who-buffer-info->start-marker where))
(1- (marker-position
(who-buffer-info->end-marker where))))
(delete-region (point-min) (point-max)))
(goto-char (point-max))
(insert " ")
(narrow-to-region (point-min) (1- (point-max))))
(setq min (point-max-marker))
(lyskom-print-who-info pers-conf-stat conf-conf-stat who-info sesno
(function
(lambda (string)
(insert string))))
(setq max (point-max-marker))
(goto-char (point-max)))
(delete-char 1))
(cache-add (who-info->connection who-info)
(lyskom-create-who-buffer-info who-info min max)
'lyskom-who-info-cache)
(run-hooks 'lyskom-who-info-has-changed-hook))))
;; ;We can use lyskom-insert (not beautiful)
;; ;we insert everything at the end of the buffer.
;; ;defensive programming and it will work:
;; (if (and lyskom-who-info-buffer-is-on
;; lyskom-who-info-buffer)
;; (let ((sesno lyskom-session-no)
;; min max
;; (where (cache-assoc (who-info->connection who-info)
;; lyskom-who-info-cache)))
;; (lyskom-save-excursion
;; (set-buffer lyskom-who-info-buffer)
;; (save-restriction
;; (if where
;; (progn
;; (narrow-to-region (marker-position
;; (who-buffer-info->start-marker where))
;; (1- (marker-position
;; (who-buffer-info->end-marker where))))
;; (delete-region (point-min) (point-max)))
;; (goto-char (point-max))
;; (insert " ")
;; (narrow-to-region (point-min) (1- (point-max))))
;; (setq min (point-max-marker))
;; (lyskom-print-who-info pers-conf-stat conf-conf-stat who-info sesno
;; (function
;; (lambda (string)
;; (insert string))))
;; (setq max (point-max-marker))
;; (goto-char (point-max)))
;; (delete-char 1))
;; (cache-add (who-info->connection who-info)
;; (lyskom-create-who-buffer-info who-info min max)
;; 'lyskom-who-info-cache)
;; (run-hooks 'lyskom-who-info-has-changed-hook)))
)
(defun lyskom-set-session-info (pers-conf-stat conf-conf-stat session-info)
"Inserts a session-info into lyskom-who-info-cache"
(lyskom-set-who-info-buffer-2 pers-conf-stat conf-conf-stat
(lyskom-create-who-info
(session-info->pers-no session-info)
(session-info->working-conf session-info)
(session-info->connection session-info)
(session-info->doing session-info)
(session-info->username session-info))))
;;; (lyskom-set-who-info-buffer-2 pers-conf-stat conf-conf-stat
;;; (lyskom-create-who-info
;;; (session-info->pers-no session-info)
;;; (session-info->working-conf session-info)
;;; (session-info->connection session-info)
;;; (session-info->doing session-info)
;;; (session-info->username session-info)))
)
;;; ================================================================
......
......@@ -1455,37 +1455,93 @@ If MARK-NO == 0, review all marked texts."
;;; Vilka ({r inloggade) - Who is on?
;;; Author: ???
;;; Rewritten by: David K}gedal
(def-kom-command kom-who-is-on ()
"Display a list of all connected users."
(interactive)
(let ((who-info-list (blocking-do 'who-is-on)))
(lyskom-insert
(lyskom-return-who-info-line " "
(lyskom-get-string 'lyskom-name)
(lyskom-get-string 'is-in-conf)))
(let ((who-info-list (blocking-do 'who-is-on))
(format-string-1 (lyskom-info-line-format-string 7 "P" "M"))
(format-string-2 (lyskom-info-line-format-string 7 "s" "s"))
(lyskom-default-conf-string 'not-present-anywhere))
(lyskom-format-insert format-string-2
" "
(lyskom-get-string 'lyskom-name)
(lyskom-get-string 'is-in-conf))
(if kom-show-where-and-what
(lyskom-insert
(lyskom-return-who-info-line " "
(lyskom-get-string 'from-machine)
(lyskom-get-string 'is-doing))))
(lyskom-format-insert format-string-2
" "
(lyskom-get-string 'from-machine)
(lyskom-get-string 'is-doing)))
(lyskom-insert
(concat (make-string (- (lyskom-window-width) 2) ?-) "\n"))
(let* ((who-list (sort (listify-vector who-info-list)
(function (lambda (who1 who2)
(< (who-info->connection who1)
(who-info->connection who2))))))
(total-users (length who-list)))
(while who-list
(let* ((who-info (car who-list))
(session-no (format "%5d" (who-info->connection who-info)))
(my-session (if (= lyskom-session-no
(who-info->connection who-info))
"*"
" ")))
(lyskom-format-insert
format-string-1
(concat session-no my-session)
(who-info->pers-no who-info)
(or (who-info->working-conf who-info)
(lyskom-get-string 'not-present-anywhere)))
(if kom-show-where-and-what
(lyskom-format-insert
format-string-2
" "
(lyskom-return-username who-info)
(concat "(" (who-info->doing-what who-info) ")"))))
(setq who-list (cdr who-list)))
(lyskom-insert (concat (make-string (- (lyskom-window-width) 2) ?-)
"\n"))
(lyskom-insert (lyskom-format 'total-users total-users)))))
(def-kom-command kom-list-clients ()
"Display a list of all connected users."
(interactive)
(let ((who-info-list (blocking-do 'who-is-on))
(format-string (lyskom-info-line-format-string 7 "P" "s")))
(lyskom-format-insert format-string
" "
(lyskom-get-string 'lyskom-name)
(lyskom-get-string 'lyskom-client))
(lyskom-insert
(concat (make-string (- (lyskom-window-width) 2) ?-) "\n"))
(let* ((who-list (sort (append who-info-list nil)
(let* ((who-list (sort (listify-vector who-info-list)
(function (lambda (who1 who2)
(< (who-info->connection who1)
(who-info->connection who2))))))
(total-users (length who-list)))
(while who-list
(let ((who-info (car who-list)))
(lyskom-print-who-info
(let* ((who-info (car who-list))
(session-no (format "%5d" (who-info->connection who-info)))
(my-session (if (= lyskom-session-no
(who-info->connection who-info))
"*"
" ")))
(lyskom-format-insert
format-string
(concat session-no my-session)
(blocking-do 'get-conf-stat (who-info->pers-no who-info))
(blocking-do 'get-conf-stat (who-info->working-conf who-info))
who-info
lyskom-session-no))
(blocking-do-multiple
((name (get-client-name (who-info->connection who-info)))
(version (get-client-version (who-info->connection who-info))))
(concat name " " version))))
(setq who-list (cdr who-list)))
(lyskom-insert (concat (make-string (- (lyskom-window-width) 2) ?-)
......@@ -1493,89 +1549,20 @@ If MARK-NO == 0, review all marked texts."
(lyskom-insert (lyskom-format 'total-users total-users)))))
(defun lyskom-print-who-info (conf-stat working who-info my-session-no
&optional insert-function)
"Print a line about a user.
Args: CONF-STAT WORKING WHO-INFO MY-SESSION-NO &optional INSERT-FUNCTION.
CONF-STAT refer to the user.
WORKING is the conf-stat of his current working conference.
WHO-INFO is the who-info.
MY-SESSION-NO is the session number of the running session.
&optional INSERT-FUNCTION is the function for inserting the text into
the buffer. If nil, use lyskom-insert."
(let ((insertfun (if insert-function
insert-function
'lyskom-insert)))
(funcall insertfun
(lyskom-return-who-info-line-as-state
(format "%5d%s"
(who-info->connection who-info)
(if (= my-session-no (who-info->connection who-info))
"*"
" "))
conf-stat
(cond
((conf-stat->name working) working)
(t (lyskom-get-string 'not-present-anywhere)))))
(if kom-show-where-and-what
(funcall insertfun
(lyskom-return-who-info-line-as-state
" "
(lyskom-return-username who-info)
(concat "("
(who-info->doing-what who-info)
")"))))))
(defun lyskom-fix-str (len str)
"Pad STR with space to LEN. Args: LEN STR."
(while (< (length str) len)
(setq str
(concat str
" ")))
(substring str 0 len))
(defun lyskom-return-who-info-line-as-state (prefix arg1 arg2)
"Return the format state appropriate for the arguments and
the window width."
(let* ((adj1 (+ (length prefix) 2))
(adj2 (+ adj1 1))
(formatstring
(concat prefix
"%=-"
(int-to-string (/ (* 37 (- (lyskom-window-width) adj1)) 73))
(if (lyskom-conf-stat-p arg1)
(if (conf-type->letterbox
(conf-stat->conf-type arg1))
"#1P"
"#1M")
"#1s")
" %=-"
(int-to-string (/ (* 37 (- (lyskom-window-width) adj2)) 73))
(if (lyskom-conf-stat-p arg2)
(if (conf-type->letterbox
(conf-stat->conf-type arg2))
"#2P"
"#2M")
"#2s")
"\n")))
(lyskom-format formatstring arg1 arg2)))
(defun lyskom-return-who-info-line (prefix string1 string2)
"Return a formatted line (with reference to the current window width."
(let ((line (concat
prefix
(lyskom-fix-str (/ (* 37 (- (lyskom-window-width) 7)) 73)
string1)
" "
(lyskom-fix-str (/ (* 36 (- (lyskom-window-width) 7)) 73)
string2))))
(while (string= (substring line -1) " ")
(setq line (substring line 0 -1)))
(concat line "\n")))
(defun lyskom-info-line-format-string (prefixlen type1 type2)
"Return a format string suitable for inserting who-info lines etc."
(let* ((plen (or prefixlen 7))
(adj1 (+ plen 2))
(adj2 (+ adj1 1)))
(concat "%" (int-to-string plen) "#1s"
"%=-"
(int-to-string (/ (* 37 (- (lyskom-window-width) adj1)) 73))
"#2" type1
" %=-"
(int-to-string (/ (* 37 (- (lyskom-window-width) adj2)) 73))
"#3" type2
"\n")))
(defun lyskom-window-width ()
"Returns the width of the lyskom-window or the screen-width if not displayed."
......
......@@ -719,26 +719,27 @@ on one line."
"List a summary of the texts in TEXTS.
The summary contains the date, number of lines, author and subject of the text
on one line."
(let ((time (blocking-do 'get-time)))
;; Start fetching all text-stats and text to list them.
(lyskom-insert (format "%-8s%-6s%5s%s%s\n"
(lyskom-get-string 'Texts)
(lyskom-get-string 'Date)
(lyskom-get-string 'Lines)
(lyskom-fix-str (/ (- (lyskom-window-width) 21)
3)
(lyskom-get-string 'Author))
(lyskom-get-string 'Subject)))
(lyskom-traverse
text-no texts
(let ((text-stat (blocking-do 'get-text-stat text-no))
(text (blocking-do 'get-text text-no))
;; We could do som optimization here.
;; We really don't need the whole text.
)
(lyskom-print-summary-line text-stat text text-no
(time->year time) (time->yday time))))))
(let ((time (blocking-do 'get-time))
(author-width (/ (- (lyskom-window-width) 22) 3)))
;; Start fetching all text-stats and text to list them.
(lyskom-format-insert (concat "%-8#1s%-6#2s%-4#3s %-"
(int-to-string author-width)
"#4s %#5s\n")
(lyskom-get-string 'Texts)
(lyskom-get-string 'Date)
(lyskom-get-string 'Lines)
(lyskom-get-string 'Author)
(lyskom-get-string 'Subject))
(lyskom-traverse
text-no texts
(let ((text-stat (blocking-do 'get-text-stat text-no))
(text (blocking-do 'get-text text-no))
;; We could do som optimization here.
;; We really don't need the whole text.
)
(lyskom-print-summary-line text-stat text text-no
(time->year time) (time->yday time))))))
(defun lyskom-print-summary-line (text-stat text text-no year day)
......@@ -765,33 +766,20 @@ Format is 23:29 if the text is written today. Otherwise 04-01."
;; We split the rest between author and subject
(namelen (/ (- (lyskom-window-width) 22) 3))
(subjlen (/ (* (- (lyskom-window-width) 22) 2) 3))
(author-name (lyskom-format "%#1:P" (text-stat->author text-stat))))
(lyskom-format-insert 'summary-line
(author-name (lyskom-format "%#1:P" (text-stat->author text-stat)))
(format-string (concat "%=-8#1n%#2s%4#3d %=-"
(int-to-string namelen)
"#4P %[%#5@%=-"
(int-to-string subjlen)
"#6r%]\n")))
(lyskom-format-insert format-string
text-no
time
lines
(lyskom-default-button 'conf
(text-stat->author
text-stat))
(lyskom-fix-str namelen author-name)
(text-stat->author text-stat)
(lyskom-default-button 'text
text-no)
(lyskom-fix-str subjlen subject))
;;; (lyskom-insert (lyskom-fix-str 7 (format "%d" text-no)))
;;; (lyskom-insert time)
;;; (lyskom-insert (format "%4d " lines))
;;; (lyskom-halt 'main)
;;; ;;; +++ Should be a function that only takes number
;;; (lyskom-queue-print-name-2
;;; (blocking-do 'get-conf-stat (text-stat->author text-stat))
;;; (text-stat->author text-stat)
;;; t namelen)
;;;
;;; (lyskom-insert (concat " "
;;; (lyskom-fix-str subjlen subject)
;;; "\n"))
)))
subject))))
......
......@@ -462,64 +462,66 @@ If ONLY-ONE is non-nil only one session number will be returned."
(defun lyskom-read-session-resolve-ambiguity (sessions)
(lyskom-insert "\n")
(lyskom-insert
(lyskom-return-who-info-line
" "
(lyskom-get-string 'lyskom-name)
(lyskom-get-string 'is-in-conf)))
(lyskom-insert
(lyskom-return-who-info-line
" "
(lyskom-get-string 'from-machine)
(lyskom-get-string 'is-doing)))
(lyskom-insert
(concat (make-string (- (lyskom-window-width) 2) ?-)
"\n"))
(let ((result nil)
(who-info
(mapcar (function
(lambda (el)
(let* ((info (blocking-do 'get-session-info el))
(persconfstat
(blocking-do 'get-conf-stat
(session-info->pers-no info)))
(confconfstat
(blocking-do 'get-conf-stat
(session-info->working-conf info))))
(lyskom-insert
(lyskom-return-who-info-line-as-state
(format "%4d%s"
(session-info->connection info)
(if (eq (session-info->connection info)
lyskom-session-no)
"*" " "))
(blocking-do 'get-conf-stat
(session-info->pers-no info))
(if (conf-stat->name confconfstat)
confconfstat
(lyskom-get-string 'not-present-anywhere))))
(lyskom-insert
(lyskom-return-who-info-line-as-state
" "
(lyskom-return-username info)
(concat "("
(session-info->doing info)
")")))
(cons (number-to-string (session-info->connection info))
info))))
(sort sessions '<))))
(lyskom-insert (concat (make-string (- (lyskom-window-width) 2) ?-) "\n"))
(lyskom-insert (lyskom-format 'total-users (length who-info)))
(lyskom-scroll)
(while (string= ""
(setq result (completing-read
(lyskom-get-string 'resolve-session)
who-info
nil
t
(car (car who-info))
nil))))
(list (session-info->connection (cdr (assoc result who-info))))))
(let ((format-string-s (lyskom-info-line-format-string 7 "s" "s"))
(format-string-p (lyskom-info-line-format-string 7 "P" "M")))
(lyskom-format-insert format-string-s
" "
(lyskom-get-string 'lyskom-name)
(lyskom-get-string 'is-in-conf))
(lyskom-format-insert format-string-s
" "
(lyskom-get-string 'from-machine)
(lyskom-get-string 'is-doing))
(lyskom-insert
(concat (make-string (- (lyskom-window-width) 2) ?-)
"\n"))
(let ((result nil)
(who-info
(mapcar (function
(lambda (el)
(let* ((info (blocking-do 'get-session-info el))
(persconfstat
(blocking-do 'get-conf-stat
(session-info->pers-no info)))
(confconfstat
(blocking-do 'get-conf-stat
(session-info->working-conf info))))
(lyskom-format-insert
format-string-p
(format "%4d%s"
(session-info->connection info)
(if (eq (session-info->connection info)
lyskom-session-no)
"*" " "))
(blocking-do 'get-conf-stat
(session-info->pers-no info))
(if (conf-stat->name confconfstat)
confconfstat
(lyskom-get-string 'not-present-anywhere)))
(lyskom-format-insert
format-string-p
" "
(lyskom-return-username info)
(concat "("
(session-info->doing info)
")"))
(cons (number-to-string
(session-info->connection info))
info))))
(sort sessions '<))))
(lyskom-insert (concat (make-string (- (lyskom-window-width) 2) ?-)
"\n"))
(lyskom-insert (lyskom-format 'total-users (length who-info)))
(lyskom-scroll)
(while (string= ""
(setq result (completing-read
(lyskom-get-string 'resolve-session)
who-info
nil
t
(car (car who-info))
nil))))
(list (session-info->connection (cdr (assoc result who-info)))))))
......