Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Peter Liljenberg
lyskom-elisp-client
Commits
11464f69
Commit
11464f69
authored
Nov 21, 2006
by
Hans Eric Svensson
Browse files
View texts in a more intuitive order.
parent
2a14f364
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/ChangeLog
View file @
11464f69
2006-11-21 Hans Eric Svensson <eric+lyskom@lysator.liu.se>
* lyskom-rest.el (lyskom-view-next-text): Modified to read
commented texts in other conferences before the texts that comment
them in the current conference. See M-x describe-function
lyskom-find-best-text and M-x describe-function lyskom-find-lowest
text for more information.
(lyskom-member-of-at-least-one-p): New helper function.
(lyskom-member-one-priority-p): New helper function.
(lyskom-up-to): New helper function.
(lyskom-find-best-text): New helper function.
(lyskom-find-lowest-text): New helper function.
(lyskom-get-max-priority): New helper function.
* commands1.el (kom-who-is-on-in-conference): Spelling error
fixed.
* view-text.el (lyskom-view-text): Fixed sudden Swedish in
comment.
(lyskom-text-read-p): Added optional parameter want-passive.
(lyskom-follow-comments): Adjusted to use the new additional
parameter in one of the calls to lyskom-text-read-p.
2006-06-27 David Byers <davby@ida.liu.se>
* lyskom-rest.el (lyskom-fill-next-paragraph): Fixed off-by-one
...
...
src/commands1.el
View file @
11464f69
...
...
@@ -2606,7 +2606,7 @@ Several variables affect display. See `kom-show-where-and-what',
(
def-kom-command
kom-who-is-on-in-conference
(
&optional
arg
)
"Display a list of all connected users who are members of a
particular c
n
oference.
particular co
n
ference.
With a positive prefix argument ARG, list sessions who have been
active in the last ARG minutes. With a positive zero prefix argument
...
...
src/lyskom-rest.el
View file @
11464f69
...
...
@@ -45,6 +45,7 @@
;;;; Inge Wallin
;;;; David K}gedal
;;;; David Byers
;;;; Hans Eric Svensson
;;;; and others.
;;;;
;;;; Some ideas stolen from lpmud.el written by Lars Willf|r and Thomas Bellman
...
...
@@ -460,6 +461,219 @@ settings to control session priorities."
;;; Modified to handle filters
;; This is horribly ugly. It acts like a user command, but it isn't.
(
defun
lyskom-view-priority-text
()
"Display the first text from the next conference on the lyskom-to-do-list.
Cannot be called from a callback."
(
lyskom-start-of-command
'kom-view-next-text
)
(
unwind-protect
(
progn
(
lyskom-tell-internat
'kom-tell-read
)
(
let*
((
tri
(
read-list->first
lyskom-to-do-list
))
(
priority
(
read-info->priority
(
read-list->first
lyskom-reading-list
)))
(
text-no
(
car
(
text-list->texts
(
read-info->text-list
tri
)))))
(
lyskom-is-read
text-no
)
(
lyskom-view-text
text-no
t
nil
(
read-info->conf-stat
tri
)
priority
nil
t
))
(
lyskom-wait-queue
'main
))
(
lyskom-end-of-command
)))
;;; ========================================================================
;;; Functions to get the "best" text and the "least" text and their
;;; helper functions.
;;; Author: Hans Eric Svensson
(
defun
lyskom-member-of-at-least-one-p
(
confs
)
"Returns NIL if user is not a member of any of the conferences in
CONFS (list of conference numbers), otherwise a conference number."
(
lyskom-traverse
conf
confs
(
when
(
lyskom-get-membership
conf
t
)
(
lyskom-traverse-break
conf
))))
(
defun
lyskom-member-one-priority-p
(
confs
)
"Find out if the maximum priority of the conferences in CONFS (list
of conference numbers) is greater than or equal to the user's session
priority which is given by `lyskom-session-priority' (i.e. if the user
will read a text with the set of conferences as the only recipients).
Returns NIL if user will not read texts to any of the conferences in
CONFS, given the current session priority, T otherwise."
(
>=
(
or
(
lyskom-get-max-priority
confs
)
-1
)
lyskom-session-priority
))
(
defun
lyskom-up-to
(
list
element
)
"Destructively remove elements in LIST from the first ELEMENT."
(
let
((
tem
list
)
(
prev
nil
))
(
while
tem
(
when
(
eq
element
(
car
tem
))
(
if
prev
(
setcdr
prev
nil
)
(
setq
tem
nil
list
nil
)))
(
setq
prev
tem
tem
(
cdr
tem
)))
list
))
(
defun
lyskom-find-best-text
(
text-nos
came-from
loop-as-accept
)
"Find the \"best\" text number to read next starting from the text
numbers TEXT-NOS (and CAME-FROM).
A text T2 is better to read than a text T1 if:
1. T1 is a comment or footnote to T2.
2. T2 is unread.
3. The recipients of T2 contain at least one conference of which the
user is a member.
4. The recipients of T2 of which the user is a member has at least one
priority which is higher than or equal to the current session
priority.
-or-
1. T1 is a comment or footnote to the text T3.
2. T2 is a comment or footnote to T3.
3. T2 is unread.
4. T3 is read.
5. T2 commented T3 before T1 commented T3.
6. The recipients of T2 contain at least one conference of which the
user is a member.
7. The recipients of T2 of which the user is a member has at least one
priority which is higher than or equal to the current session
priority.
We also keep track of which text numbers have previously been
considered to detect loops. If a loop is detected and LOOP-AS-ACCEPT
is NIL, NIL is returned. Otherwise, the text number which was
determined to be a part of the loop is returned. CAME-FROM is the text
number of the text which was used to acquire TEXT-NOS. It is only used
when TEXT-NO is a read text to filter out the comments to TEXT-NO
which were made after CAME-FROM (as well as CAME-FROM)."
(
let
((
stack
(
list
(
list
text-nos
(
list
came-from
)
came-from
loop-as-accept
came-from
)))
(
result
nil
))
(
while
(
and
(
not
result
)
stack
)
(
let*
((
params
(
car
stack
))
(
text-nos
(
nth
0
params
)))
(
if
(
null
text-nos
)
(
setq
result
(
nth
4
params
)
stack
(
cdr
stack
))
(
let*
((
text-no
(
car
text-nos
))
(
visited
(
nth
1
params
))
(
loop-as-accept
(
nth
3
params
))
(
text-stat
(
blocking-do
'get-text-stat
text-no
))
; Sometimes is-read is nil even though it has no proof
; (when kom-follow-comments-outside-membership is nil).
(
is-read
(
lyskom-text-read-p
text-stat
))
(
confs
(
lyskom-text-recipients
text-stat
))
(
but-current
(
delq
lyskom-current-conf
confs
))
(
is-member
(
lyskom-member-of-at-least-one-p
but-current
)))
(
setcar
params
(
cdr
text-nos
))
(
cond
((
not
text-stat
))
; oops!
((
memq
text-no
visited
)
; loop detection
(
and
(
not
is-read
)
loop-as-accept
text-no
))
(
is-read
(
let*
((
came-from
(
nth
2
params
))
(
more-text-nos
(
lyskom-up-to
(
lyskom-text-comments
text-stat
)
came-from
)))
(
setq
stack
(
cons
(
list
more-text-nos
(
cons
text-no
visited
)
text-no
nil
nil
)
stack
))))
((
not
(
or
is-read
is-member
))
; outside membership
(
let*
((
more-text-nos
(
lyskom-text-stat-commented-texts
text-stat
))
(
came-from
(
nth
2
params
))
(
even-more-text-nos
(
lyskom-up-to
(
lyskom-text-comments
text-stat
)
came-from
)))
(
setq
stack
(
cons
(
list
more-text-nos
(
cons
text-no
visited
)
text-no
loop-as-accept
nil
)
(
cons
(
list
even-more-text-nos
(
cons
text-no
visited
)
text-no
nil
nil
)
stack
)))))
(
t
(
let*
((
more-text-nos
(
lyskom-text-stat-commented-texts
text-stat
))
(
text-no-if-fail
(
and
is-member
(
lyskom-member-one-priority-p
but-current
)
text-no
)))
(
setq
stack
(
cons
(
list
more-text-nos
(
cons
text-no
visited
)
text-no
loop-as-accept
text-no-if-fail
)
stack
)))))
(
unless
kom-review-uses-cache
(
cache-del-text-stat
text-no
))))))
result
))
(
defsubst
lyskom-minimum
(
list
)
"Return the least element in the list LIST."
(
and
list
(
apply
#'
min
list
)))
(
defun
lyskom-find-lowest-text
(
text-no
)
"Return the \"lowest\" text to read next, starting from the text
number TEXT-NO.
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 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
)))
(
while
consider
(
let*
((
text-no
(
car
consider
))
(
text-stat
(
blocking-do
'get-text-stat
text-no
))
(
is-read
(
lyskom-text-read-p
text-stat
))
(
confs
(
lyskom-text-recipients
text-stat
))
(
is-member
(
lyskom-member-of-at-least-one-p
confs
))
(
more-text-nos
(
lyskom-text-stat-commented-texts
text-stat
))
(
even-more-text-nos
(
lyskom-text-comments
text-stat
)))
(
setq
consider
(
cdr
consider
))
(
if
is-member
(
unless
(
or
is-read
(
memq
text-no
visited
))
(
setq
candidates
(
cons
text-no
candidates
))
(
if
consider
(
nconc
consider
more-text-nos
even-more-text-nos
)
(
setq
consider
(
nconc
consider
more-text-nos
even-more-text-nos
)))))
(
setq
visited
(
cons
text-no
visited
))
(
unless
kom-review-uses-cache
(
cache-del-text-stat
text-no
))))
(
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
member of any of the conferences NIL is returned."
(
let
((
priorities
(
delq
nil
(
mapcar
(
lambda
(
conf-no
)
(
membership->priority
(
lyskom-get-membership
conf-no
t
)))
confs
))))
(
unless
(
null
priorities
)
(
apply
#'
max
priorities
))))
;;;; ================================================================
;;;; View next text (cont'd.)
;;; Modified to handle filters
;;; Modified to read commented texts first (Hans Eric Svensson)
(
def-kom-command
kom-view-next-text
()
"Display the next unread text. This is the most common default command."
(
interactive
)
...
...
@@ -475,13 +689,30 @@ settings to control session priorities."
(
progn
(
let*
((
tri
(
read-list->first
lyskom-reading-list
))
(
text-no
(
car
(
text-list->texts
(
read-info->text-list
tri
))))
(
type
(
read-info->type
tri
))
(
priority
(
read-info->priority
(
read-list->first
lyskom-reading-list
)))
(
is-review-tree
(
memq
type
'
(
REVIEW-TREE
)))
(
is-review
(
or
(
memq
type
'
(
REVIEW
REVIEW-MARK
REVIEW-FAQ
))
is-review-tree
))
(
is-reading
(
memq
type
'
(
CONF
COMM-IN
FOOTN-IN
)))
(
text-no-maybe
(
car
(
text-list->texts
(
read-info->text-list
tri
))))
(
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
))
text-no-maybe
))
(
text-stat
(
blocking-do
'get-text-stat
text-no
))
(
priority
(
read-info->priority
tri
))
(
conf-stat
(
read-info->conf-stat
tri
))
(
mark-as-read
(
not
is-review
)))
(
when
(
or
is-review
(
eq
type
'REVIEW-FAQ-TREE
))
(
set-text-list->texts
...
...
@@ -494,9 +725,7 @@ settings to control session priorities."
(
lyskom-view-text
text-no
mark-as-read
(
and
kom-read-depth-first
(
not
is-review
))
(
read-info->conf-stat
(
read-list->first
lyskom-reading-list
))
conf-stat
priority
is-review-tree
(
not
is-review
)
...
...
@@ -505,28 +734,6 @@ settings to control session priorities."
(
lyskom-is-read
text-no
)
(
read-list-delete-text
nil
lyskom-reading-list
)
(
read-list-delete-text
nil
lyskom-to-do-list
))))))))
;;; Modified to handle filters
;; This is horribly ugly. It acts like a user command, but it isn't.
(
defun
lyskom-view-priority-text
()
"Display the first text from the next conference on the lyskom-to-do-list.
Cannot be called from a callback."
(
lyskom-start-of-command
'kom-view-next-text
)
(
unwind-protect
(
progn
(
lyskom-tell-internat
'kom-tell-read
)
(
let*
((
tri
(
read-list->first
lyskom-to-do-list
))
(
priority
(
read-info->priority
(
read-list->first
lyskom-reading-list
)))
(
text-no
(
car
(
text-list->texts
(
read-info->text-list
tri
)))))
(
lyskom-is-read
text-no
)
(
lyskom-view-text
text-no
t
nil
(
read-info->conf-stat
tri
)
priority
nil
t
))
(
lyskom-wait-queue
'main
))
(
lyskom-end-of-command
)))
(
defun
lyskom-is-read
(
text-no
)
...
...
src/view-text.el
View file @
11464f69
...
...
@@ -363,7 +363,7 @@ Note that this function must not be called asynchronously."
(
progn
(
lyskom-view-text
(
misc-info->footn-in
misc
)
mark-as-read
t
conf-stat
priority
)
; Mark as read (internally) s
å
follow-comments won't add
; Mark as read (internally) s
o
follow-comments won't add
; it to the read list.
(
lyskom-is-read
(
misc-info->footn-in
misc
))))))
...
...
@@ -547,7 +547,7 @@ lyskom-reading-list."
(
let
((
text-stat
(
blocking-do
'get-text-stat
no
)))
(
if
(
and
text-stat
(
or
review-tree
(
not
(
lyskom-text-read-p
text-stat
))))
(
not
(
lyskom-text-read-p
text-stat
t
))))
(
setq
comments
(
cons
no
comments
)))))
((
memq
no
mx-attachments-in
)
(
lyskom-skip-attachments
no
mark-as-read
))))
...
...
@@ -631,7 +631,7 @@ lyskom-reading-list."
(
defun
lyskom-text-read-p
(
text-stat
)
(
defun
lyskom-text-read-p
(
text-stat
&optional
want-passive
)
"Return t if TEXT-STAT has been marked as read in all
recipients to it that the user is a member in."
(
let*
((
misc-info-list
(
text-stat->misc-info-list
text-stat
))
...
...
@@ -646,7 +646,7 @@ recipients to it that the user is a member in."
;; Is this function ever called asynchronously? If not, we
;; can use lyskom-get-membership istead.
(
let
((
membership
(
lyskom-try-get-membership
(
misc-info->recipient-no
misc-info
)
nil
))
(
misc-info->recipient-no
misc-info
)
want-passive
))
(
loc-no
(
misc-info->local-no
misc-info
)))
;; Make a note that this text really is in a group we are
...
...
@@ -658,7 +658,7 @@ recipients to it that the user is a member in."
(
membership->read-texts
membership
))))
(
setq
res
nil
)))))))
(
if
(
eq
res
'not-member
)
(
not
kom-follow-comments-outside-membership
)
(
not
kom-follow-comments-outside-membership
)
res
)))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment