commands2.el 38 KB
Newer Older
Per Cederqvist's avatar
.    
Per Cederqvist committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
;;;; ================================================================
;;;; ================================================================
;;;;
;;;; File: commands2.el
;;;;
;;;; This file contains the code for some high level commands.
;;;;

;;; ================================================================
;;;              Lista medlemsskap - List membership

;;; Author: Linus Tolke
;;; Rewritten by ceder


(defun kom-membership ()
  "Show memberships last visited, priority, unread and name."
  (interactive)
  (lyskom-start-of-command 'kom-membership)
  (let ((buffer (get-buffer-create (concat (buffer-name (current-buffer))
					   "-membership"))))
    (save-window-excursion
      (set-buffer buffer)
      (erase-buffer)
      (insert (lyskom-get-string 'your-memberships))
      (insert (lyskom-get-string 'memberships-header)))
    (display-buffer buffer)
    (lyskom-traverse
     x lyskom-membership
     (initiate-get-conf-stat 'membership 'lyskom-memb-received-1
			     (membership->conf-no x)
			     x buffer)))
  (lyskom-end-of-command))

(defun lyskom-memb-received-1 (conf-stat membership buffer)
  "Part of kom-membership.
Get maps for the conference CONF-STAT. MEMBERSHIP is the users
membership in that conference. Call lyskom-memb-received with
the resulting MAP, CONF-STAT, MEMBERSHIP and BUFFER.
Args: CONF-STAT MEMBERSHIP BUFFER."
  (if (/= (conf-stat->conf-no conf-stat)
	  (membership->conf-no membership))
      (signal 'lyskom-internal-error '("lyskom-memb-received-1")))
  (let ((first-wanted (1+ (membership->last-text-read membership)))
	(last-existing  (+ (conf-stat->first-local-no conf-stat)
			   (conf-stat->no-of-texts conf-stat)
			   -1)))
    (if (> first-wanted last-existing)
	(lyskom-run 'membership 'lyskom-memb-received
		    nil conf-stat membership buffer)
      (initiate-get-map 'membership 'lyskom-memb-received
			(membership->conf-no membership)
			first-wanted
			(+ 1 last-existing
			   (- first-wanted))
			conf-stat membership buffer))))

(defun lyskom-memb-received (map conf-stat membership buffer)
  "Args: MAP CONF-STAT MEMBERSHIP BUFFER.
Prints membership in a conferences.
MAP may be nil if there are no new texts."
  (save-window-excursion
    (set-buffer buffer)
    (goto-char (point-max))
    (insert (concat (lyskom-return-time
		     (membership->last-time-read membership))
		    (format "   %d\t%d\t"
			    (membership->priority membership)
			    (if map
				(length (lyskom-list-unread map membership))
			      0))
		    (conf-stat->name conf-stat)
		    "\n"))))



;;; ================================================================
;;;          Status (f|r) M|te - Status for a conference

;;; Author: ceder (with some help by Linus)
;;; much enhanced by Inge Wallin (lyskom-status-conf-2 and beyond)


(defun kom-status-conf (&optional conf-no)
  "Prints conference status.
If argument CONF-NO is existing and non-nil then this conference is used. 
otherwise: the conference is read with lyskom-completing-read."
  (interactive)
  (lyskom-start-of-command 'kom-status-conf)
  (if conf-no
      (lyskom-status-conf conf-no)
    (lyskom-completing-read 'main 'lyskom-status-conf-1
			    (lyskom-get-string 'conf-for-status)
			    nil nil "")))


(defun lyskom-status-conf-1 (conf-no)
  "Invalidate the cache entry for CONF-NO and print status.
Calls initiate-get-conf-stat and prints using lyskom-status-conf."
  (cache-del-conf-stat conf-no)
  (initiate-get-conf-stat 'main 'lyskom-status-conf
			  conf-no))


(defun lyskom-status-conf (conf-stat)
  "Print status about CONF-STAT."
  (if (null conf-stat)
      (progn
	(lyskom-insert-string 'no-such-conf)
	(lyskom-end-of-command))
    (let* ((type (conf-stat->conf-type conf-stat))
	   (box (conf-type->letterbox type))
	   (ori (conf-type->original type))
	   (pro (conf-type->rd_prot type))
	   (sec (conf-type->secret type)))
      (lyskom-format-insert 'status-record
			    (conf-stat->name conf-stat)
			    (format "%d" (conf-stat->conf-no conf-stat))
			    (cond
			     ((or box ori pro sec)
			      (concat "("
				      (if box (lyskom-get-string 'Mailbox) "")
				      (if (and box (or sec ori pro)) ", " "")
				      (if sec (lyskom-get-string
					       'Protected) "")
				      (if (and sec (or ori pro)) ", " "")
				      (if ori (lyskom-get-string
					       'no-comments) "")
				      (if (and ori pro) ", " "")
				      (if pro (lyskom-get-string 'closed) "")
				      ")"))
			     (t ""))))
133
134
135
136
137
138
139
140
141
142
143
144
    (lyskom-format-insert 'created-by
			  (format "%25d" (conf-stat->creator conf-stat))
			  (let ((creator (cache-get-conf-stat
					  (conf-stat->creator conf-stat))))
			    (if creator
				(concat
				 (if (> (length (conf-stat->name creator))
					(- (lyskom-window-width) 46))
				     "\n("
				   "(")
					(conf-stat->name creator)")")
			      "")))
145
146
147
    (lyskom-format-insert 'created-at
			  (lyskom-return-time
			   (conf-stat->creation-time conf-stat)))
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
    (lyskom-format-insert 'members
			  (conf-stat->no-of-members conf-stat))
    (lyskom-format-insert 'garb-nice
			  (conf-stat->garb-nice conf-stat))
    (lyskom-format-insert 'lowest-local-no
			  (conf-stat->first-local-no conf-stat))
    (lyskom-format-insert 'highest-local-no
			  (1- (+ (conf-stat->no-of-texts conf-stat)
				 (conf-stat->first-local-no conf-stat))))
    (lyskom-format-insert 'last-text-time
			  (lyskom-return-time
			   (conf-stat->last-written conf-stat)))
    (lyskom-format-insert 'no-of-motd
			  (conf-stat->msg-of-day conf-stat))
    (lyskom-format-insert 'superconf-is-no-name
			  (conf-stat->super-conf conf-stat)
			  (let ((super-conf (cache-get-conf-stat
					     (conf-stat->super-conf conf-stat))))
			    (if super-conf
				(concat
				 (if (> (length (conf-stat->name super-conf))
					(- (lyskom-window-width) 46))
				     "\n("
				   "(")
				 (conf-stat->name super-conf)")")
			      "")))
    (lyskom-format-insert 'permitted-submitters-no-name
			  (conf-stat->permitted-submitters conf-stat)
			  (let ((permitted-submitters
				 (cache-get-conf-stat
				  (conf-stat->permitted-submitters
				   conf-stat))))
			    (cond
			     (permitted-submitters
			      (concat
			       (if (> (length (conf-stat->name permitted-submitters))
				      (- (lyskom-window-width) 46))
				   "\n("
				 "(")
			       (conf-stat->name permitted-submitters)
			       ")"))
			     ((zerop (conf-stat->permitted-submitters conf-stat))
			      (lyskom-get-string 'Everybody))
			     (t ""))))
    (lyskom-format-insert 'supervisor-is-no-name
			  (conf-stat->supervisor conf-stat)
			  (let ((supervisor (cache-get-conf-stat
					     (conf-stat->supervisor conf-stat))))
			    (if supervisor
				(concat (if (> (length (conf-stat->name supervisor))
					       (- (lyskom-window-width) 46))
					    "\n(" 
					  "(")
					(conf-stat->name supervisor)")")
			      "")))
    (lyskom-format-insert 'presentation-no
			  (conf-stat->presentation conf-stat))
Per Cederqvist's avatar
.    
Per Cederqvist committed
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297

    (if (zerop (conf-stat->msg-of-day conf-stat))
	nil
      (lyskom-run 'main 'lyskom-insert
		  (lyskom-format 'conf-has-motd
			  (conf-stat->name conf-stat)))
      (lyskom-view-text 'main (conf-stat->msg-of-day conf-stat)))

  (lyskom-run 'main 'lyskom-status-conf-2 conf-stat)))


(defun lyskom-status-conf-2 (conf-stat)
  "Show all members of CONF-STAT if the user so wishes."
  (lyskom-scroll)
  (if (null (j-or-n-p (lyskom-get-string 'show-members-list-also-q)))
      (lyskom-end-of-command)
    (initiate-get-members 'main 'lyskom-status-conf-3
			  (conf-stat->conf-no conf-stat)
			  0 lyskom-max-int conf-stat)))


(defun lyskom-status-conf-3 (member-list conf-stat)
  "Receive a list of members in a conference in MEMBER-LIST and call
lyskom-status-conf-4 to show their names. The conference CONF-STAT
is the one we are interested in."
  (lyskom-format-insert 'conf-has-these-members
			(conf-stat->name conf-stat))
  (lyskom-insert-string 'member-list-header)
  (lyskom-traverse 
   member (conf-no-list->conf-nos member-list)
   (lyskom-collect 'main)
   (initiate-get-conf-stat 'main nil member)
   (initiate-query-read-texts 'main nil
			      member (conf-stat->conf-no conf-stat))
   (lyskom-use 'main 'lyskom-status-conf-4 conf-stat))
  (lyskom-run 'main 'lyskom-end-of-command))


(defun lyskom-status-conf-4 (member-conf-stat membership conf-stat)
  "Print a row describing the membership of MEMBER-CONF-STAT 
 (described by MEMBERSHIP) in CONF-STAT."
  (if (or (null member-conf-stat)
	  (null membership))
      (lyskom-insert-string 'secret-membership)
    (lyskom-print-date-and-time (membership->last-time-read membership))
    (lyskom-insert (concat (format "%7d  "
				   (- (+ (conf-stat->first-local-no conf-stat)
					 (conf-stat->no-of-texts conf-stat))
				      (membership->last-text-read membership)
				      (length (membership->read-texts
					       membership))
				      1))
			   (conf-stat->name member-conf-stat)
			   "\n"))))


;;; ================================================================
;;;            Status (f|r) Person - status for a person

;;; Author: ceder
;;; Heavily enhanced: Inge Wallin (lyskom-status-pers-3 and beyond)


(defun kom-status-person (&optional pers-no)
  "Prints status for a person."
  (interactive)
  (lyskom-start-of-command 'kom-status-person)
  (if pers-no
      (lyskom-status-pers pers-no)
    (lyskom-completing-read 'main 'lyskom-status-pers
			    (lyskom-get-string 'pers-for-status)
			    'person nil "")))


(defun lyskom-status-pers (pers-no)
  "Print status about PERS-NO."
  (cache-del-conf-stat pers-no)
  (lyskom-collect 'main)
  (initiate-get-pers-stat 'main nil pers-no)
  (initiate-get-conf-stat 'main nil pers-no)
  (lyskom-use 'main 'lyskom-status-pers-2))


(defun lyskom-status-pers-2 (pers-stat conf-stat)
  "Print status about PERS-STAT. The name is in CONF-STAT"
  (cond
   ((null pers-stat)
    (lyskom-insert-string 'no-such-pers)
    (lyskom-end-of-command))
   (t
    (lyskom-format-insert 'pers-status-record
			  (conf-stat->name conf-stat)
			  (conf-stat->conf-no conf-stat))
298
299
300
    (lyskom-format-insert 'created-time
			  (lyskom-return-time
			   (conf-stat->creation-time conf-stat)))
Per Cederqvist's avatar
.    
Per Cederqvist committed
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337

    (lyskom-format-insert 'created-confs
			  (pers-stat->created-confs pers-stat))
    (lyskom-format-insert 'created-confs
			  (pers-stat->created-persons pers-stat))
    (lyskom-format-insert 'created-texts
			  (1- (+ (pers-stat->no-of-created-texts pers-stat)
				 (pers-stat->first-created-text pers-stat))))
    (lyskom-format-insert 'created-lines
			  (pers-stat->created-lines pers-stat))
    (lyskom-format-insert 'created-chars
			  (pers-stat->created-bytes pers-stat))

    (lyskom-format-insert 'no-of-sessions
			  (pers-stat->sessions pers-stat))
    (if (zerop (pers-stat->total-time-present pers-stat))
	nil
      (lyskom-format-insert 'present-time-d-h-m-s
			    (/ (pers-stat->total-time-present pers-stat)
			       (* 24 3600))
			    (% (/ (pers-stat->total-time-present pers-stat)
				  3600) 24)
			    (% (/ (pers-stat->total-time-present pers-stat)
				  60) 60)
			    (% (pers-stat->total-time-present pers-stat)
			       60)))
    (lyskom-format-insert 'last-log-in
			  (lyskom-return-time
			   (pers-stat->last-login pers-stat)))
    (lyskom-format-insert 'user-name
			  (pers-stat->username pers-stat))
    (lyskom-format-insert 'read-texts
			  (pers-stat->read-texts pers-stat))
    (lyskom-format-insert 'time-for-last-letter
			  (lyskom-return-time
			   (conf-stat->last-written conf-stat)))

338
339
340
341
342
343
344
345
346
347
348
349
350
    (lyskom-format-insert 'superconf
			  (conf-stat->super-conf conf-stat)
			  (let ((super-conf 
				 (cache-get-conf-stat
				  (conf-stat->super-conf conf-stat))))
			    (if super-conf
				(concat
				 (if (> (length (conf-stat->name super-conf))
					(- (lyskom-window-width) 46))
				     "\n("
				   "(")
				 (conf-stat->name super-conf)")")
			      "")))
Per Cederqvist's avatar
.    
Per Cederqvist committed
351
    (if (not (zerop (conf-stat->supervisor conf-stat)))
352
353
354
355
356
357
358
359
360
361
362
363
364
	(lyskom-format-insert 'supervisor
			      (conf-stat->supervisor conf-stat)
			      (let ((supervisor
				     (cache-get-conf-stat
				      (conf-stat->supervisor conf-stat))))
				(if supervisor
				    (concat
				     (if (> (length (conf-stat->name supervisor))
					    (- (lyskom-window-width) 46))
					 "\n(" 
				       "(")
				     (conf-stat->name supervisor)")")
				  ""))))
Per Cederqvist's avatar
.    
Per Cederqvist committed
365
366
367
    (lyskom-format-insert 'member-of-confs
			  (pers-stat->no-of-confs pers-stat))
    (lyskom-format-insert 'presentation
368
			  (conf-stat->presentation conf-stat))))
Per Cederqvist's avatar
.    
Per Cederqvist committed
369
370
371

  (if (not (zerop (conf-stat->msg-of-day conf-stat)))
      (progn
372
373
	(lyskom-run 'main 'lyskom-format-insert
		    'has-motd (conf-stat->name conf-stat))
Per Cederqvist's avatar
.    
Per Cederqvist committed
374
375
	(lyskom-view-text 'main (conf-stat->msg-of-day conf-stat))))

376
  (lyskom-run 'main 'lyskom-status-pers-3 conf-stat))
Per Cederqvist's avatar
.    
Per Cederqvist committed
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583


(defun lyskom-status-pers-3 (conf-stat)
  "Show all conferences CONF-STAT is a member of if the user so wishes."
  (lyskom-scroll)
  (if (null (j-or-n-p (lyskom-get-string 'show-membership-list-also-q)))
      (lyskom-end-of-command)
    (initiate-get-membership 'main 'lyskom-status-pers-4
			     (conf-stat->conf-no conf-stat)
			     conf-stat)))


(defun lyskom-status-pers-4 (membership-list conf-stat)
  "Receive an array of memberships and print them using lyskom-status-pers-5.
Args: MEMBERSHIP-LIST CONF-STAT."
  (if (null membership-list)
      (lyskom-format-insert 'not-allowed-see-confs
			    (conf-stat->name conf-stat))
    (lyskom-format-insert 'is-member-of
			  (conf-stat->name conf-stat))
    (lyskom-insert-string 'membership-list-header)
    (setq lyskom-count-var 0)
    (lyskom-traverse
     membership membership-list
     (initiate-get-conf-stat 'main 'lyskom-status-pers-5 
			     (membership->conf-no membership)
			     membership conf-stat)))
  (lyskom-run 'main 'lyskom-status-pers-6 conf-stat))


(defun lyskom-status-pers-5 (conf-stat membership member-conf-stat)
  "Print a row describing the membership of MEMBER-CONF-STAT 
 (described by MEMBERSHIP) in CONF-STAT."
  (if (or (null conf-stat)
	  (null membership))
      (lyskom-insert-string 'secret-membership)
    (lyskom-print-date-and-time (membership->last-time-read membership))
    (let ((unread (- (+ (conf-stat->first-local-no conf-stat)
			(conf-stat->no-of-texts conf-stat))
		     (membership->last-text-read membership)
		     (length (membership->read-texts
			      membership))
		     1)))
      (lyskom-insert (concat 
		      (if (zerop unread)
			  "       "
			(format "%6d " unread))
		      (if (= (conf-stat->conf-no member-conf-stat)
			     (conf-stat->supervisor conf-stat))
			  "O "
			"  ")
		      (conf-stat->name conf-stat)
		      "\n"))
      (setq lyskom-count-var (+ lyskom-count-var unread)))))


(defun lyskom-status-pers-6 (conf-stat)
  "Print the total number of unread texts for the person CONF-STAT."
  (lyskom-format-insert 'his-total-unread 
			(conf-stat->name conf-stat)
			lyskom-count-var)
  (lyskom-run 'main 'lyskom-end-of-command))



;;; ================================================================
;;;              Skicka meddelande - Send message

;;; Author: Inge Wallin


(defun kom-send-message ()
  "Send a message to one or all users in KOM right now."
  (interactive)
  (lyskom-start-of-command 'kom-send-message)
  (lyskom-completing-read 'main 'lyskom-send-message
			  (lyskom-get-string 'who-to-send-message-to)
			  'person 'empty ""))


(defun lyskom-send-message (pers-no)
  "Send a message to the person with the number CONF-NO.  CONF-NO == 0 
means send the message to everybody."
  (initiate-send-message 'main 'lyskom-send-message-2
			 pers-no
			 (lyskom-read-string (lyskom-get-string 'message-prompt))))


(defun lyskom-send-message-2 (reply)
  "Receive the reply from send-message and report on it."
  (if reply
      (lyskom-insert-string 'message-sent)
    (lyskom-insert-before-prompt
 (lyskom-get-string 'message-nope)))
  (lyskom-end-of-command))



;;; ================================================================
;;;       Endast l{sa senaste - Set unread articles in a conf. 
;;;            (Skip or re-read articles).

;;; Author: Linus Tolke


(defun kom-set-unread ()
  "Set number of unread articles in current conference."
  (interactive)
  (lyskom-start-of-command 'kom-set-unread)
  (cond
   ((zerop lyskom-current-conf)
    (lyskom-insert-string 'not-present-anywhere)
    (lyskom-end-of-command))
   (t
    (initiate-get-conf-stat 'main 'lyskom-set-unread
			    lyskom-current-conf))))


(defun lyskom-set-unread (conf-stat)
  "Ask user how many unread texts he wants to have in CONF-STAT."
  (cond
   ((null conf-stat)			;+++ annan errorhantering
    (lyskom-insert "Error!\n")		;+++ Hrrrmmmmffff????
    (lyskom-end-of-command))
   (t
    (let ((n (lyskom-read-num-range
	      0 (conf-stat->no-of-texts conf-stat)
	      (lyskom-format 'only-last
			     (conf-stat->no-of-texts conf-stat)
			     (conf-stat->name conf-stat)))))

      (lyskom-halt 'main)
      (initiate-set-unread 'set-unread 'lyskom-set-unread-2
			   (conf-stat->conf-no conf-stat) n)
      (lyskom-run 'set-unread 'lyskom-resume 'main)))))


(defun lyskom-set-unread-2 (flg)
  "Re-fetch everything if there was success."
  (if (null flg)
      (progn
	(lyskom-insert-string 'only-error)
	(lyskom-end-of-command))
    (lyskom-refetch)))


;;; ================================================================
;;;                 Lista Nyheter - List News

;;; Author:   Linus Tolke
;;; Rehacked: Inge Wallin


(defun kom-list-news ()
  "Runs lyskom-start-of-command and then gets all conferences using 
lyskom-prefetch-all-confs."
  (interactive)
  (lyskom-start-of-command 'kom-list-news)
  (lyskom-prefetch-all-confs 'lyskom-list-news))


(defun lyskom-list-news ()
  "Print the number of unread articles to the user."
  (interactive)
  (let ((sum 0))
    (mapcar
     (function
      (lambda (info)
	(let ((un (length (cdr (read-info->text-list info))))
	      (name (conf-stat->name (read-info->conf-stat info))))
	  (cond
	   ((eq (read-info->type info) 'CONF)
	    (lyskom-insert 
	     (if (/= un 1)
		 (lyskom-format 'you-have-unreads un name)
	       (lyskom-format 'you-have-an-unread name)))
	    (setq sum (+ sum un)))))))
     (read-list->all-entries lyskom-to-do-list))
    (if (= 0 sum)
	(lyskom-insert-string 'you-have-read-everything)
      (lyskom-insert 
       (if (/= sum 1)
	   (lyskom-format 'total-unreads 
		   sum
)
	 (format (lyskom-get-string 'total-unread))))))
  (lyskom-end-of-command))


;;; ================================================================
;;; 			V{nta - Idle wait


(defun kom-busy-wait (arg)
  "Sets the kom-session in wait-mode.
The wait-mode is interrupted when a text in a conference with higher priority
than that of the next text to be read.
If you want another priority to break that the ones higher that the next text 
to be read, give the priority as a prefix argument.
When a text is received the new text is displayed."
  (interactive "P")
  (lyskom-start-of-command 'kom-busy-wait)
  (if (not (read-list-isempty lyskom-reading-list))
      (set-read-list-empty lyskom-reading-list))
  (let ((waitfor (or (cond
		      ((integerp arg) arg)
		      ((listp arg) (car arg)))
Per Cederqvist's avatar
Per Cederqvist committed
584
		     (read-info->priority
Per Cederqvist's avatar
.    
Per Cederqvist committed
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
		      (read-list->first lyskom-to-do-list))
		     -2)))
    (lyskom-tell-internat 'kom-tell-wait)
    (if (= waitfor -2)
	(lyskom-insert-string 'waiting-for-anything)
      (lyskom-format-insert 'waiting-higher-than waitfor))
    (lyskom-scroll)
    (setq lyskom-is-waiting
	  (list '>
		'(or (read-info->priority
		      (read-list->first lyskom-reading-list))
		     (read-info->priority
		      (read-list->first lyskom-to-do-list))
		     257)
		waitfor))))


;;; ================================================================
;;;                    Lista nyheter - List unread

;;; Author: Linus Tolke


(defun kom-list-news-old ()
  "List the amount of unread texts in all conferences.
Lista nyheter"
  (interactive)
  (lyskom-start-of-command 'kom-list-news)
  (lyskom-halt 'main)
  (setq lyskom-count-var 0)
  (mapcar (function
	   (lambda (memb-ship)
	     (initiate-get-conf-stat 'membership
				     'lyskom-list-unread-maybe-get-map
				     (membership->conf-no memb-ship)
				     memb-ship)))
	  lyskom-membership)
  (lyskom-run 'membership 'lyskom-list-unread-summary))


(defun lyskom-list-unread-maybe-get-map (conf-stat memb-ship)
  "If a map is needed to calculate unread then send for one.
Else call lyskom-list-unread-print with nil instead of map.
Args: CONF-STAT MEMB-SHIP."
  (lyskom-halt 'membership)
  (if (not (lyskom-time-greater (membership->last-time-read memb-ship)
				(conf-stat->last-written conf-stat)))
      (lyskom-run 'membership-2
		  'lyskom-list-unread-print nil conf-stat memb-ship)
    (initiate-get-map 'membership-2 'lyskom-list-unread-print
		      (membership->conf-no memb-ship)
		      (1+ (membership->last-text-read memb-ship))
		      (+ (conf-stat->no-of-texts conf-stat)
			 (conf-stat->first-local-no conf-stat)
			 (- (membership->last-text-read memb-ship)))
		      conf-stat
		      memb-ship)))


(defun lyskom-list-unread-print (map conf-stat memb-ship)
  "Prints how many unread a conference has. And adds to lyskom-count-var.
MAP is a map och articles for that conference.
CONF-STAT is the conference status for that conference and
MEMBERSHIP is the membership for the user in that conference."
  (let ((antal
	 (if map
	     (length (lyskom-list-unread map memb-ship))
	   0)))
    (if (> antal 0)
	(lyskom-insert 
	 (if (= antal 1)
	     (lyskom-format 'you-have-an-unread (conf-stat->name conf-stat))
	   (lyskom-format 'you-have-unreads
			  antal (conf-stat->name conf-stat)))))
    (setq lyskom-count-var (+ lyskom-count-var antal))
    (lyskom-resume 'membership)))


(defun lyskom-list-unread-summary ()
  "Sums up the kom-list-unread command and allows main to start again."
  (if (> lyskom-count-var 0)
      (lyskom-insert
       (if (= lyskom-count-var 1)
	   (lyskom-get-string 'total-unread)
	 (lyskom-format 'total-unreads lyskom-count-var)))
    (lyskom-insert-string 'you-have-read-everything))
  (lyskom-resume 'main)
  (lyskom-end-of-command))


(defun lyskom-time-greater (time1 time2)
  "Returns t if TIME2 is before TIME1 chronologically."
  (cond
   ((< (time->year time2) (time->year time1)))
   ((< (time->mon time2) (time->mon time1)))
   ((< (time->mday time2) (time->mday time1)))
   ((< (time->hour time2) (time->hour time1)))
   ((< (time->min time2) (time->min time1)))
   ((< (time->sec time2) (time->sec time1)))
   (t nil)))


;;; ================================================================
;;;               Lista {rende - list summary

;;; Author: Linus Tolke


(defun kom-list-summary ()
  "List a summary of the unread in the current conf.
The summary contains the date, number of lines, author and subject of the text
on one line."
  (interactive)
  (lyskom-start-of-command 'kom-list-summary)
  (if (read-list-isempty lyskom-reading-list)
      (progn 
	(lyskom-insert-string 'have-to-be-in-conf)
	(lyskom-end-of-command))
    (initiate-get-time 'main 'lyskom-list-summary-all 
		       (text-list->texts 
			(read-info->text-list 
			 (let ((list (read-list->all-entries lyskom-reading-list))
			       (len (read-list-length lyskom-reading-list))
			       (r 0))
			   (while (< r len)
			     (let ((type (read-info->type 
					  (read-list->nth lyskom-reading-list
							  r))))
			       (if (or (eq type 'CONF)
				       (eq type 'REVIEW-MARK)
				       (eq type 'REVIEW))
				   (setq len 0)
				 (++ r))))
			   (read-list->nth lyskom-reading-list r)))))))


(defun lyskom-list-summary-all (time texts)
  "Handles the returned time from kom-list-summary.
Then starts fetching all text-stats and text to list them."
  (if time				;+++ annan felhantering
      (progn
	(lyskom-insert (format "%-7s%-6s%5s%s%s\n"
			       (lyskom-get-string 'Texts)
			       (lyskom-get-string 'Date)
			       (lyskom-get-string 'Lines)
			       (lyskom-fix-str (/ (- (lyskom-window-width) 21)
						  3)
					       (lyskom-get-string 'Author))
			       (lyskom-get-string 'Subject)))
	(lyskom-traverse
	 text-no texts
	 (lyskom-collect 'main)
	 (initiate-get-text-stat 'main nil text-no)
	 (initiate-get-text      'main nil text-no)
	 (lyskom-use 'main 'lyskom-list-summary text-no 
		     (time->year time) (time->yday time))
	 (sit-for 0))))
  (lyskom-run 'main 'lyskom-end-of-command))


(defun lyskom-list-summary (text-stat text text-no year day)
  "Handle the info, fetch the author and print it.
Args: TEXT-STAT TEXT TEXT-NO YEAR DAY.
The year and day is there to be able to choose format on the day.
Format is 23:29 if the text is written today. Otherwise 04-01."
  (if (not (and text-stat text))	;+++ B{ttre felhantering.
      (lyskom-format-insert 'could-not-read text-no)
    (let* ((lines (text-stat->no-of-lines text-stat))
	   (txt (text->text-mass text))
	   (eos (string-match (regexp-quote "\n") txt))
	   (subject (substring txt 0 eos))
	   ;; length of the number %%%%%% :7
	   ;; length for time is: 6
	   (time (text-stat->creation-time text-stat))
	   (time (if (and (= year (time->year time))
			  (= day (time->yday time)))
		     (format "%02d:%02d" (time->hour time)
			     		 (time->min time))
		   (format "%02d-%02d" (1+ (time->mon time))
			   	       (time->mday time))))
	   ;; length for lines is: 4
	   ;; We split the rest between author and subject
	   (namelen (/ (- (lyskom-window-width) 21) 3))
	   (subjlen (/ (* (- (lyskom-window-width) 21) 2) 3)))
      (lyskom-insert (lyskom-fix-str 7 (format "%d" text-no)))
      (lyskom-insert time)
      (lyskom-insert (format "%4d  " lines))
      (lyskom-halt 'main)
      (lyskom-queue-print-name 'summary (text-stat->author text-stat)
			       t namelen)
      (lyskom-run 'summary 'lyskom-insert (concat 
					   "  "
					   (lyskom-fix-str subjlen subject)
					   "\n"))
      (lyskom-run 'summary 'lyskom-resume 'main))))



;;; ================================================================
;;;      kom-display-who-buffer - Visa vilka-listan

;;; Author: Linus Tolke


(defun kom-display-who-buffer ()
  "Make the who-buffer appear on the screen as a temp buffer."
  (interactive)
  (lyskom-start-of-command 'kom-display-who-buffer)
  (let ((win (selected-window))
	(who (display-buffer lyskom-who-info-buffer)))
    (unwind-protect
	(progn
	  (select-window who)
	  (if (numberp kom-who-buffer-size-when-displaying)
	      (enlarge-window (- kom-who-buffer-size-when-displaying 
				 (window-height who)))))
      (select-window win)
      (lyskom-end-of-command))))



;;; ================================================================
;;;          Hj{lp vid del av kommando - Help function

;;; Author: Linus Tolke


(defun lyskom-help ()
  "Prints a short list of alternatives when you don't know what you can do."
  (interactive)
  (let* ((tohere (substring (this-command-keys) 0 -1))
	 (binding (key-binding tohere))
	 (keymap (cond
		  ((and (symbolp binding)
			(fboundp binding))
		   (symbol-function binding))
		  (t binding)))
	 (keylis (cond
		  ((vectorp keymap)
		   (let ((lis nil)
			 (r 0))
		     (while (< r (length keymap))
		       (if (aref keymap r)
			   (setq lis (cons (cons r (aref keymap r))
					   lis)))
		       (++ r))
		     (nreverse lis)))
		  (t
		   (cdr keymap))))
	 (text (format "\n%s: \n%s\n"
		       (mapconcat 'single-key-description tohere " ")
		       (mapconcat
			(function
			 (lambda (arg)
			   (format "%c - %s" 
				   (car arg) 
				   (or (lyskom-command-name (cdr arg))
				       (and (keymapp (cdr arg))
					    (lyskom-get-string 'multiple-choice))
				       (cdr arg)))))
			keylis
			"\n")))
	 next-char)
    (if (eq major-mode 'lyskom-mode)
	(progn
	  (lyskom-insert text)
	  (lyskom-end-of-command))
      (with-output-to-temp-buffer "*Help*"
	(princ text)))))
;    (setq next-char (read-char))
;    (cond
;     ((commandp (key-binding (concat tohere (char-to-string next-char))))
;      (command-execute (concat tohere (char-to-string next-char))))
;     (t (lyskom-message (lyskom-get-string 'does-not-exist))))


;;; ================================================================
;;;           Skapa bugg-rapport - Compile bugg-report

;;; Author: Linus Tolke


(defun kom-compile-bug-report ()
  "This command should make it easier to include the correct info in a buggreport"
  (interactive)
  (let* ((curbuf (current-buffer))
	 (old-buf (condition-case ()
			    debugger-old-buffer
			  (void-variable (current-buffer))))
	 (repname "*lyskom-bugreport*"))
    (set-buffer old-buf)
    (cond
     ((eq old-buf (process-buffer lyskom-proc)))
     ((save-excursion
	(set-buffer (process-buffer lyskom-proc))
	(set-buffer lyskom-unparsed-buffer)
	(eq old-buf (current-buffer)))
      (set-buffer (process-buffer lyskom-proc)))
     (t
      (error "I dont know what buffer you are running lyskom in (%s)?" 
	     old-buf)))
    (with-output-to-temp-buffer repname
      (princ (lyskom-get-string 'buggreport-description))
      (princ (lyskom-get-string 'buggreport-internals))
      (princ (lyskom-get-string 'buggreport-version))
      (print lyskom-clientversion)
      (print lyskom-server-info)
      (princ (lyskom-get-string 'buggreport-pending-calls))
      (print lyskom-pending-calls)
      (princ (lyskom-get-string 'buggreport-call-data))
      (print lyskom-call-data)
      (princ (lyskom-get-string 'buggreport-unparsed))
      (print (save-excursion
	       (set-buffer lyskom-unparsed-buffer)
	       (goto-char (point-min))
	       (forward-line 10)
	       (buffer-substring (point-min) (point))))
      (princ (lyskom-get-string 'buggreport-reading-list))
      (print lyskom-reading-list)
      (princ (lyskom-get-string 'buggreport-to-do-list))
      (print lyskom-to-do-list)
      (if (condition-case ()
	      debugger-old-buffer
	    (void-variable nil))
909
910
911
912
913
	  (princ (lyskom-format 'buggreport-backtrace
				(save-excursion
				  (set-buffer curbuf)
				  (buffer-substring (point-min) 
						    (point-max))))))
Per Cederqvist's avatar
.    
Per Cederqvist committed
914
915
916
917
918
919
920
921
922
      (if lyskom-debug-communications-to-buffer
	  (progn
	    (princ (lyskom-get-string 'buggreport-communications))
	    (print (save-excursion
		     (set-buffer lyskom-debug-communications-to-buffer-buffer)
		     (buffer-substring (point-min) (point-max)))))))
    (save-excursion
      (set-buffer repname)
      (goto-char (point-min))
923
      (replace-regexp "byte-code(\".*\""
Per Cederqvist's avatar
.    
Per Cederqvist committed
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
		      (lyskom-get-string 'buggreport-instead-of-byte-comp)))
    (lyskom-edit-text lyskom-proc
		      (lyskom-create-misc-list 'recpt 79 'cc-recpt lyskom-pers-no)
		      (lyskom-format 'buggreport-subject
			      lyskom-clientversion)
		      (save-excursion
			(set-buffer repname)
			(buffer-string)))))


; ;;; ================================================================
; ;;;          Status f|r en session - Status session
; 
; ;;; Author: ceder
;
; 
; (defun kom-status-session ()
;   "Show some status about this session."
;   (interactive)
;   (lyskom-start-of-command 'kom-status-session)
;   (lyskom-collect 'ss)
;   (initiate-get-session-info 'ss nil)
;   (initiate-get-conf-stat 'ss nil lyskom-current-pers-no)
;   (initiate-get-conf-stat 'ss nil lyskom-current-conf)
;   (lyskom-use 'ss 'lyskom-print-status-session)
;   (lyskom-run 'ss 'lyskom-end-of-comand))
;
; 
; (defun lyskom-print-status-session (session-info person working)
;   "Print a short message in the *lyskom* buffer.
; Args: SESSION-INFO PERSON WORKING.
; PERSON is conf-stat of the user, or nil if he hasn't logged in.
; WORKING is conf-stat of current conference, or nil."
;   (cond
;    ((null person)
;     (lyskom-insert-string 'not-logged-in))
;    ((null working)
;     (lyskom-insert
;      (lyskom-format 'name-is-not-in-conf (conf-stat->name person))))
;    (t
;     (lyskom-insert
;      (lyskom-format 'name-is-in-conf (conf-stat->name person)
; 	     (conf-stat->name working)))))
;   (lyskom-insert
;    (lyskom-format 'connected-during
;     (session-info->connect-time session-info))))
; 
; ;ceder (Per Cederqvist) {r n{rvarande i
; ;PC/AT/386-(,icke-)kompatibla med/utan (MS,PC)DOS - 69 ol{sta.
; ;Totalt 86 ol{sta i 12 m|ten.   N{rvarotid: 0:12:03


;;; ================================================================
;;;      [ndra livsl{ngd - Set lifespan of texts in a conference

;;; Author: Inge Wallin


(defun kom-set-garb-nice ()
  "Set the garb-nice value for a conference."
  (interactive)
  (lyskom-start-of-command 'kom-set-garb-nice)
  (lyskom-completing-read-conf-stat 
   'main 'lyskom-set-garb-nice
   (lyskom-get-string 'conf-to-set-garb-nice-q)
   nil nil ""))


(defun lyskom-set-garb-nice (conf-stat)
  "Set the garb-nice value for CONF-STAT."
  (if (not conf-stat)
      (progn
	(lyskom-insert-string 'somebody-deleted-that-conf)
	(lyskom-end-of-command))
    (let ((garb-nice (lyskom-read-number
		      (lyskom-get-string 'new-garb-nice-q))))
      (lyskom-format-insert 'garb-nice-for-is
			    (conf-stat->name conf-stat)
			    garb-nice)
      (initiate-set-garb-nice 'main 'lyskom-set-garb-nice-2
			      (conf-stat->conf-no conf-stat) garb-nice
			      conf-stat))))


(defun lyskom-set-garb-nice-2 (answer conf-stat)
  "Get the answer from lyskom-set-garb-nice and report the result."
  (if (not answer)
      (lyskom-insert-string 'nope)
    (lyskom-insert-string 'done)
    (cache-del-conf-stat (conf-stat->conf-no conf-stat)))
  (lyskom-end-of-command))


;;; ================================================================
;;;                  St{ng av servern - Shutdown

;;; Author: Inge Wallin


(defun kom-shutdown-server ()
  "Shutdown the LysKOM server."
  (interactive)
  (lyskom-start-of-command 'kom-shutdown-server)
  (if (ja-or-nej-p (lyskom-get-string 'really-shutdown))
      (progn
	(lyskom-insert-string 'closing-server)
	(initiate-shutdown 'main 'lyskom-handle-command-answer 0))
    (lyskom-end-of-command)))


;;; ================================================================
;;;       \verg} till adm.mod - Enable administrator capabilities
;;;     \verg} till normalmod - Disable administrator capabilities

;;; Author: Inge Wallin


(defun kom-enable-adm-caps ()
  "Enable the LysKOM adminstrator commands for the current user."
  (interactive)
  (lyskom-start-of-command 'kom-enable-adm-caps)
  (initiate-enable 'main 'lyskom-enable-adm-caps 255 
		   (lyskom-get-string 'administrator) t))


(defun kom-disable-adm-caps ()
  "Disable the LysKOM adminstrator commands for the current user."
  (interactive)
  (lyskom-start-of-command 'kom-disable-adm-caps)
  (initiate-enable 'main 'lyskom-enable-adm-caps 0 
		   (lyskom-get-string 'no-longer-administrator) nil))


(defun lyskom-enable-adm-caps (answer string is-administrator)
  "Tell the user if the call succeded."
  (if answer
      (progn
	(lyskom-format-insert 'you-are-now string)
	(setq lyskom-is-administrator is-administrator))
    (lyskom-insert-string 'nope))
  (lyskom-end-of-command))


;;; ================================================================
;;;         S{tt loginmeddelande - Set message of the day

;;; Author: Inge Wallin


(defun kom-set-motd ()
  "Set the message of the day for LysKOM."
  (interactive)
  (lyskom-start-of-command 'kom-set-motd)
  (if (server-info->motd-of-lyskom lyskom-server-info)
      (initiate-get-text 'main 'lyskom-set-motd
			 (server-info->motd-of-lyskom lyskom-server-info))
    (lyskom-set-motd nil)))


(defun lyskom-set-motd (old-motd-text)
  "Set the message of the day for LysKOM. 
Use OLD-MOTD-TEXT as the default text if non-nil."
  
  (lyskom-edit-text
   lyskom-proc
1089
   (lyskom-create-misc-list)
Per Cederqvist's avatar
.    
Per Cederqvist committed
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
   (if (and old-motd-text
	    (string-match "\n" (text->text-mass old-motd-text)))
       (substring (text->text-mass old-motd-text) 0 (1- (match-end 0)))
     "")
   (if (and old-motd-text
	    (string-match "\n" (text->text-mass old-motd-text)))
       (substring (text->text-mass old-motd-text) (match-end 0))
     "")
   'lyskom-set-motd-2))


(defun lyskom-set-motd-2 (text-no)
  "Set motd of LysKOM to the newly created text TEXT-NO."
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
  (lyskom-insert-before-prompt
   (lyskom-format 'setting-motd text-no))
  (initiate-set-motd-of-lyskom 'background 'lyskom-set-motd-3
			       text-no text-no))


(defun lyskom-set-motd-3 (result text-no)
  "Handle the return from the initiate-set-motd-of-lyskom call."
  (if result
      (progn
	(lyskom-insert-before-prompt
	 (lyskom-get-string (if (zerop text-no)
				'removed-motd 
			      'set-motd-success)))
	(set-server-info->motd-of-lyskom lyskom-server-info text-no))
    (lyskom-insert-before-prompt
     (lyskom-get-string 'set-motd-failed))))
Per Cederqvist's avatar
.    
Per Cederqvist committed
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132


;;; ================================================================
;;;       Ta bort loginmeddelande - Remove message of the day

;;; Author: Inge Wallin


(defun kom-remove-motd ()
  "Remove the message of the day for LysKOM."
  (interactive)
  (lyskom-start-of-command 'kom-remove-motd)
  (lyskom-insert-string 'removing-motd)
1133
1134
1135
  (initiate-set-motd-of-lyskom 'background 'lyskom-set-motd-3
			       0 0)
  (lyskom-end-of-command))
Per Cederqvist's avatar
.    
Per Cederqvist committed
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150

;;; ================================================================
;;;                  Kasta ut - force logout

;;; Author: Inge Wallin


(defun kom-force-logout ()
  "Force another user to log out."
  (interactive)
  (lyskom-start-of-command 'kom-force-logout)
  (let ((session (lyskom-read-number (lyskom-get-string 'who-to-throw-out))))
    (lyskom-format-insert 'throwing-out session)
    (initiate-disconnect 'main 'lyskom-handle-command-answer
			 session)))
Per Cederqvist's avatar
Per Cederqvist committed
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186

;;; ================================================================
;;;                  Skjut upp l{sning - postpone

;;; Author: Per Cederqvist


(defun kom-postpone (today)
  "Postpone the reading of all but the last TODAY articles in the
current conference to another session."
  (interactive (list
		(cond
		 ((null current-prefix-arg)
		  (lyskom-read-number
		   (lyskom-get-string 'postpone-prompt)
		   17))
		 (t (prefix-numeric-value current-prefix-arg)))))

  (lyskom-start-of-command 'kom-postpone)

  (let ((len (read-list-length lyskom-reading-list))
	(finished nil))
    (while (and (not finished)
		(> len 0))
      (let ((type (read-info->type (read-list->first lyskom-reading-list))))
	(cond 
	 ((or (eq type 'REVIEW)
	      (eq type 'REVIEW-TREE)
	      (eq type 'REVIEW-MARK))
	  (read-list-rotate lyskom-reading-list))
	 ((or (eq type 'COMM-IN)
	      (eq type 'FOOTN-IN))
	  (set-read-list-del-first lyskom-reading-list))
	 ((eq type 'CONF)
	  (let* ((rlist (read-info->text-list
			 (read-list->first lyskom-reading-list)))
Linus Tolke's avatar
Linus Tolke committed
1187
		 (cell (nthcdr (max (- (length rlist) today) 1)
Per Cederqvist's avatar
Per Cederqvist committed
1188
1189
1190
1191
1192
1193
			       rlist)))
	    (setcdr rlist cell))
	  (setq finished t))
	 (t
	  (signal 'lyskom-internal-error '("lyskom-remove-comment-chains")))))
      (-- len)))
Per Cederqvist's avatar
Per Cederqvist committed
1194
1195
1196
1197
1198
1199
1200

  ;; Delete the 'CONF entry if we selected 0 entries.
  (cond
   ((zerop today)
    (read-list-delete-text nil lyskom-reading-list)
    (read-list-delete-text nil lyskom-to-do-list)))

Per Cederqvist's avatar
Per Cederqvist committed
1201
  (lyskom-end-of-command))