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

Förbättrade defer-koden

parent b86bf578
Sun May 5 03:18:19 1996 David Kgedal <davidk@lysator.liu.se>
* Makefile (PARTS-EL): Flyttade deferred-insert.el till HEADER-EL.
* deferred-insert.el (lyskom-replace-deferred): Nytt makro.
(lyskom-deferred-insert-conf): Skrev om med makrot.
* view-text.el (lyskom-insert-deferred-header-comm): Dito.
* commands1.el (kom-list-clients): Anpassa bredden p
sessionsfltet.
* view-text.el (lyskom-view-text): Skicka bara mtesnummer till
lyskom-print-header-recpt.
(lyskom-print-header-recpt): Frdrj utskrifter.
* completing-read.el (lyskom-read-session-resolve-ambiguity):
Anpassa bredden p sessionsnumret och tillt lite defer.
* commands2.el (kom-status-conf): Tillt defer. Formateringen
ndrades lite ocks.
(kom-status-person): Dito.
* commands1.el (kom-who-is-on): Anpassar bredden p frsta fltet
s att sessionsnumret precis fr plats.
(kom-list-clients): Tillt defer.
* lyskom-rest.el (kom-view-next-text): Lsmarkera texter efter att
de har skrivits ut. Frhoppningsvis fr detta inga otrevliga
bieffekter.
Sat May 4 00:07:06 1996 David Kgedal <davidk@lysator.liu.se>
* view-text.el (lyskom-insert-header-comm): Ta insert-funktionen
......
......@@ -37,22 +37,24 @@ EMACS=emacs
EMACS-BATCH = $(EMACS) -batch
# NOTE: lyskom-rest.el must be the last file in PARTS-EL and SRC-ELC.
PARTS-EL = komtypes.el clienttypes.el utilities.el startup.el \
PARTS-EL = komtypes.el clienttypes.el deferred-insert.el utilities.el \
startup.el \
reading.el \
internal.el parse.el services.el cache.el\
commands1.el commands2.el review.el edit-text.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 deferred-insert.el \
elib-string.el \
lyskom-rest.el
HEADER-EL = vars.el macros.el
HEADER-ELC = vars.elc macros.elc
HEADER-ELC = vars.elc macros.elc deferred-insert.elc
SWEDISH-EL = swedish-strings.el
SWEDISH-ELC = swedish-strings.elc
ENGLISH-EL = english-strings.el
ENGLISH-ELC = english-strings.elc
SRC-ELC = komtypes.elc clienttypes.elc utilities.elc startup.elc \
SRC-ELC = komtypes.elc clienttypes.elc deferred-insert.elc utilities.elc \
startup.elc \
reading.elc \
internal.elc parse.elc services.elc cache.elc\
commands1.elc commands2.elc review.elc edit-text.elc \
......
......@@ -169,10 +169,10 @@ this function shall be with current-buffer the BUFFER."
(set-buffer buffer)
(if (zerop recipient)
(initiate-get-conf-stat 'async
'lyskom-handle-personal-message
sender
0
message)
'lyskom-handle-personal-message
sender
0
message)
(lyskom-collect 'async)
(initiate-get-conf-stat 'async nil sender)
(initiate-get-conf-stat 'async nil recipient)
......
......@@ -1481,92 +1481,100 @@ If MARK-NO == 0, review all marked texts."
(def-kom-command kom-who-is-on ()
"Display a list of all connected users."
(interactive)
(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))
(let* ((who-info-list (blocking-do 'who-is-on))
(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))
(session-width (1+ (length (int-to-string
(who-info->connection
(nth (1- total-users) who-list))))))
(format-string-1 (lyskom-info-line-format-string
session-width "P" "M"))
(format-string-2 (lyskom-info-line-format-string
session-width "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-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)))
(while who-list
(let* ((who-info (car who-list))
(session-no (int-to-string (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)))))
(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")))
(let* ((who-info-list (blocking-do 'who-is-on))
(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))
(s-width (1+ (length (int-to-string
(who-info->connection
(nth (1- total-users) who-list))))))
(format-string (lyskom-info-line-format-string s-width "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 (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
(concat session-no my-session)
(blocking-do 'get-conf-stat (who-info->pers-no who-info))
(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) ?-)
"\n"))
(lyskom-insert (lyskom-format 'total-users total-users)))))
(while who-list
(let* ((who-info (car who-list))
(session-no (int-to-string (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)
(who-info->pers-no who-info)
(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) ?-)
"\n"))
(lyskom-insert (lyskom-format 'total-users total-users))))
......
......@@ -147,10 +147,7 @@ otherwise: the conference is read with lyskom-completing-read."
(if pro (lyskom-get-string 'closed) "")
")"))
(t ""))))
(let ((creator (or (blocking-do 'get-conf-stat
(conf-stat->creator conf-stat))
(conf-stat->creator conf-stat))))
(let ((creator (conf-stat->creator conf-stat)))
(lyskom-format-insert 'created-by
creator
creator
......@@ -177,10 +174,7 @@ otherwise: the conference is read with lyskom-completing-read."
(conf-stat->last-written conf-stat)))
(lyskom-format-insert 'no-of-motd
(conf-stat->msg-of-day conf-stat))
(let ((superconf
(or (blocking-do 'get-conf-stat
(conf-stat->super-conf conf-stat))
(conf-stat->super-conf conf-stat))))
(let ((superconf (conf-stat->super-conf conf-stat)))
(lyskom-format-insert 'superconf-is-no-name
superconf
superconf
......@@ -190,40 +184,18 @@ otherwise: the conference is read with lyskom-completing-read."
(- (lyskom-window-width) 46)))
"\n"
"")))
(let ((permitted-submitters
(or (blocking-do 'get-conf-stat
(conf-stat->permitted-submitters conf-stat))
(conf-stat->permitted-submitters conf-stat))))
(let ((permitted-submitters (conf-stat->permitted-submitters conf-stat)))
(lyskom-format-insert 'permitted-submitters-no-name
permitted-submitters
(if (zerop (conf-stat->permitted-submitters
conf-stat))
(lyskom-get-string 'Everybody)
permitted-submitters)
(cond
((zerop (conf-stat->permitted-submitters
conf-stat))
"")
((lyskom-conf-stat-p permitted-submitters)
(if (> (length
(conf-stat->name
permitted-submitters))
(- (lyskom-window-width) 46))
"\n"
""))
(t permitted-submitters))))
(let ((supervisor (or (blocking-do 'get-conf-stat
(conf-stat->supervisor conf-stat))
(conf-stat->supervisor conf-stat))))
(if (zerop permitted-submitters)
(lyskom-get-string 'Everybody)
permitted-submitters)
""))
(let ((supervisor (conf-stat->supervisor conf-stat)))
(lyskom-format-insert 'supervisor-is-no-name
supervisor
supervisor
(if (and
(lyskom-conf-stat-p supervisor)
(> (length (conf-stat->name supervisor))
(- (lyskom-window-width) 46)))
"\n"
"")))
""))
(lyskom-format-insert 'presentation-no
(conf-stat->presentation conf-stat))
......@@ -343,34 +315,17 @@ otherwise: the conference is read with lyskom-completing-read."
(lyskom-return-date-and-time
(conf-stat->last-written conf-stat)))
(let ((superconf
(or (blocking-do 'get-conf-stat
(conf-stat->super-conf conf-stat))
(conf-stat->super-conf conf-stat))))
(let ((superconf (conf-stat->super-conf conf-stat)))
(lyskom-format-insert 'superconf
superconf
superconf
(if (and
(lyskom-conf-stat-p superconf)
(> (length (conf-stat->name superconf))
(- (lyskom-window-width) 46)))
"\n"
"")))
""))
(if (not (zerop (conf-stat->supervisor conf-stat)))
(let ((supervisor
(or (blocking-do 'get-conf-stat
(conf-stat->supervisor conf-stat))
(conf-stat->supervisor conf-stat))))
(let ((supervisor (conf-stat->supervisor conf-stat)))
(lyskom-format-insert 'supervisor
supervisor
supervisor
(if (and
(lyskom-conf-stat-p supervisor)
(> (length (conf-stat->name
supervisor))
(- (lyskom-window-width) 46)))
"\n"
""))))
"")))
(lyskom-format-insert 'member-of-confs
(pers-stat->no-of-confs pers-stat))
(lyskom-format-insert 'presentation
......
......@@ -462,14 +462,18 @@ If ONLY-ONE is non-nil only one session number will be returned."
(defun lyskom-read-session-resolve-ambiguity (sessions)
(lyskom-insert "\n")
(let ((format-string-s (lyskom-info-line-format-string 7 "s" "s"))
(format-string-p (lyskom-info-line-format-string 7 "P" "M")))
(let* ((s-width (1+ (apply 'max (mapcar (function
(lambda (x)
(length (int-to-string x))))
sessions))))
(format-string-s (lyskom-info-line-format-string s-width "s" "s"))
(format-string-p (lyskom-info-line-format-string s-width "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
......@@ -480,27 +484,23 @@ If ONLY-ONE is non-nil only one session number will be returned."
(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)))
(format "%d%s"
(session-info->connection info)
(if (eq (session-info->connection info)
lyskom-session-no)
"*" " "))
(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)
......
......@@ -114,26 +114,55 @@ The insertion will be at (point)."
(defer-info->call-par defer-info)
defer-info))
(defmacro lyskom-replace-deferred (defer-info &rest body)
"Replace some defered text."
(append (list 'save-excursion
(list 'goto-char (list 'defer-info->pos defer-info)))
body
(list
(list 'let (list (list 'inhibit-read-only t))
(list 'delete-char (list 'defer-info->del-chars defer-info)))
(list 'set-marker (list 'defer-info->pos defer-info) nil))))
(put 'lyskom-replace-deferred 'edebug-form-spec '(eval body))
(put 'lyskom-replace-deferred 'lisp-indent-function 1)
(defun lyskom-deferred-insert-conf (conf-stat defer-info)
"Insert the name of a conference at a previously reserved place."
(save-excursion
(goto-char (defer-info->pos defer-info))
(if (null conf-stat)
(lyskom-format-insert-at-point
(defer-info->format defer-info)
(lyskom-format
(or (defer-info->data defer-info)
(if (conf-type->letterbox (conf-stat->conf-type conf-stat))
(if (= (defer-info->call-par defer-info) 0)
'person-is-anonymous
'person-does-not-exist)
'conference-does-not-exist))
(defer-info->call-par defer-info)))
(lyskom-format-insert-at-point (defer-info->format defer-info)
conf-stat))
(let ((inhibit-read-only t))
(delete-char (defer-info->del-chars defer-info)))
(set-marker (defer-info->pos defer-info) nil)))
(lyskom-replace-deferred defer-info
(if (null conf-stat)
(lyskom-format-insert-at-point
(defer-info->format defer-info)
(lyskom-format
(or (defer-info->data defer-info)
(if (conf-type->letterbox (conf-stat->conf-type conf-stat))
(if (= (defer-info->call-par defer-info) 0)
'person-is-anonymous
'person-does-not-exist)
'conference-does-not-exist))
(defer-info->call-par defer-info)))
(lyskom-format-insert-at-point (defer-info->format defer-info)
conf-stat))))
;;;(defun lyskom-deferred-insert-conf (conf-stat defer-info)
;;; "Insert the name of a conference at a previously reserved place."
;;; (save-excursion
;;; (goto-char (defer-info->pos defer-info))
;;; (if (null conf-stat)
;;; (lyskom-format-insert-at-point
;;; (defer-info->format defer-info)
;;; (lyskom-format
;;; (or (defer-info->data defer-info)
;;; (if (conf-type->letterbox (conf-stat->conf-type conf-stat))
;;; (if (= (defer-info->call-par defer-info) 0)
;;; 'person-is-anonymous
;;; 'person-does-not-exist)
;;; 'conference-does-not-exist))
;;; (defer-info->call-par defer-info)))
;;; (lyskom-format-insert-at-point (defer-info->format defer-info)
;;; conf-stat))
;;; (let ((inhibit-read-only t))
;;; (delete-char (defer-info->del-chars defer-info)))
;;; (set-marker (defer-info->pos defer-info) nil)))
......@@ -541,16 +541,16 @@ the current text"
(lyskom-end-of-command))
(let ((conf-stat (blocking-do 'get-conf-stat lyskom-current-conf)))
(if conf-stat
(progn
(lyskom-add-filter
(make-filter
(list (cons 'subject lyskom-current-subject)
(cons 'recipient-no (conf-stat->conf-no conf-stat)))
(list (cons 'action 'skip-tree)
(cons 'expire t))))
(lyskom-format-insert 'super-jump
(copy-sequence lyskom-current-subject)
conf-stat)))))))
(progn
(lyskom-add-filter
(make-filter
(list (cons 'subject lyskom-current-subject)
(cons 'recipient-no (conf-stat->conf-no conf-stat)))
(list (cons 'action 'skip-tree)
(cons 'expire t))))
(lyskom-format-insert 'super-jump
(copy-sequence lyskom-current-subject)
conf-stat)))))))
......
No preview for this file type
......@@ -123,9 +123,7 @@ Note that this function must not be called asynchronously."
((or (eq type 'RECPT)
(eq type 'CC-RECPT))
(lyskom-print-header-recpt
(blocking-do 'get-conf-stat
(misc-info->recipient-no
misc))
(misc-info->recipient-no misc)
misc))
((eq type 'COMM-IN)
(if kom-reading-puts-comments-in-pointers-last
......@@ -404,23 +402,26 @@ the client. That is done by lyskom-is-read."
(list (misc-info->local-no misc-info)))))))
(defun lyskom-print-header-recpt (conf-stat misc)
(defun lyskom-print-header-recpt (conf-no misc)
"Print a line of info about a recipient (or cc-recipient) of a text."
(lyskom-format-insert "%#1s: %#2M <%#3d>\n"
(cond ((eq (misc-info->type misc) 'RECPT)
(lyskom-get-string 'Recipient))
(t (lyskom-get-string 'Extra-recipient)))
conf-stat
conf-no
(misc-info->local-no misc))
(if (misc-info->sent-at misc)
(lyskom-format-insert 'send-at
(lyskom-return-date-and-time
(misc-info->sent-at misc))))
(if (misc-info->sender misc)
(lyskom-insert (lyskom-format 'sent-by (misc-info->sender misc))))
(lyskom-format-insert 'sent-by (misc-info->sender misc)))
(if (misc-info->rec-time misc)
(lyskom-format-insert 'recieved-at
(lyskom-return-date-and-time (misc-info->rec-time misc)))))
(lyskom-format-insert
'recieved-at
(lyskom-return-date-and-time (misc-info->rec-time misc)))))
(defun lyskom-view-text-handle-saved-comments (text-stat)
......@@ -460,13 +461,9 @@ Args: TEXT-STAT of the text being read."
(defun lyskom-insert-deferred-header-comm (text-stat defer-info)
(save-excursion
(goto-char (defer-info->pos defer-info))
(lyskom-replace-deferred defer-info
(lyskom-insert-header-comm text-stat (defer-info->data defer-info)
'lyskom-format-insert-at-point)
(let ((inhibit-read-only t))
(delete-char (defer-info->del-chars defer-info)))
(set-marker (defer-info->pos defer-info) nil)))
'lyskom-format-insert-at-point)))
......
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