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

Diverse småfixar.

parent f5c8e116
......@@ -115,6 +115,7 @@ this function shall be with current-buffer the BUFFER."
kom-presence-messages)
(lyskom-message "%s" (lyskom-get-string 'database-sync)))
(setq mode-line-process (lyskom-get-string 'mode-line-saving))
(setq lyskom-is-saving t)
(set-buffer-modified-p (buffer-modified-p))
(sit-for 0)
(if (not lyskom-pending-calls)
......
......@@ -493,7 +493,7 @@ otherwise: the conference is read with lyskom-completing-read."
(t
(if lyskom-last-personal-message-sender
(if (string-match "^19" emacs-version)
(cons lyskom-last-personal-messsage-sender 0)
(cons lyskom-last-personal-message-sender 0)
lyskom-last-personal-message-sender)
"")))))
message))
......
......@@ -593,9 +593,9 @@ use. Please leave and return later if you are just waiting
for an article.
===========================================================\n")
(has-entered . "%#1:P has entered LysKOM.")
(has-entered-r . "%#1P has entered LysKOM.\n")
(has-entered-r . "%#2@%#1P has entered LysKOM.\n")
(has-left . "%#1:P has left LysKOM.")
(has-left-r . "%#1P has left LysKOM.\n")
(has-left-r . "%#2@%#1P has left LysKOM.\n")
(unknown . "unknown")
(message-broadcast .
......
No preview for this file type
......@@ -135,7 +135,7 @@ Value returned is always nil."
"Decrement the variable VAR and return the value."
(list 'setq var (list '1- var)))
(defmacro when (expr body)
(defmacro when (expr &rest body)
"Execute BODY if EXPR evaluates to non-nil"
(list 'if expr (cons 'progn body)))
......@@ -203,6 +203,7 @@ All the forms in BIND-LIST are evaluated before and symbols are bound."
(put 'blocking-do-multiple 'edebug-form-spec
'(sexp body))
(put 'blocking-do-multiple 'lisp-indent-function 1)
;;; Local Variables:
;;; eval: (put 'lyskom-traverse 'lisp-indent-hook 2)
......
......@@ -804,7 +804,7 @@ lyskom-parse-success, lyskom-parse-error and lyskom-parse-async calls
functions and variables that are connected with the lyskom-buffer."
(let ((lyskom-buffer (current-buffer))
(match-data (match-data)))
;; I wonder what happens if I remove this? /davidk
;; The old code /davidk
;; (if (and mode-line-process
;; (not (equal mode-line-process '(": %s"))))
;; (progn
......@@ -814,6 +814,17 @@ functions and variables that are connected with the lyskom-buffer."
;; (message ""))
;; (set-buffer-modified-p (buffer-modified-p))
;; (sit-for 0)))
;; Was the server saving?
(if lyskom-is-saving
(progn
(setq mode-line-process (lyskom-get-string
(if lyskom-executing-command
'mode-line-working
'mode-line-waiting))
lyskom-is-saving nil)
(if (and (not (lyskom-is-in-minibuffer))
kom-presence-messages)
(message ""))))
(lyskom-save-excursion
(set-buffer lyskom-unparsed-buffer)
(if (and (> lyskom-string-bytes-missing 0)
......
......@@ -63,7 +63,7 @@ The order of the list a is kept."
(defun kom-review-by-to (&optional count)
(def-kom-command kom-review-by-to (&optional count)
"Reviews all articles of author that is written to conference recipient.
If return is given instead of an author then all authors to that conference is
shown. If return is given instead of conference then all conferences for that
......@@ -74,106 +74,178 @@ If the argument is zero the all articles are chosen.
No argument is equivalent to COUNT 1.
The defaults for this command is the conference that you are in."
(interactive "p")
(lyskom-start-of-command 'kom-review-by-to)
(lyskom-tell-internat 'kom-tell-review)
(unwind-protect
(let* ((info (progn
(if (and (listp count)
(integerp (car count))
(null (cdr count)))
(setq count (car count)))
(cond
((zerop count)
(setq count nil)
(lyskom-get-string 'everybody))
((> count 0)
(lyskom-format 'latest-n count))
((< count 0)
(lyskom-format 'first-n (- count))))))
(by (lyskom-read-conf-no (lyskom-format 'info-by-whom info)
'pers 'empty))
(to (lyskom-read-conf-no (lyskom-format 'info-to-conf info)
'all
;; If person is not given we must give
;; conf
(not (zerop by))
(if (zerop lyskom-current-conf)
""
(conf-stat->name
(blocking-do 'get-conf-stat
lyskom-current-conf))))))
; Since we fetch everything anyway we don't need to do this.
; If we later choose to fetch all in small chunks we will have
; to do this then.
(if (not (zerop to))
(cache-del-conf-stat to))
(if (not (zerop by))
(cache-del-pers-stat by))
(let* ((info-by (if (zerop by)
(lyskom-get-string 'anybody)
(blocking-do 'get-conf-stat by)))
(info-to (if (zerop to)
(lyskom-get-string 'all-confs)
(blocking-do 'get-conf-stat to))))
(lyskom-format-insert 'review-info-by-to
info
info-by
info-to))
;; Now we have
;; - the person number in by
;; - the conf number in to
;; - the number of interesting texts in count (if negative, then
;; count from the beginning.
;;
;; What we have to do is fetch and merge the list of texts until we
;; have found count texts.
;; Lets do the very simple thing:
;; - Fetch the whole lists. If its to slow, fix it!
;; (the calls wont get very big, at least not during get-map
;; because the initiate-get-map itself splits the call)
(let* ((found-by (or (zerop by)
(lyskom-remove-zeroes
(append
(map->text-nos
(blocking-do 'get-created-texts by
0 lyskom-max-int)) nil))))
(found-to (or (zerop to)
(lyskom-remove-zeroes
(append
(map->text-nos
(blocking-do 'get-map to
0 lyskom-max-int)) nil))))
(list (cond
((zerop by) found-to)
((zerop to) found-by)
;; This will get them in the correct order
(t (lyskom-intersection found-by found-to)))))
(if list
(progn
;; Cut out the part we want, the beginning or the end...
(cond
((> count 0)
(while (> (length list) count)
(setq list (cdr list))))
((< count 0)
(setq list (nfirst (- count) list))))
(read-list-enter-read-info
(lyskom-create-read-info
'REVIEW
nil
(lyskom-get-current-priority)
(lyskom-create-text-list list)
nil t)
lyskom-reading-list t))
(lyskom-insert-string 'no-such-text))))
(lyskom-end-of-command)))
(let* ((info (progn
(if (and (listp count)
(integerp (car count))
(null (cdr count)))
(setq count (car count)))
(cond
((zerop count)
(setq count nil)
(lyskom-get-string 'everybody))
((> count 0)
(lyskom-format 'latest-n count))
((< count 0)
(lyskom-format 'first-n (- count))))))
(by (lyskom-read-conf-no (lyskom-format 'info-by-whom info)
'pers 'empty))
(to (lyskom-read-conf-no (lyskom-format 'info-to-conf info)
'all
;; If person is not given we must give
;; conf
(not (zerop by))
(if (zerop lyskom-current-conf)
""
(conf-stat->name
(blocking-do 'get-conf-stat
lyskom-current-conf))))))
;; Since we fetch everything anyway we don't need to do this. If
;; we later choose to fetch all in small chunks we will have to do
;; this then.
(if (not (zerop to))
(cache-del-conf-stat to))
(if (not (zerop by))
(cache-del-pers-stat by))
(let* ((info-by (if (zerop by)
(lyskom-get-string 'anybody)
(blocking-do 'get-conf-stat by)))
(info-to (if (zerop to)
(lyskom-get-string 'all-confs)
(blocking-do 'get-conf-stat to))))
(lyskom-format-insert 'review-info-by-to
info
info-by
info-to))
(let ((list (lyskom-get-texts-by-to by to count)))
(if list
(read-list-enter-read-info (lyskom-create-read-info
'REVIEW
nil
(lyskom-get-current-priority)
(lyskom-create-text-list list)
nil t)
lyskom-reading-list t)
(lyskom-insert-string 'no-such-text)))))
(defun lyskom-get-texts-by-to (by to count)
"Get a list of COUNT text numbers written by BY in conference TO."
;; THIS FUNCTION DOES NOT WORK AT THE MOMENT
;; Now we have
;; - the person number in by
;; - the conf number in to
;; - the number of interesting texts in count (if negative, then
;; count from the beginning.
;;
;; What we have to do is fetch and merge the list of texts until we
;; have found count texts.
;; Lets do the very simple thing:
;; - Fetch the whole lists. If its to slow, fix it!
;; (the calls wont get very big, at least not during get-map
;; because the initiate-get-map itself splits the call) (sure?)
;;; I'll finish this some day /davidk
;;; In the meantime we'll use the old, inefficient code
;;;
;;; (let* ((texts nil)
;;; (exhausted nil)
;;; (persstat (if (zerop by) nil (blocking-do 'get-pers-stat by)))
;;; (confstat (if (zerop to) nil (blocking-do 'get-conf-stat to)))
;;; (phigh (pers-stat->no-of-created-texts persstat))
;;; (plow (pers-stat->first-created-text persstat))
;;; (pmark (if persstat (if (< count 0) plow phigh)))
;;; (chigh (conf-stat->no-of-texts confstat))
;;; (clow (conf-stat->first-local-no confstat))
;;; (cmark (if confstat (if (< count 0) clow chigh))))
;;; (while (and (not exhausted)
;;; (not (zerop count)))
;;; (let* ((found-by (or (zerop by)
;;; (lyskom-remove-zeroes
;;; (listify-vector
;;; (map->text-nos
;;; (if (< count 0)
;;; (blocking-do 'get-created-texts by
;;; pmark (+ pmark 10))
;;; (blocking-do 'get-created-texts by
;;; (- pmark 10) pmark)))))))
;;; (found-to (or (zerop to)
;;; (lyskom-remove-zeroes
;;; (listify-vector
;;; (map->text-nos
;;; (if (< count 0)
;;; (blocking-do 'get-map to
;;; cmark (+ cmark 10))
;;; (blocking-do 'get-map to
;;; (- cmark 10) cmark)))))))
;;; (list (cond
;;; ((zerop by) found-to)
;;; ((zerop to) found-by)
;;; ;; This will get them in the correct order
;;; (t (lyskom-intersection found-by found-to)))))
;;; ;; Cut out the part we want, the beginning or the end...
;;; (cond
;;; ((> count 0)
;;; (while (> (length list) count)
;;; (setq list (cdr list)))
;;; (setq count (- count (length list))
;;; pmark (- pmark 10)
;;; cmark (- cmark 10)
;;; texts (nconc texts list)))
;;; ((< count 0)
;;; (setq list (nfirst (- count) list))
;;; (setq count (+ count (length list))
;;; pmark (+ pmark 10)
;;; cmark (+ cmark 10)
;;; texts (nconc list texts))))
;;; (setq exhausted (and (or (< pmark plow) (< phigh pmark))
;;; (or (< cmark clow) (< chigh cmark))))))
;;; texts)
(let* ((found-by (or (zerop by)
(lyskom-remove-zeroes
(append
(map->text-nos
(blocking-do 'get-created-texts by
0 lyskom-max-int)) nil))))
(found-to (or (zerop to)
(lyskom-remove-zeroes
(append
(map->text-nos
(blocking-do 'get-map to
0 lyskom-max-int)) nil))))
(list (cond
((zerop by) found-to)
((zerop to) found-by)
;; This will get them in the correct order
(t (lyskom-intersection found-by found-to)))))
(if list
(progn
;; Cut out the part we want, the beginning or the end...
(cond
((> count 0)
(while (> (length list) count)
(setq list (cdr list))))
((< count 0)
(setq list (nfirst (- count) list))))
(read-list-enter-read-info
(lyskom-create-read-info
'REVIEW
nil
(lyskom-get-current-priority)
(lyskom-create-text-list list)
nil t)
lyskom-reading-list t))
(lyskom-insert-string 'no-such-text))))
(defun kom-review-backward ()
......
......@@ -348,7 +348,7 @@ WANT-PERSONS is t for persons, nil for confs."
(defun lyskom-read-server-name (prompt)
"Read the name of a LysKOM server.
Copmpletion is done on the servers i lyskom-server-aliases. If an
Copmpletion is done on the servers i kom-server-aliases. If an
alias name is entered, the corresponding address is returned."
;; Create a completion table like
;; (("kom.lysator.liu.se" . "kom.lysator.liu.se")
......@@ -356,10 +356,10 @@ alias name is entered, the corresponding address is returned."
(let ((known-servers
(append (mapcar (function (lambda (pair)
(cons (car pair) (car pair))))
lyskom-server-aliases)
kom-server-aliases)
(mapcar (function (lambda (pair)
(cons (cdr pair) (car pair))))
lyskom-server-aliases)))
kom-server-aliases)))
(completion-ignore-case t)
server)
(setq server (completing-read prompt known-servers nil nil))
......
......@@ -357,7 +357,7 @@ he gets a y-or-n-p question for all recipients.")
(defvar lyskom-print-complex-dates t
"*If non-nil, print today and yesterday using a special format.")
(defvar lyskom-server-aliases
(defvar kom-server-aliases
'(("kom.lysator.liu.se" . "LysKOM")
("kom.ludd.luth.se" . "LuddKOM")
("rydkom.rydnet.lysator.liu.se" . "RydKOM")
......@@ -606,6 +606,9 @@ The first element is a dummy.")
"A flag indicating whether asynchronous minibuffer messages are allowed.
If this variable is non-nil, no asynchronous messages will appear.")
(defvar lyskom-is-saving nil
"A flag indicating whether the server is saving at the moment.")
;;; These variables control prefetch of conf-stats, text-stats and texts:
(defvar lyskom-prefetch-texts 3
......@@ -880,59 +883,59 @@ the value of kom-tell-phrases for fun.")
nil
(,@ body))))
(put 'lyskom-make-face 'lisp-indent-function 1)
;;; +++ Should handle dark backgrounds better
(when (eq window-system 'x)
(if (x-display-color-p)
(let ((bgmode (cdr (assq 'background-mode (frame-parameters)))))
(let* ((bgmode (cdr (assq 'background-mode (frame-parameters))))
(dark-bg (eq bgmode 'dark)))
(lyskom-make-face 'kom-active-face
(copy-face 'default 'kom-active-face)
(set-face-foreground 'kom-active-face "blue4"))
(copy-face 'default 'kom-active-face)
(set-face-foreground 'kom-active-face
(if dark-bg "lightblue" "blue4")))
(lyskom-make-face 'kom-url-face
(copy-face 'default 'kom-url-face)
(set-face-foreground 'kom-url-face "BlueViolet"))
(copy-face 'default 'kom-url-face)
(set-face-foreground 'kom-url-face
(if dark-bg "Moccasin" "BlueViolet")))
(lyskom-make-face 'kom-me-face
(copy-face 'bold 'kom-me-face)
(set-face-foreground 'kom-me-face "yellow")
(set-face-background 'kom-me-face "black"))
(copy-face 'bold 'kom-me-face)
(set-face-foreground 'kom-me-face "gold")
(set-face-background 'kom-me-face "black"))
(lyskom-make-face 'kom-highlight-face
(copy-face 'highlight 'kom-highlight-face)
(set-face-foreground 'kom-highlight-face
"midnight blue"))
(copy-face 'highlight 'kom-highlight-face)
(set-face-foreground 'kom-highlight-face
"midnight blue"))
(lyskom-make-face 'kom-text-face
(copy-face 'default 'kom-text-face))
(copy-face 'default 'kom-text-face))
(lyskom-make-face 'kom-subject-face
(copy-face 'kom-text-face 'kom-subject-face)
(set-face-foreground 'kom-subject-face
"dark green"))
(copy-face 'kom-text-face 'kom-subject-face)
(set-face-foreground 'kom-subject-face
(if dark-bg "Khaki" "dark green")))
(lyskom-make-face 'kom-text-no-face
(copy-face 'kom-text-face 'kom-text-no-face))
(copy-face 'kom-text-face 'kom-text-no-face))
(lyskom-make-face 'kom-presence-face
(make-face 'kom-presence-face)
(make-face-italic 'kom-presence-face nil t)
(cond ((or (null bgmode)
(eq bgmode 'dark))
(set-face-foreground 'kom-presence-face
"DimGray"))
((eq bgmode 'light)
(set-face-foreground
'kom-presence-face "LightGray")))))
(make-face 'kom-presence-face)
(make-face-italic 'kom-presence-face nil t)
(set-face-foreground 'kom-presence-face
"Gray")))
(progn
(lyskom-make-face 'kom-active-face
(copy-face 'underline 'kom-active-face))
(copy-face 'underline 'kom-active-face))
(lyskom-make-face 'kom-url-face
(copy-face 'kom-active-face 'kom-url-face))
(copy-face 'kom-active-face 'kom-url-face))
(lyskom-make-face 'kom-me-face
(copy-face 'highlight 'kom-me-face))
(copy-face 'highlight 'kom-me-face))
(lyskom-make-face 'kom-highlight-face
(copy-face 'highlight 'kom-highlight-face))
(copy-face 'highlight 'kom-highlight-face))
(lyskom-make-face 'kom-subject-face
(copy-face 'default 'kom-subject-face))
(copy-face 'default 'kom-subject-face))
(lyskom-make-face 'kom-text-face
(copy-face 'default 'kom-subject-face))
(copy-face 'default 'kom-subject-face))
(lyskom-make-face 'kom-text-no-face
(copy-face 'default 'kom-subject-face))
(copy-face 'default 'kom-subject-face))
(lyskom-make-face 'kom-presence-face
(make-face 'kom-presence-face)
(make-face-italic 'kom-presence-face nil t)))))
(make-face 'kom-presence-face)
(make-face-italic 'kom-presence-face nil t)))))
......
......@@ -80,8 +80,8 @@ lyskom-reading-list to read the comments to this."
(lyskom-format-insert "%#1n "
text-stat)
(lyskom-print-date-and-time (text-stat->creation-time
text-stat)
'time-y-m-d-h-m)
text-stat)
'time-y-m-d-h-m)
(lyskom-insert
(if (= 1 (text-stat->no-of-lines text-stat))
(lyskom-get-string 'line)
......
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