Commit 64582b17 authored by Per Cederqvist's avatar Per Cederqvist

Make it configurable if the client should search for unread

parents or relatives of a text before displaying it.  Also, add a
new strategy ('oldest-ancestor) that only searches among parents.

Details:

	* vars.el.in (kom-read-related-first): New configuration
	variable.  Set this to nil to get the old-style behaviour,
	'oldest-related to get the behaviour before this commit, or
	'oldest-ancestor to get the new default behaviour.

	* lyskom-rest.el (lyskom-find-lowest-text): Moved internal
	documentation from the doc-string to an internal comment.
	(lyskom-find-unread-ancestor): New defun.  This code is based on
	lyskom-find-lowest-text, but works in a more sensible way.
	(lyskom-select-text-to-read): New defun, extracted from
	kom-view-next-text.  Handle the new oldest-ancestor strategy.
	(kom-view-next-text): Use lyskom-select-text-to-read to simplify
	the code.

	* swedish-strings.el, english-strings.el (lyskom-custom-strings):
	Added ancestor, relative, kom-read-related-first-doc and
	kom-read-related-first-tag.

	* option-edit.el (lyskom-customize-buffer-format): Added
	kom-read-related-first.
	(lyskom-custom-variables): Ditto.
parent fb1ad25d
2008-03-17 Per Cederqvist <ceder@ingate.com>
Make it configurable if the client should search for unread
parents or relatives of a text before displaying it. Also, add a
new strategy ('oldest-ancestor) that only searches among parents.
* vars.el.in (kom-read-related-first): New configuration
variable. Set this to nil to get the old-style behaviour,
'oldest-related to get the behaviour before this commit, or
'oldest-ancestor to get the new default behaviour.
* lyskom-rest.el (lyskom-find-lowest-text): Moved internal
documentation from the doc-string to an internal comment.
(lyskom-find-unread-ancestor): New defun. This code is based on
lyskom-find-lowest-text, but works in a more sensible way.
(lyskom-select-text-to-read): New defun, extracted from
kom-view-next-text. Handle the new oldest-ancestor strategy.
(kom-view-next-text): Use lyskom-select-text-to-read to simplify
the code.
* swedish-strings.el, english-strings.el (lyskom-custom-strings):
Added ancestor, relative, kom-read-related-first-doc and
kom-read-related-first-tag.
* option-edit.el (lyskom-customize-buffer-format): Added
kom-read-related-first.
(lyskom-custom-variables): Ditto.
2007-11-10 <David Byers@GULAG>
* view-text.el (lyskom-follow-comments): Only look at
......
......@@ -3180,6 +3180,8 @@ Select whether to execute command or keyboard macro.")
(after . "After the text")
(depth-first . "In comment order")
(time-order . "In time order")
(ancestor . "Read unread commented first")
(relative . "Read unread relatives first")
(ar-message-type . "Message type")
(ar-personal . "Personal")
......@@ -3883,6 +3885,34 @@ up menus.")
Reading in comment order will give the order 1002, 1003, 1006, 1004,
1005 and finally 1007.")
(kom-read-related-first-doc . "\
When LysKOM has decided what text to read next (using the algorithm
specified by the kom-read-depth-first variable) it can optionally
refine the choice. This variable can have the following values:
nil (Off)
Do no more processing.
'oldest-ancestor (Read unread commented first)
If the text is a comment or footnote to a parent text, the
user is a member of at least one recipient of the text, and
the text is unread, it becomes a candidate to be used
instead. Repeat the process as long as any candidate has a
parent that fulfills the requirements. Use the
lowest-numbered text. This setting means that if a comment
tree started in another conference than the one you are
reading, you will see the entire unread part of the comment
tree in order.
'oldest-relative (Read unread relatives first)
This is similar to 'oldest-ancestor, but also considers all
children of all candidates, whether they are read or not.
Only unread texts will be selected, but even read texts will
be considered to ensure that the order you read texts in are
as close to the depth-first order as possible. The drawback
of this method is that LysKOM may have to consider hundreds of
texts, which may slow down the client.")
(kom-continuous-scrolling-doc . "\
Turned on means that LysKOM will scroll the buffer while new text is
......@@ -4555,6 +4585,7 @@ up menus.")
(kom-reading-puts-comments-in-pointers-last-tag . "Comment links are shown:")
(kom-read-depth-first-tag . "Read order:")
(kom-read-related-first-tag . "Read related texts first:")
(kom-deferred-printing-tag . "Delayed display:")
(kom-continuous-scrolling-tag . "Continuous scrolling:")
......
......@@ -633,10 +633,11 @@ A text T2 is lower than a text T1 if:
1. The text number of T2 is less than the text number of T1.
2. T2 is unread.
We consider all of the texts reachable from TEXT-NO.
We consider all of the texts reachable from TEXT-NO."
;; We keep track of which text numbers have previously been considered in
;; VISITED to detect loops and save all of the candidates in CANDIDATES.
We keep track of which text numbers have previously been considered
VISITED to detect loops and save all of the candidates in CANDIDATES."
(let* ((visited nil)
(candidates nil)
(consider (list text-no)))
......@@ -662,6 +663,42 @@ VISITED to detect loops and save all of the candidates in CANDIDATES."
(cache-del-text-stat text-no))))
(lyskom-minimum candidates)))
(defun lyskom-find-unread-ancestor (text-no)
"Look for unread texts that TEXT-NO is a comment or footnote to.
This function considers all parents of TEXT-NO. If they fulfill all
of the following requirements they are kept as candidates for further
processing:
- the current user is an active member of at least one recipient of
the text.
- the text is unread.
The parents of each candidate is in turn examined. The
lowest-numbered candidate is returned."
;; We keep track of which text numbers have previously been considered in
;; VISITED to detect loops and save all of the candidates in CANDIDATES.
(let* ((visited nil)
(candidates (list text-no))
(consider (list text-no)))
(while consider
(let* ((text-no (car consider))
(text-stat (blocking-do 'get-text-stat text-no))
(confs (lyskom-text-recipients text-stat))
(is-member (lyskom-member-of-at-least-one-p confs))
(tmp (if is-member (lyskom-cache-all-memberships confs)))
(is-read (lyskom-text-read-at-least-once-p text-stat)))
(setq consider (cdr consider))
(when (not (memq text-no visited))
(setq visited (cons text-no visited))
(when (and is-member (not is-read))
(setq candidates (cons text-no candidates))
(setq consider
(nconc consider
(lyskom-text-stat-commented-texts text-stat)))))))
(lyskom-minimum candidates)))
(defun lyskom-get-max-priority (confs)
"Return the maximum priority of the conferences in CONFS (list of
conference numbers). If the list is empty or if the user is not a
......@@ -680,6 +717,27 @@ member of any of the conferences NIL is returned."
;;; Modified to read commented texts first (Hans Eric Svensson)
(defun lyskom-select-text-to-read (text-no-maybe text-stat-maybe)
"Select the next text to read."
(cond
((eq kom-read-related-first nil)
text-no-maybe)
((eq kom-read-related-first 'oldest-relative)
(if kom-read-depth-first
(lyskom-find-best-text (lyskom-text-stat-commented-texts
text-stat-maybe)
text-no-maybe t)
(lyskom-find-lowest-text text-no-maybe)))
((eq kom-read-related-first 'oldest-ancestor)
(lyskom-find-unread-ancestor text-no-maybe))
(t
(error "Unexpected value for kom-read-related-first"))))
(def-kom-command kom-view-next-text ()
"Display the next unread text. This is the most common default command."
(interactive)
......@@ -705,13 +763,8 @@ member of any of the conferences NIL is returned."
(text-stat-maybe (blocking-do 'get-text-stat text-no-maybe))
(text-no (if is-reading
(if kom-read-depth-first
(lyskom-find-best-text
(lyskom-text-stat-commented-texts
text-stat-maybe)
text-no-maybe
t)
(lyskom-find-lowest-text text-no-maybe))
(lyskom-select-text-to-read
text-no-maybe text-stat-maybe)
text-no-maybe))
(text-stat (blocking-do 'get-text-stat text-no))
......
......@@ -202,6 +202,7 @@
[kom-session-nickname]
"\n"
[kom-read-depth-first]
[kom-read-related-first]
[kom-reading-puts-comments-in-pointers-last]
[kom-show-footnotes-immediately]
[kom-follow-comments-outside-membership]
......@@ -655,6 +656,9 @@ All key bindings:
(kom-show-footnotes-immediately (toggle (yes no)))
(kom-follow-comments-outside-membership (toggle (yes no)))
(kom-read-depth-first (toggle (depth-first time-order)))
(kom-read-related-first (choice ((const (off nil))
(const (ancestor oldest-ancestor))
(const (relative oldest-relative)))))
(kom-continuous-scrolling (toggle (on off)))
(kom-deferred-printing (toggle (on off)))
(kom-higher-priority-breaks (choice ((const (express-break express))
......
......@@ -3325,6 +3325,8 @@ Nuvarande r
(last . "Sist ")
(depth-first . "I kommentarsordning")
(time-order . "I tidsordning")
(ancestor . "Ls olsta kommenterade frst")
(relative . "Ls olsta relaterade frst")
(limited-number . "Ett begrnsat antal")
(unlimited-number . "Obegrnsat")
......@@ -4028,6 +4030,35 @@ ta fram menyer.")
i stllet 1002, 1003, 1006, 1004, 1005 och 1007.")
(kom-read-related-first-doc . "\
Nr LysKOM bestmt sig fr en text som ska visas enligt reglerna som
styrs av variabeln kom-read-depth-first, kan den ta hnsyn till att
en annan relaterad olst text borde visas frst. Fljande vrden r
tilltna:
nil (Av)
Gr ingen mer processning.
'oldest-ancestor (Ls olsta kommenterade frst)
Om texten r en kommentar eller fotnot till en frldratext,
och om anvndaren r medlem i minst en mottagare av den
texten, och texten r olst, s blir texten en kandidat till
att anvndas i stllet. Processen upprepas s lnge ngon
kandidat har en frlder som uppfyller villkoren. Den
kandidat som har det lgsta textnumret kommer att anvndas.
Den hr instllningen betyder att ett kommentarstrd som
brjar i ett annat mte n det du just nu lser kommer att
visas i en mer logisk ordning: du fr se hela det olsta
trdet i kommentarsordning.
'oldest-relative (Ls olsta relaterade frst)
Den hr instllningen r snarlik 'oldest-ancestor, men
undersker ven rekursivt alla kommentarer till alla
kandidater. Nackdelen med denna metod r att den kan behva
kontrollera hundratals texter, och det kan f klienten att bli
lngsam.")
(kom-continuous-scrolling-doc . "\
Pslaget innebr att klienten scrollar bufferten medan ny text stts in, s
man ser det senaste som har satts in. Detta fungerar bra om man har en
......@@ -4706,6 +4737,7 @@ ta fram menyer.")
(kom-reading-puts-comments-in-pointers-last-tag . "Kommentarslnkar visas:")
(kom-read-depth-first-tag . "Lsordning:")
(kom-read-related-first-tag . "Ls relaterade texter frst:")
(kom-deferred-printing-tag . "Frdrjda utskrifter:")
(kom-continuous-scrolling-tag . "Omedelbar scrollning:")
......
......@@ -1681,6 +1681,21 @@ you view threads of discussion.
Values other than `t' or `nil' are reserved for future use."
common read-depth-first boolean)
(def-kom-var kom-read-related-first 'oldest-ancestor
"**Read unread related texts first?
Once a candidate text to read has been found (using the rules defined
by the `kom-read-depth-first' variable), the choice can be further
refined as specified by this variable.
When set to `nil', no refinement is made. When set to
`oldest-ancestor' \(the default), unread parents are shown first.
When set to `oldest-related', children of the parents are also
considered.
Other values are reserved for future use."
server)
(def-kom-var kom-continuous-scrolling t
"**Controls frequency of scrolling.
......
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