Commit e1b87dca authored by David Byers's avatar David Byers

Some more attachment code

Bug fixes in forward/backward-text
Implement generic (func) button
parent 8259b21d
2000-07-03 David Byers <davby@ida.liu.se>
* swedish-strings.el (lyskom-button-actions): Added button type
func.
* vars.el.in (lyskom-text-buttons): Fixed problem with info-node
regexp: it had the space after the colon in the nodename and did
not allow stuff like ``(file.info)nodename''.
2000-06-13 David Byers <davby@ida.liu.se>
* lyskom-rest.el (forward-text): Go to point-max if after the last
text.
(backward-text): Go to point-min if before the first text.
* utilities.el (lyskom-next-area): Added parameter goto-point-max.
(lyskom-prev-area): Added parameter goto-point-min.
2000-06-06 David Byers <davby@ida.liu.se>
* vars.el.in (kom-ispell-dictionary): Make inherited.
Prefetch messes up attachment display:
* prefetch.el (lyskom-prefetch-text-stat-all): New function.
* view-text.el (lyskom-skip-attachments): Mark skipped attachments
as read.
Check for bad calls to zerop:
* review.el (lyskom-review-by-to): Protect zerop check on
lyskom-current-conf by checking if it is nil first.
* commands2.el (kom-set-unread): Protect zerop check on
lyskom-current-conf by checking if it is nil first.
* commands1.el (kom-sub-self): Protect zerop check on
lyskom-current-conf by checking if it is nil first.
(kom-write-text): Same here.
* async.el (lyskom-parse-async): Cleanup not->null.
2000-06-14 Joel Rosdahl <joel@lysator.liu.se>
* review.el (lyskom-review-comments): Review texts in correct
......
......@@ -3,12 +3,44 @@
Att göra i elisp-klienten
=========================
* SPRÅK
Moderaden och fönstertiteln ändras inte om man byter språk.
* PREFETCH
Prefetchen verkar ställa till problem. När man skickar ett mail till
sig själv med attachments så kommer klienten att hämta text-stat för
brevet innan det har fått mx-attachments-in satt, och trots att man
raderar det ur cachen när attachmentet dyker upp.
Jag misstänker att det finns en prefetch inlagd som hämtar text-staten
innan importören har hunnit sätta mx-attachments-in. Det vore bra om
man kunde fördröja den en aning.
Man skulle kunna slå på debugging och titta i lyskom-prefetch-stack
och i anropsköerna när attachmentet kommer fram. Ett problem bara...
Om anropet redan ligger ute så kommer det att gå klart medan man
hattar runt i debuggern (iofs så tror jag inte att anropet redan
ligger ute då).
Dessutom såg jag att textmassan för inlägg verkar hämtas två gånger,
vilket inte är så himlans bra.
* INTRESSANTA SAKER
Johans hack av lyskom-add-sub-recipient gjorde koden ännu fulare.
Eliminera lyskom-add-sub-recipient *helt*.
Kommentera inlägg med vänner borde kolla om man försöker kommentera en
bilaga. I så fall borde man få förslag att kommentera "urinlägget"
istället. Klienten får följa "belongs-to"-länkarna uppåt.
Det vore trevligt om man kunde välja vilka sorters bilagor man inte
vill följa kommentarer till.
Inför en ATTACHMENT-IN type i read-listan som komplement till COMM-IN.
Prompten blir läsa nästa bilaga.
......
......@@ -119,7 +119,7 @@ this function shall be with current-buffer the BUFFER."
(let ((info (lyskom-parse-who-info)))
(lyskom-save-excursion
(set-buffer buffer)
(if (or (not lyskom-pers-no)
(if (or (null lyskom-pers-no)
(zerop lyskom-pers-no))
nil
(cache-add-who-info info)))))
......@@ -690,8 +690,7 @@ converted, before insertion."
"Unexpected misc-info in new text "
type))))))
;; A little to much work, really
(lyskom-prefetch-text-all (text-stat->text-no text-stat))
(lyskom-prefetch-text-stat-all text-stat)
;; Give a message if the user is waiting. Update the prompt.
(lyskom-run 'async 'lyskom-default-new-text-hook text-stat)
......
......@@ -585,7 +585,8 @@ of the person."
(lyskom-read-conf-stat (lyskom-get-string 'leave-what-conf)
'(all) nil
(let ((ccn
(if (or (zerop lyskom-current-conf))
(if (or (null lyskom-current-conf)
(zerop lyskom-current-conf))
""
(conf-stat->name
(blocking-do 'get-conf-stat
......@@ -1362,7 +1363,8 @@ Args: CONF-STAT MEMBERSHIP"
'(all) nil nil t)))
((numberp arg) (setq recpt arg))
(t (setq recpt lyskom-current-conf)))
(if (zerop recpt)
(if (or (null recpt)
(zerop recpt))
(lyskom-insert-string 'no-in-conf)
(lyskom-tell-internat 'kom-tell-write-text)
(lyskom-edit-text lyskom-proc
......@@ -2956,9 +2958,9 @@ lyskom-add-sub-recipient in a more readable fashion."
(defvar lyskom-add-sub-recipient-source-conf)
(defvar lyskom-add-sub-recipient-target-conf)
(defun lyskom-annoying-verify-add-rcpt ()
"Make sure the (l?)user really does mean to add a recipient
conference instead of just adding a carbon copy as (s?)he most likely
(defun lyskom-verify-add-recipient ()
"Make sure the user really does mean to add a recipient
conference instead of just adding a carbon copy as he most likely
ought to. Useful as a lyskom-add-sub-recipient-hook only."
(when (and
(eq lyskom-add-sub-recipient-action 'add-rcpt)
......
......@@ -680,7 +680,7 @@ send. If DONTSHOW is non-nil, don't display the sent message."
"Set number of unread articles in current conference."
(interactive "P")
(setq conf-no (or conf-no lyskom-current-conf))
(if (zerop conf-no)
(if (or (null conf-no) (zerop conf-no))
(progn
(lyskom-insert-string 'not-present-anywhere)
(lyskom-insert-string "\n"))
......
......@@ -3261,20 +3261,28 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
aux-text
lyskom-button-info-aux
(("Information" . lyskom-button-info-aux)
("Delete" . lyskom-button-delete-aux)))
("Delete" . lyskom-button-delete-aux))
nil)
(aux-edit-menu
nil
nil
(("Toggle \"secret\"" . lyskom-edit-toggle-secret-aux)
("Toggle \"anonymous\"" . lyskom-edit-toggle-anonymous-aux)
("Toggle \"inherited\"" . lyskom-edit-toggle-inherit-aux)
("Delete" . lyskom-edit-delete-aux)))
("Delete" . lyskom-edit-delete-aux))
nil)
(prioritize-flag-menu
nil
lyskom-prioritize-flag-toggle
(("Toggle" . lyskom-prioritize-flag-toggle)
("Set" . lyskom-prioritize-flag-set)
("Clear" . lyskom-prioritize-flag-clear)))
("Clear" . lyskom-prioritize-flag-clear))
nil)
(func
nil
lyskom-button-apply
nil
nil)
))
......
......@@ -1079,3 +1079,5 @@ depending on the value of `kom-lynx-terminal'."
(lyskom-end-of-command)))
(lyskom-format-insert 'cant-get-aux-item))))
(defun lyskom-button-apply (buf arg text)
(apply (car arg) (cdr arg)))
......@@ -2207,13 +2207,13 @@ A list of pairs means OPTARG will be used as a key to look up the real
(defun backward-text (&optional arg)
"Searches backwards for a text start and recenters with that text at the top."
(interactive "p")
(lyskom-prev-area (or arg 1) 'lyskom-text-start)
(lyskom-prev-area (or arg 1) 'lyskom-text-start t)
(beginning-of-line))
(defun forward-text (&optional arg)
"Searches forward for a text start and recenters with that text at the top."
(interactive "p")
(lyskom-next-area (or arg 1) 'lyskom-text-start))
(lyskom-next-area (or arg 1) 'lyskom-text-start t))
(def-kom-command kom-save-text (arg &optional list-of-texts)
......
......@@ -235,6 +235,15 @@ lyskom-prefetch-stack."
(lyskom-stack-push lyskom-prefetch-stack (cons 'TEXT-ALL text-no)))
(lyskom-continue-prefetch))
(defun lyskom-prefetch-text-stat-all (text-stat &optional queue)
"Prefetch all info about the text with text stat TEXT-STAT.
If QUEUE is non-nil, put the request on it, otherwise put it on
lyskom-prefetch-stack."
(when (null queue)
(setq queue (lyskom-queue-create))
(lyskom-stack-push lyskom-prefetch-stack queue))
(lyskom-prefetch-text-all-handler text-stat queue))
(defun lyskom-prefetch-texttree (text-no &optional queue only-new)
"Prefetch all info about the text with number TEXT-NO and descends recursively.
......
......@@ -196,7 +196,8 @@ The defaults for this command is the conference that you are in."
;; If person is not given we must give
;; conf -- Not anymore!
;; (not (zerop by))
(if (zerop lyskom-current-conf)
(if (or (null lyskom-current-conf)
(zerop lyskom-current-conf))
""
(cons (conf-stat->name
(blocking-do 'get-conf-stat
......
......@@ -3355,20 +3355,28 @@ i servern. Annars sparas det i din .emacs.")
aux-text
lyskom-button-info-aux
(("Information" . lyskom-button-info-aux)
("Radera" . lyskom-button-delete-aux)))
("Radera" . lyskom-button-delete-aux))
nil)
(aux-edit-menu
nil
aux-edit-menu-text
(("Vxla \"hemlig\"" . lyskom-edit-toggle-secret-aux)
("Vxla \"anonym\"" . lyskom-edit-toggle-anonymous-aux)
("Vxla \"rvd\"" . lyskom-edit-toggle-inherit-aux)
("Ta bort" . lyskom-edit-delete-aux)))
("Ta bort" . lyskom-edit-delete-aux))
nil)
(prioritize-flag-menu
nil
lyskom-prioritize-flag-toggle
(("Vxla" . lyskom-prioritize-flag-toggle)
("Stt p" . lyskom-prioritize-flag-set)
("Stng av" . lyskom-prioritize-flag-clear)))
("Stng av" . lyskom-prioritize-flag-clear))
nil)
(func
nil
lyskom-button-apply
nil
nil)
))
......
......@@ -955,32 +955,36 @@ return nil."
(setq rlist (cdr rlist)))
found)))
(defun lyskom-prev-area (num prop)
(defun lyskom-prev-area (num prop &optional goto-point-min)
(while (> num 0)
(let ((where (previous-single-property-change (point) prop)))
(when where
(if (not (get-text-property where prop))
(setq where (previous-single-property-change
where prop)))
(if where
(goto-char where)
(goto-char (point-min))
(setq num 1))))
(cond (where
(if (not (get-text-property where prop))
(setq where (previous-single-property-change
where prop)))
(if where
(goto-char where)
(goto-char (point-min))
(setq num 1)))
(goto-point-min (goto-char (point-min))
(setq num 1))))
(setq num (1- num))))
(defun lyskom-next-area (num prop)
(defun lyskom-next-area (num prop &optional goto-point-max)
"Move the cursor to the next prompt in the LysKOM buffer"
(interactive "p")
(while (> num 0)
(let ((where (next-single-property-change (point) prop)))
(when where
(if (not (get-text-property where prop))
(setq where (next-single-property-change where prop)))
(if where
(goto-char where)
(goto-char (point-max))
(setq num 1))))
(setq num (1- num))))
(cond (where
(if (not (get-text-property where prop))
(setq where (next-single-property-change where prop)))
(if where
(goto-char where)
(goto-char (point-max))
(setq num 1)))
(goto-point-max (goto-char (point-max))
(setq num 1))))
(setq num (1- num))))
;;; ============================================================
;;; Database stuff
......
......@@ -482,7 +482,7 @@ hooks are called, lyskom-add-sub-recipient-action is bound to the
action in progress, lyskom-add-sub-recipient-source-conf to the
conference being moved from (when lyskom-add-sub-recipient-action is
'move) and lyskom-add-sub-recipient-target-conf to the conference
being movedd to/added to/subtracted from. See also
being moved to/added to/subtracted from. See also
`lyskom-add-sub-recipient'.")
......@@ -742,7 +742,7 @@ conference and person buttons are not expected.")
;; Info node reference
("\\*Note[ \n\t]+\\([^:\n]*\\(\n[^:\n]*\\)?\\):\\([^.,\t\n]*\\(\n[^.,\t\n]*\\)?\\)[.,\t]"
("\\*Note[ \n\t]+\\([^:\n]*\\(\n[^:\n]*\\)?\\):\\s-*\\(\\(([^\)]+)\\)?[^.,\t\n]*\\(\n[^.,\t\n]*\\)?\\)[.,\t]"
info-node 1 3 kom-url-face)
)
......@@ -1078,7 +1078,8 @@ at random and used. This element may be a string, function or list."
(def-kom-var kom-ispell-dictionary nil
"*Dictionary to use for spell checking."
server)
server
inherited)
(def-kom-var lyskom-button-actions nil
"This variable defines valid button types in LysKOM. Each element is a
......
......@@ -480,7 +480,9 @@ lyskom-reading-list."
(lyskom-traverse text-stat result
(read-list-delete-text (text-stat->text-no text-stat) lyskom-reading-list)
(read-list-delete-text (text-stat->text-no text-stat) lyskom-to-do-list)
(if mark-as-read (lyskom-is-read-handler text-stat))))))
(when mark-as-read
(lyskom-mark-as-read text-stat)
(lyskom-is-read-handler text-stat))))))
(defun lyskom-fetch-text-for-cache (text-stat)
......@@ -1000,13 +1002,16 @@ Args: TEXT-STAT of the text being read."
(misc (elt (defer-info->data defer-info) 0))
(read-text-stat (elt (defer-info->data defer-info) 1))
(type (misc-info->type misc))
(mx-from (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 17)))
(mx-author (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 16)))
(mx-attachments-in (lyskom-get-text-attachments text-stat))
(mx-from (car (lyskom-get-aux-item (text-stat->aux-items text-stat)
17)))
(mx-author (car (lyskom-get-aux-item (text-stat->aux-items text-stat)
16)))
(mx-attachments-in (lyskom-get-text-attachments read-text-stat))
(mx-belongs-to (mapcar
(lambda (el)
(string-to-number (aux-item->data el)))
(lyskom-get-aux-item (text-stat->aux-items read-text-stat) 10100)))
(lyskom-get-aux-item (text-stat->aux-items
read-text-stat) 10100)))
(content-type "")
fmt data)
......@@ -1061,7 +1066,7 @@ Args: TEXT-STAT of the text being read."
nil))
(mx-from (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 17)))
(mx-author (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 16)))
(mx-attachments-in (lyskom-get-text-attachments text-stat))
(mx-attachments-in (lyskom-get-text-attachments read-text-stat))
(mx-belongs-to (mapcar
(lambda (el)
(string-to-number (aux-item->data el)))
......
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