vars.el 14.3 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
;;;; ================================================================
;;;; ================================================================
;;;;
;;;; File: vars.el
;;;;
;;;; This file contains almost all the variables used in lyskom.
;;;;



(provide 'lyskom)


;;;; ================================================================
;;;;                    Emacs dependant variables

(defvar kom-emacs-knows-iso-8859-1 nil
  "*If non-nil then dont convert texts and other things to swascii.
This variable is not saved. It should be set in your .emacs")


;;;; ================================================================
;;;;                     Variables and constants.


;;; User flags

(defvar kom-write-texts-in-window nil
  "*Nil means edit texts in the same window that is used for reading texts.
'other means edit in another window. Creating that window if necessary.
A buffer or buffer name means use the first window displaying that buffer.
If no window is displaying that buffer or the buffer does not exits then it
uses the same window.")

(defvar kom-created-texts-are-read t
  "*Non-nil means automatically mark texts that you create as read.")

(defvar kom-default-mark 100
  "*If non-nil (must be an integer) then the user is not asked for type of mark.")

(defvar kom-reading-puts-comments-in-pointers-last t
  "*If Non-nil the texts are shown with comments references at the end.")

(defvar kom-dashed-lines t
  "*If Non-nil then all texts will be surrounded by lines of dashes.")

(defvar kom-print-number-of-unread-on-entrance t
  "*If Non-nil then print automatically the number of unread articles when
entering a conference.")

(defvar kom-presence-messages t
  "*If non-nil, lyskom prints continuous info about what other people are doing.
Info is printed on the message line and never in the buffer. If minibuffer is
used then no message is printed.")

(defvar kom-presence-messages-in-buffer nil
  "*If t, lyskom prints information about what other people are doing in buffer.
All printing is done just before the prompt.
If nil no messages are printed.
If presence then messages about people logging in, out and people changing name
is printed.")


(defvar kom-show-where-and-what t
  "*Non-nil means kom-who-is-on shows from which machine the user is running
and what he is doing.")

(defvar kom-who-buffer-size-when-displaying 10
  "*Size of window to display the who-buffer.
This is used when executing the kom-display-who-buffer command.")

(defvar kom-read-depth-first t
  "*Non-nil means read comments and footnotes to a text before other texts.")

(defvar kom-higher-priority-breaks nil
  "*Non-nil means allow texts from conferences with highter priority to break in.
If the value is 'express then texts are allowed to break in the middle of a
comment chain.  Otherwise we dont let them in until the end of the comment
tree.")

(defvar kom-do-when-starting nil
  "*What to do when logged in.
This is a list of commands that are executed after we have logged in but before
any command is accepted from the keyboard.
The syntax is the same as for the kom-do-when-starting variable except that the
last element is not remembered forever. These are executed as soon as we get a
new prompt i.e. non-stop at login.")

(defvar kom-do-when-done '("}am" "t")
  "*What to do when all texts are read.
This is a list of commands and lists of commands that are prompted for
and executed when there are no more new texts.  The last element in
the list is the one that will never be removed from the list.
A command can be one of:
type			prompt
lyskom-function		from the lyskom-command-name function.
command			\"Kommandot:\" name of function or definition of
			lambda expression
keyboard macro		\"Kommandot:\" keyboard macro definition.")

(defvar kom-page-before-command nil
  "*Non-nil means always clear screen before executing any command.")

(defvar kom-membership-default-priority 100
  "*Default priority when joining a new conference.
If a valid priority then new conferences are read with this priority. 
Otherwise ask the user for a priority.

Valid priorities are only the range 0-255.")

(defvar kom-membership-default-placement 'last
  "*Tells the system where to put new conferences.
The value can be one of the following:
'first => before all other conferences.
'last => after all other conferences.
a number => at that position
otherwise => the new conf is entered after all conferences.")

(defvar lyskom-prompt-text " - "
  "*Text to end the prompt.")

(defvar lyskom-prompt-executing-default-command-text ". "
  "*Text to end the prompt while the default-commands is executing.")



127
(defconst lyskom-elisp-variables '(
Per Cederqvist's avatar
.    
Per Cederqvist committed
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
  kom-do-when-done
  kom-do-when-starting
  kom-mercial 
  kom-higher-priority-breaks
  kom-membership-default-placement
  kom-membership-default-priority
  kom-page-before-command 
  kom-presence-messages-in-buffer
  kom-show-where-and-what
  kom-who-buffer-size-when-displaying
  kom-write-texts-in-window
  lyskom-fetch-map-nos
  lyskom-header-separator
  lyskom-new-text-hook
  lyskom-prefetch-conf-tresh 
  lyskom-prefetch-confs
  lyskom-prefetch-texts
  lyskom-who-info-has-changed-hook
146
147
  lyskom-prompt-text
  lyskom-prompt-executing-default-command-text
Per Cederqvist's avatar
.    
Per Cederqvist committed
148
  )
149
  "Tells the client what flags and hooks that are to be saved in the server.
Per Cederqvist's avatar
.    
Per Cederqvist committed
150
151
These are the flags that are saved in the elisp-client part of the server.")

152
(defconst lyskom-global-boolean-variables '(
Per Cederqvist's avatar
.    
Per Cederqvist committed
153
154
155
156
157
158
159
  kom-created-texts-are-read
  kom-dashed-lines
  kom-presence-messages
  kom-print-number-of-unread-on-entrance
  kom-read-depth-first
  kom-reading-puts-comments-in-pointers-last
)
160
161
  "List of flags that are to be saved as booleans in the common block.

Per Cederqvist's avatar
.    
Per Cederqvist committed
162
163
Dont change this. These are defined by the protocol.")
				  
164
165
166
167
168
169
170
171
(defconst lyskom-global-non-boolean-variables '(
  kom-default-mark
)
  "List of flags that are to be saved in the common block.
These are the non-boolean ones. See: lyskom-global-boolean-variables.

Dont change this. These are defined by the protocol.")

Per Cederqvist's avatar
.    
Per Cederqvist committed
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
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
298
299
300
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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
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

;;; ================================================================
;;;                  Internal variables and constants


(defconst lyskom-clientversion "0.34"
  "Version of the LysKOM elisp client.")

(defconst lyskom-max-int 8388607
  "The largest int emacs, and thus this LysKOM client, can handle.")

(defvar lyskom-max-packet-size lyskom-max-int
  "The largest possible packet size that can be transmitted to a
TCP/IP connection. This should be unlimited, but in practise there
are systems that limits this. This variable is automatically adjusted
if any problems are detected.")

(defvar lyskom-unparsed-buffer nil
  "Buffer containing unparsed information from the server.")

(defvar lyskom-unparsed-marker nil
  "Here are we inserting now.")

(defvar lyskom-to-be-printed-before-prompt nil
  "Contains the strings to be printed out before the next prompt.")

(defvar lyskom-other-clients-user-areas nil
  "Contains the parts of the user areas of unknown klients.
The area is a pair: name . info (both strings).")

(defvar lyskom-pending-calls nil
  "Assoc-list of calls to LysKOM server that have not yet completed.
Each element on the list has the format
	(REF-NO . KOM-QUEUE)
REF-NO	   unique number assigned by lyskom-send-packet.
KOM-QUEUE is a kom-queue. (See lyskom-call-data).")

(defvar lyskom-output-queue nil
  "Pending output to the server.
At most lyskom-max-pending-calls calls are sent at once.")

(defvar lyskom-max-pending-calls 20
  "*Max number of calls that are transmitted to the server at once.
Extra calls are queued in lyskom-output-queue and sent when the replies
returns.")

(defvar lyskom-number-of-pending-calls 0
  "Number of pending calls that are transmitted to the server.")

(defvar lyskom-ref-no 0
  "Next ref-no to use. These ref-nos are used to keep track of the
different packets.")

(defvar lyskom-pers-no 0
  "The pers-no of the current user.")

(defvar lyskom-session-no 0
  "Session number in the server for this connection")

(defvar lyskom-proc nil
  "The process (network connection) that is associated with this buffer.")

(defvar lyskom-server-info nil
  "Info about the server")


(defvar lyskom-conf-cache nil
  "Cache of conference statuses.")

(defvar lyskom-pers-cache nil
  "Cache of person statuses.")

(defvar lyskom-text-cache nil
  "Cache of text statuses.")

(defvar lyskom-text-mass-cache nil
  "Cache of texts.")

(defvar lyskom-marked-text-cache nil
  "Cache of marks of all texts the current user has marked. ")

(defvar lyskom-who-info-cache nil
  "Cache of people presently logged in in LysKOM.")

(defvar lyskom-who-info-buffer nil
  "Buffer for the who info presentation.")


(defvar lyskom-is-parsing t
  "True when parsing a result.
This is used to prevent parallell parsing since the parser is not reentrant.")

(defvar lyskom-string-bytes-missing 0
  "Number of bytes missing in the unparsed buffer when parsing a string.
Set when parsing a string and there were not enough bytes in the buffer
with the unparsed bytes. This variable is used to prevent reparsing before 
the string is complete.
This variable is buffer-local in the unparsed-buffer.")

(defvar lyskom-last-viewed 0
  "Postition of the first char of the last line that the user has had
time to view. This is normally the pos of the first char of the prompt.")

(defvar lyskom-mode-map nil
  "Keymap used in LysKOM mode.")


(defvar lyskom-reading-list nil
  "List of articles to read in the current conference.
Each element is a read-info. Only one of the elements is of the type CONF.
This one is located last in the list (except for the elements of the type 
REVIEW, REVIEW-TREE or REVIEW-MARK).
When reading an article with comments a list of the comments is built
recursively if the flag kom-read-depth-first is non-nil.
This is to keep track of the reading order.
Articles can exist in several of the read-info elements. All unread articles
in the conference are always present in the CONF type entry in this list even
if also in other entries. (COMM-IN, FOOTN-IN)

Some powerful reviewing commands requires to construct a list of articles that
should be read. These use the type REVIEW. When reviewing trees and when
every viewed article is supposed to be followed by all its comments then the
type REVIEW-TREE is used.

The first element is a dummy.")

(defvar lyskom-to-do-list nil
  "List of conferences with unread texts.
Each element is a read-info. All have the type 'CONF and there is one for
every conference with unread articles that have been prefetched already.
The list is sorted in falling priority. 
When going to a conference the first element (the one with the highest
priority) is copied from this list to lyskom-reading-list.

The first element is a dummy.")


;;; These variables control prefetch of conf-stats, text-stats and texts:

(defvar lyskom-prefetch-texts 3
  "*Number of texts to prefetch.")

(defvar lyskom-prefetch-conf-tresh 50
  "*If fewer than lyskom-prefetch-conf-tresh texts are known, ask for more
conf-stats from server.")

(defvar lyskom-prefetch-confs 10
  "*Number of confs to ask about at once when checking for unread texts.")

(defvar lyskom-fetch-map-nos 50
  "*Number of text-nos lyskom will fetch when fetching maps.
+++ This is not yet used everywhere.")

(defvar lyskom-last-conf-fetched -1
  "Last conf asked about. Number on the list lyskom-membership.")

(defvar lyskom-last-conf-received -1
  "Last conf known about. See lyskom-last-conf-fetched.")



(defvar lyskom-membership nil
  "Sorted membership-list of the logged in person.")

(defvar lyskom-unread-confs nil
  "List containing all unread confs.")

(defvar lyskom-no-prompt t
  "Non-nil if no prompt is displayed yet.")

(defvar lyskom-dont-change-prompt nil
  "Non-nil during the entry of a text.")

(defvar lyskom-fetched-texts nil
  "List of texts that are prefetched.")

(defvar lyskom-command-to-do 'unknown
  "Atom describing what command to do. See the function lyskom-what-to-do.")

(defvar lyskom-is-waiting nil
  "If non-nil then this is the condition for the waiting to be stopped.
If t however just meaning user is waiting for a text with prompt.
It is a form that will be evaluated (using eval) every time the asynchronous
message \"new text\" is received.")

(defvar lyskom-current-conf 0
  "Current conference. 0 means user is not reading any conf.")

(defvar lyskom-current-text nil
  "Text-no of current text. nil means no text is current.")

(defvar lyskom-previous-text nil
  "Text-no of previous text.  Nil means no text.")

(defvar lyskom-current-subject ""
  "Current subject.")


(defvar lyskom-mode-hook nil
  "Hook to run when lyskom-mode is entered.")

(defvar lyskom-new-text-hook nil
  "*Hook to run when a new text is created.
This hook is run after the prompt is removed if it shall be changed but before
the text Text 4711 {r skapad! is printed in the message area. And before the
new prompt is printed.
If the text: Text 4711 {r skapad! should not be printed then the hook should 
set the local variable no-message non-nil.")

(defvar lyskom-who-info-has-changed-hook nil
  "*Hook to run every time the who-info-buffer has changed.
The hook is run with current-buffer the lyskom buffer, not the who-info-buffer.")

(defvar lyskom-executing-command t
  "Non-nil means the client is executing a command.
Most commands can't be interrupted by another command.")

(defvar kom-low-priority -1
  "*Priority that the current conference are set to when they are
aborted. nil means don't alter priority. (That means that
kom-go-to-next-conf might go to the same conference again.)")

(defvar lyskom-membership-is-read nil
  "T when the membership has been read.")

(defvar lyskom-is-writing nil
  "t when the user is writing a text.")

(defvar lyskom-debug-communications-to-buffer nil
  "Non-nil means all communications with the server is stored in a buffer.
The name is stored in lyskom-debug-communications-to-buffer-buffer.")
  
(defvar lyskom-debug-communications-to-buffer-buffer nil
  "Name of the buffer to insert the communications with the server into if
lyskom-debug-communications-to-buffer is non-nil.")


(defvar lyskom-count-var 0
  "This variable is used for counting things in the client, such as
unread texts in list-unread.")


(defvar lyskom-is-administrator nil
  "This variable is t if the user is in administrator mode and nil otherwise.")


;;; ================================================================
;;;          Externally defined variables (environment)


(defvar lyskom-default-server "kom.lysator.liu.se"
  "*Default LysKOM server.")

(defvar lyskom-default-user-name nil
  "*Default LysKOM user name.")

(defvar lyskom-default-password nil
  "Default LysKOM PASSWORD.")