Commit 49396a29 authored by David Byers's avatar David Byers
Browse files

Fixed bugs in commands1.el, view-text.el. Moved macro from services.el to macros.el.

parent dbae90e2
......@@ -351,13 +351,13 @@ Returns t if it was possible, otherwise nil."
(lyskom-format 'where-on-list-q
(length lyskom-membership))))))))
(lyskom-insert (if (= (conf-stat->conf-no pers-conf-stat)
lyskom-pers-no)
(lyskom-format 'member-in-conf
(conf-stat->name conf-conf-stat))
(lyskom-format 'add-member-in
(conf-stat->name pers-conf-stat)
(conf-stat->name conf-conf-stat))))
(if (= (conf-stat->conf-no pers-conf-stat)
lyskom-pers-no)
(lyskom-format-insert 'member-in-conf
(conf-stat->name conf-conf-stat))
(lyskom-format-insert 'add-member-in
(conf-stat->name pers-conf-stat)
(conf-stat->name conf-conf-stat)))
(blocking-do 'add-member
(conf-stat->conf-no conf-conf-stat)
(conf-stat->conf-no pers-conf-stat)
......@@ -505,13 +505,13 @@ user so instead."
(lyskom-insert-string 'error-fetching-conf)
(lyskom-end-of-command))
(t
(lyskom-insert (if (= (conf-stat->conf-no pers-conf-stat)
lyskom-pers-no)
(lyskom-format 'unsubscribe-to
(conf-stat->name conf-conf-stat))
(lyskom-format 'exclude-from
(conf-stat->name pers-conf-stat)
(conf-stat->name conf-conf-stat))))
(if (= (conf-stat->conf-no pers-conf-stat)
lyskom-pers-no)
(lyskom-format-insert 'unsubscribe-to
(conf-stat->name conf-conf-stat))
(lyskom-format-insert 'exclude-from
(conf-stat->name pers-conf-stat)
(conf-stat->name conf-conf-stat)))
(initiate-sub-member 'main 'lyskom-sub-member-answer
(conf-stat->conf-no conf-conf-stat)
(conf-stat->conf-no pers-conf-stat)
......@@ -1345,10 +1345,9 @@ MARK: A number that is used as the mark."
(or kom-default-mark
(lyskom-read-num-range
1 255 (lyskom-get-string 'what-mark) t))))
(lyskom-insert (if (equal mark 0)
(lyskom-format 'unmarking-textno text-no)
(lyskom-format 'marking-textno text-no)))
(if (equal mark 0)
(lyskom-format-insert 'unmarking-textno text-no)
(lyskom-format-insert 'marking-textno text-no))
(if (blocking-do 'mark-text text-no mark)
(progn
......@@ -1814,10 +1813,9 @@ DO-ADD: NIL if a comment should be subtracted.
(if (= text-no lyskom-current-text)
nil
lyskom-current-text)))
(lyskom-insert
(if do-add
(lyskom-format 'add-comment-to comment-text-no text-no)
(lyskom-format 'sub-comment-to comment-text-no text-no)))
(lyskom-format-insert 'add-comment-to comment-text-no text-no)
(lyskom-format-insert 'sub-comment-to comment-text-no text-no))
(if do-add
(initiate-add-comment 'main
'lyskom-handle-command-answer
......
......@@ -87,6 +87,52 @@ Value returned is always nil."
(list 'setq var (list '1- var)))
;; Multiple blocking read from server
(defvar lyskom-multiple-blocking-return nil
"Return from blocking-do-multiple")
(defun lyskom-blocking-do-multiple (call-list)
(let ((lyskom-multiple-blocking-return 'not-yet-gotten))
(lyskom-collect 'blocking)
(while call-list
(apply (intern-soft (concat "initiate-"
(symbol-name (car (car call-list)))))
'blocking nil
(cdr (car call-list)))
(setq call-list (cdr call-list)))
(lyskom-use 'blocking 'lyskom-blocking-do-multiple-1)
(while (eq lyskom-multiple-blocking-return 'not-yet-gotten)
(accept-process-output))
lyskom-multiple-blocking-return))
(defun lyskom-blocking-do-multiple-1 (&rest data)
(setq lyskom-multiple-blocking-return data))
(defmacro blocking-do-multiple (bind-list &rest body)
"Bind variables according to BIND-LIST and then eval BODY.
The value of the last form in BODY is returned.
Each element in BIND-LIST is a list (SYMBOL FORM) which binds SYMBOL to
the result of the server call FORM, which is the same as used in blocking-do.
All the forms in BIND-LIST are evaluated before and symbols are bound."
(let ((bindsym 'multiple-bind-sym)
(index 0))
(` (let (((, bindsym)
(lyskom-blocking-do-multiple
(list (,@ (mapcar (function (lambda (x)
(` (list '(, (car (car (cdr x))))
(,@ (cdr (car (cdr x))))))))
bind-list))))))
(let ((,@ (mapcar (function
(lambda (bpat)
(prog1
(` ((, (car bpat))
(elt (, bindsym) (, index))))
(setq index (1+ index)))))
bind-list)))
(,@ body))))))
;;; Local Variables:
;;; eval: (put 'lyskom-traverse 'lisp-indent-hook 2)
;;; end:
......@@ -659,49 +659,3 @@ or get-text-stat."
lyskom-blocking-return)))
;; Multiple blocking read from server
(defvar lyskom-multiple-blocking-return nil
"Return from blocking-do-multiple")
(defun lyskom-blocking-do-multiple (call-list)
(let ((lyskom-blocking-return 'not-yet-gotten))
(lyskom-collect 'blocking)
(while call-list
(apply (intern-soft (concat "initiate-"
(symbol-name (car (car call-list)))))
'blocking nil
(cdr (car call-list)))
(setq call-list (cdr call-list)))
(lyskom-use 'blocking 'lyskom-blocking-do-multiple-1)
(while (eq lyskom-multiple-blocking-return 'not-yet-gotten)
(accept-process-output))
lyskom-multiple-blocking-return))
(defun lyskom-blocking-do-multiple-1 (&rest data)
(setq lyskom-multiple-blocking-return data))
(defmacro blocking-do-multiple (bind-list &rest body)
"Bind variables according to BIND-LIST and then eval BODY.
The value of the last form in BODY is returned.
Each element in BIND-LIST is a list (SYMBOL FORM) which binds SYMBOL to
the result of the server call FORM, which is the same as used in blocking-do.
All the forms in BIND-LIST are evaluated before and symbols are bound."
(let ((bindsym 'multiple-bind-sym)
(index 0))
(` (let (((, bindsym)
(lyskom-blocking-do-multiple
(list (,@ (mapcar (function (lambda (x)
(` (list '(, (car (car (cdr x))))
(,@ (cdr (car (cdr x))))))))
bind-list))))))
(let ((,@ (mapcar (function
(lambda (bpat)
(prog1
(` ((, (car bpat))
(elt (, bindsym) (, index))))
(setq index (1+ index)))))
bind-list)))
(,@ body))))))
......@@ -53,16 +53,19 @@ lyskom-reading-list to read the comments to this."
(let ((filter (and filter-active
(lyskom-filter-text-p text-no))))
(cond ((eq filter 'skip-text) (lyskom-filter-prompt text-no 'filter-text)
(setq filter 'next-text)
'next-text)
((eq filter 'skip-tree)
(lyskom-filter-prompt text-no 'filter-tree)
(initiate-get-text-stat 'main 'lyskom-jump text-no t)
(setq filter 'next-text)
'next-text)
(t
(if (not (or (null filter)
(eq filter 'dontshow)))
(lyskom-message "%s" (lyskom-get-string 'invalid-filter-list)))
(if (eq filter 'dontshow)
(setq filter 'next-text))
(blocking-do-multiple ((text-stat (get-text-stat text-no))
(text (get-text text-no)))
(if (and text-stat
......@@ -145,8 +148,8 @@ lyskom-reading-list to read the comments to this."
(lyskom-follow-comments text-stat conf-stat mark-as-read
priority build-review-tree))
)
(lyskom-format-insert 'no-such-text text-no))))))
nil)
(lyskom-format-insert 'no-such-text text-no)))))
filter))
(defun lyskom-insert-person-name (conf-no)
......
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