vars.el.in 165 KB
Newer Older
David Byers's avatar
David Byers committed
1
;;;;; -*-coding: raw-text;mode: emacs-lisp;-*-
Linus Tolke's avatar
Linus Tolke committed
2
;;;;; $Id$
3
;;;;; Copyright (C) 1991-2002  Lysator Academic Computer Association.
Linus Tolke's avatar
Linus Tolke committed
4
;;;;;
5
;;;;; This file is part of the LysKOM Emacs LISP client.
Linus Tolke's avatar
Linus Tolke committed
6
7
8
;;;;; 
;;;;; LysKOM is free software; you can redistribute it and/or modify it
;;;;; under the terms of the GNU General Public License as published by 
9
;;;;; the Free Software Foundation; either version 2, or (at your option) 
Linus Tolke's avatar
Linus Tolke committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
;;;;; any later version.
;;;;; 
;;;;; LysKOM is distributed in the hope that it will be useful, but WITHOUT
;;;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
;;;;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
;;;;; for more details.
;;;;; 
;;;;; You should have received a copy of the GNU General Public License
;;;;; along with LysKOM; see the file COPYING.  If not, write to
;;;;; Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
;;;;; or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, 
;;;;; MA 02139, USA.
;;;;;
;;;;; Please mail bug reports to bug-lyskom@lysator.liu.se. 
;;;;;
Per Cederqvist's avatar
.  
Per Cederqvist committed
25
26
27
28
29
30
31
32
;;;; ================================================================
;;;; ================================================================
;;;;
;;;; File: vars.el
;;;;
;;;; This file contains almost all the variables used in lyskom.
;;;;

33
34
;;;; Note: put "**" at the front of docstrings that are ready
;;;; for use in DocBook autogeneration.
35
36
37
;;;;
;;;; Rules for documentation that can be translated to DocBook
;;;; is in interndoc/vardoc
38

Per Cederqvist's avatar
.  
Per Cederqvist committed
39

David Byers's avatar
X    
David Byers committed
40
41
42
(setq lyskom-clientversion-long 
      (concat lyskom-clientversion-long
	      "$Id$\n"))
43

44
45
(defvar lyskom-dummy-variable-to-fool-the-byte-compiler)

David Byers's avatar
David Byers committed
46
(defvar lyskom-mule-compiled
47
48
  (eval-when-compile (and (fboundp 'multibyte-string-p)
                          (multibyte-string-p "ÅÄÖ")))
David Byers's avatar
David Byers committed
49
50
  "Non-nil if the client was compiled with multibyte characters enabled")

David Byers's avatar
X    
David Byers committed
51
(provide 'lyskom)
52

David Byers's avatar
X    
David Byers committed
53
(require 'lyskom-defvar "defvar")
Per Cederqvist's avatar
.  
Per Cederqvist committed
54

55
56
57
(defconst lyskom-global-variable-types
  '((boolean (read . lyskom-flag-read-boolean)
             (write . lyskom-flag-write-boolean))
58
59
    (integer (read . lyskom-flag-read-integer)
             (write . lyskom-flag-write-integer))
60
61
62
63
    (symbol-list (read . lyskom-flag-read-symbol-list)
                 (write . lyskom-flag-write-symbol-list))
    (t (read . lyskom-flag-read-from-string)
       (write . prin1-to-string))))
David Byers's avatar
David Byers committed
64

David Byers's avatar
X    
David Byers committed
65
66

(defun lyskom-protect-variable (sym) 
David Byers's avatar
David Byers committed
67
  "Protect SYM from being killed when deleting local variables."
David Byers's avatar
X    
David Byers committed
68
69
70
71
72
  (put sym 'permanent-local t)
  (lyskom-local-variable sym)
  (add-to-list 'lyskom-protected-variables sym))

(defun lyskom-local-variable (sym)
David Byers's avatar
David Byers committed
73
  "Define SYM as a buffer-local variable"
David Byers's avatar
X    
David Byers committed
74
75
76
  (add-to-list 'lyskom-local-variables sym))

(defun lyskom-inherited-variable (sym)
David Byers's avatar
David Byers committed
77
78
  "Define SYM as a variable that is inherited when creating new buffers.
Inheritance only works with the LysKOM buffer handling functions."
David Byers's avatar
X    
David Byers committed
79
80
81
82
  (add-to-list 'lyskom-inherited-variable sym)
  (lyskom-protect-variable sym))

(defun lyskom-setup-local-variables ()
David Byers's avatar
David Byers committed
83
  "Set up all globally defined local variables in the current buffer."
David Byers's avatar
X    
David Byers committed
84
  (mapcar 'make-local-variable lyskom-local-variables)
85
  (mapcar 'lyskom-make-local-hook lyskom-local-hooks))
Per Cederqvist's avatar
.  
Per Cederqvist committed
86

David Byers's avatar
David Byers committed
87
88
89
(defvar lyskom-is-loaded nil
  "Non-nil when lyskom has been loaded.")

90
91
92
(defvar lyskom-have-one-login nil
  "Non-nil after the first login")

David Byers's avatar
David Byers committed
93

David Byers's avatar
David Byers committed
94
95
(def-kom-var kom-dont-read-saved-variables '(kom-dont-read-saved-variables
                                             lyskom-login-hook)
David Byers's avatar
David Byers committed
96
  "**Determines which LysKOM variables to not store in the server.
97
98
99
100
101
102
103
104
105
106

For the most part you do not have to modify this variable. Any variables
set before LysKOM is loaded will not be read from the server.
This variable should `nil', `t' or a list of symbols. 

The value `nil' means read all variables from the server. The value
`t' means read no variables from the server. When the value is a list
of symbols, those variables will not be read from the server.

Any other values are reserved for future use.")
David Byers's avatar
David Byers committed
107

108
109
110
111
(defmacro lyskom-maybe-setq (var value)
  "This is a wrapper around setq that does nothing
if the variable is in kom-dont-read-saved-variables."
  `(cond ((eq kom-dont-read-saved-variables t) nil)
112
         ((memq ,var kom-dont-read-saved-variables) nil)
David Byers's avatar
David Byers committed
113
         (t (set ,var ,value))))
114
115
116
117
118

(defmacro lyskom-maybe-setq-default (var value)
  "This is a wrapper around setq-default that does nothing
if the variable is in kom-dont-read-saved-variables."
  `(cond ((eq kom-dont-read-saved-variables t) nil)
119
         ((memq ,var kom-dont-read-saved-variables) nil)
120
         (t (set-default ',var ,value))))
Per Cederqvist's avatar
.  
Per Cederqvist committed
121
122
123
124
125
126
127

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


;;; User flags

128
129
130
131
132
133
134
135
136
137
138
(def-kom-var kom-auto-confirm-new-conferences nil
  "**Determines behavior of `kom-list-new-conferences' and `kom-list-new-persons'.

When this variable is set to `t', `kom-list-new-conferences' and
`kom-list-new-persons' will automatically mark all listed conferences
and persons as known. When set to `nil', these commands will ask for
confirmation before marking the listed conferences and persons as known.

Values other than `t' and `nil' are reserved for future use."
  server)

David Byers's avatar
David Byers committed
139
(def-kom-var kom-dont-complain-about-missing-presentation nil
140
  "**Controls whether the client complains when you don't have
David Byers's avatar
David Byers committed
141
142
143
144
145
146
147
a presentation. When set to non-nil, the client will never
complain.

This variable should not be documented. Anybody asocial enough
to want this feature ought to have to work to find it."
  server)

148
149
150
151
152
153
154
155
156
157
158
159
(def-kom-var kom-show-sync-messages nil
  "**Controls display of database saving message.

When this variable is set to `t', the client will show a message in
the echo area when the LysKOM server signals that it is saving the
database. When set to `nil', no message is shown (the mode line is
changed regardless of the setting of this variable).

Values other than `t' and `nil' are reserved for future use."
  server)


160
161
162
163
(def-kom-var kom-text-links
  '((t ("\\<bug[ \t\n]+\\([0-9]+\\)\\>"
	"http://bugzilla.lysator.liu.se/show_bug.cgi?id=\\1"
	0 t)))
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
  "**Defines patterns for automatic links in the text.

This variable defines patterns to look for in text and convert to
links to URLs. The value of this variable must be an alist, where the
key (car) is a conference number and the value (cdr) is a list of link
specifications for that conference. The special value `t' for the key
indicates a list of patterns to apply in all conferences. Key values
other than positive integers and `t' are reserved for future use.

Each link specification is in turn a list \(`PATTERN' `REPLACEMENT'
`HIGHLIGHT' `IGNORE-CASE'), where `PATTERN' is a regular expression to
look for in the text, `REPLACEMENT' is used to generate a URL from the
text matching `PATTERN', `HIGHLIGHT' is the pattern group to highlight
as a URL and `IGNORE-CASE' specifies whether matching is
case-sensitive or not.

Each text is examined for each `PATTERN'. If a match is found, a URL
181
182
is created from `REPLACEMENT'. All characters except backslash are
copied verbatim. The backslash character starts one of the following
183
184
185
sequences:

    Sequence    Meaning
186
187
188
189
    -----------------------------------------------------------------
    `\\&'          Substitute the matched text

    `\\N'          Substitute match for text matching the Nth (...)
190
                group in `PATTERN'
191
192
193

    `\\\\'          Insert one backslash.
    -----------------------------------------------------------------
194
195

The `HIGHLIGHT' parameter specifies which (...) group in `PATTERN'
196
to highlight as an URL. Use 0 to highlight the entire match.
197
198
199
200
201
202
203
204

Finally, if `IGNORE-CASE' is `t', then ignore character case while
looking for `PATTERN'. Values other than `t' and `nil' are reserved
for future use.

When a text has more than one recipient, links will be generated for
all recipients. The order in which the recipients are examined and
the priority among links that match the same text is undefined."
205
206
  server)

207

208
(def-kom-var lyskom-default-conference-strategy
209
210
211
212
  '((kom-start-anew (what-is-your-name
                     (default . (lyskom-default-conference-empty))))

    (kom-delete-conf (what-conf-to-delete
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
                      (default . (lyskom-default-conference-empty))))

    (kom-sub-self (leave-what-conf
                   (filter . (lyskom-default-conference-not-self))))

    (kom-change-priority (what-to-change-pres-you
                          (default . (lyskom-default-conference-at-point
                                      lyskom-default-conference-self))))

    (kom-change-presentation (what-to-change-pres-you
                              (default . (lyskom-default-conference-at-point
                                          lyskom-default-conference-self))))

    (kom-change-conf-motd (who-to-put-motd-for
                           (default . (lyskom-default-conference-at-point
                                       lyskom-default-conference-self))))

230
    (kom-set-presentation (what-to-set-pres-you
231
232
233
                           (default . (lyskom-default-conference-at-point
                                       lyskom-default-conference-self))))

234
    (kom-set-motd-text (what-to-set-motd-you
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
                        (default . (lyskom-default-conference-at-point
                                    lyskom-default-conference-self))))

    (kom-remove-presentation (who-to-remove-pres-for
                              (default . (lyskom-default-conference-at-point
                                          lyskom-default-conference-self))))

    (kom-unset-conf-motd (who-to-remove-motd-for
                          (default . (lyskom-default-conference-at-point
                                      lyskom-default-conference-self))))

    (kom-go-to-conf (go-to-conf-p
                     (default . (lyskom-default-conference-at-point
                                 lyskom-default-conference-self))
                     (filter . (lyskom-default-conference-not-current))))

    (kom-list-created-conferences (list-confs-created-by
                                   (default . (lyskom-default-conference-at-point
                                               lyskom-default-conference-self))))

    (kom-change-name (name-to-be-changed
                      (default . (lyskom-default-conference-at-point
                                  lyskom-default-conference-self))))

    (kom-change-parenthesis (name-to-be-changed
                             (default . (lyskom-default-conference-at-point
                                         lyskom-default-conference-self))))

    (kom-change-password (whos-passwd
                          (default . (lyskom-default-conference-at-point
                                      lyskom-default-conference-self))))

    (kom-redirect-comments (redirect-for-whom
                            (default . (lyskom-default-conference-at-point
                                        lyskom-default-conference-self)))
                           (redirect-to-which-conf))

    (kom-filter-author (filter-author
                        (default . (lyskom-default-conference-at-point
                                    lyskom-default-conference-last-author))
                        (filter . (lyskom-default-conference-not-self)))
                       (filter-in-conf
                        (filter . (lyskom-default-conference-not-self))))


280
    (kom-review-by-to (review-by-whom
281
282
                       (default . (lyskom-default-conference-at-point
                                   lyskom-default-conference-empty)))
283
                      (review-to-conf))
284

285
    (kom-review-first (review-by-whom
286
287
                       (default . (lyskom-default-conference-at-point
                                   lyskom-default-conference-empty)))
288
                      (review-to-conf))
289

290
    (kom-review-all (review-by-whom
291
292
                     (default . (lyskom-default-conference-at-point
                                 lyskom-default-conference-empty)))
293
                    (review-to-conf))
294

295
    (kom-unread-by-to (unread-by-whom
296
297
                       (default . (lyskom-default-conference-at-point
                                   lyskom-default-conference-empty)))
298
                      (unread-to-conf))
299

300
    (kom-unread-first (unread-by-whom
301
302
                      (default . (lyskom-default-conference-at-point
                                  lyskom-default-conference-empty)))
303
                      (unread-to-conf))
304

305
    (kom-unread-all (unread-by-whom 
306
307
                     (default . (lyskom-default-conference-at-point
                                 lyskom-default-conference-empty)))
308
                    (unread-to-conf))
309

310
311
312
313
    (kom-set-permitted-submitters (conf-to-set-permitted-submitters-q)
                                  (new-permitted-submitters-q
                                   (default . (lyskom-default-conference-empty))))

314
315
316
317
    (lyskom (what-is-your-name 
             (default . (lyskom-default-conference-empty))))


318
319
320
    (kom-add-recipient (who-to-add-q 
                        (default . ((lyskom-default-conference-saved last-added-rcpt)))
                        (save last-added-rcpt)))
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
    (kom-add-copy (who-to-add-copy-q 
                   (default . ((lyskom-default-conference-saved last-added-cc)))
                   (save last-added-cc)))

    (kom-add-bcc (who-to-add-bcc-q 
                  (default . ((lyskom-default-conference-saved last-added-bcc)))
                  (save last-added-bcc)))

    (kom-sub-recipient (who-to-sub-q
                        (default . (lyskom-default-conference-at-point
                                    (lyskom-default-conference-saved last-sub-recipient)
                                    lyskom-default-conference-current
                                    lyskom-default-conference-restriction))
                        (save last-sub-recipient)))

    (kom-move-text (who-to-move-from-q
                    (default . (lyskom-default-conference-at-point
                                (lyskom-default-conference-saved last-sub-recipient)
                                lyskom-default-conference-current
                                lyskom-default-conference-restriction))
                    (save last-sub-recipient))
                   (who-to-move-to-q
                    (default . ((lyskom-default-conference-saved last-added-rcpt)
                                lyskom-default-conference-current))
                    (save last-added-rcpt)))

    (kom-move-text-tree (who-to-move-from-q
                         (default . (lyskom-default-conference-at-point
                                     (lyskom-default-conference-saved last-sub-recipient)
                                     lyskom-default-conference-current
                                     lyskom-default-conference-restriction))
                         (save last-sub-recipient))
                        (who-to-move-to-or-sub-q
                         (default . ((lyskom-default-conference-saved last-added-rcpt)
                                     lyskom-default-conference-current))
357
                         (save last-added-rcpt))
358
                        (who-to-move-to-q
David Byers's avatar
David Byers committed
359
360
361
362
                         (default . ((lyskom-default-conference-saved last-added-rcpt)
                                     lyskom-default-conference-current))
                         (save last-added-rcpt))
                        (who-to-add-q
363
364
365
366
367
368
                         (default . ((lyskom-default-conference-saved last-added-rcpt)
                                     lyskom-default-conference-current))
                         (save last-added-rcpt)))

    (kom-send-message (who-to-send-message-to
                       (default . (lyskom-default-conference-for-send-message))))
369

370
371
372
373
374
375
376
377
    (kom-moronify (moronify-whom
		   (default . (lyskom-default-conference-at-point
			       lyskom-default-conference-last-author))))

    (kom-befriend (befriend-whom
		   (default . (lyskom-default-conference-at-point
			       lyskom-default-conference-last-author))))

David Byers's avatar
David Byers committed
378
379
380
    (kom-send-alarm (who-to-send-message-to
                     (default . (lyskom-default-conference-for-send-message))))

381
382
383
384
    (kom-is-person-member-of-conference (pers-to-check-mship-for)
                                        (conf-to-check-mship-of))


385
386
387

    ;; Defaults and commands that use the defaults

388
389
390
391
392
    (kom-remote-autoreply (remote-control-who))
    (kom-remote-set-message (remote-control-who))
    (kom-remote-list-messages (remote-control-who))
    (kom-remote-erase-messages (remote-control-who))
    (kom-remote-quit (remote-control-who))
393
394
395
396
397
398
399
400
    (kom-review-presentation (presentation-for-whom))
    (kom-unread-presentation (unread-presentation-for-whom))
    (kom-add-member (who-to-add) (where-to-add))
    (kom-add-self (where-to-add-self))
    (kom-change-priority (change-priority-for-q))
    (kom-sub-member (who-to-exclude) (where-from-exclude))
    (kom-write-text (who-send-text-to))
    (kom-send-letter (who-letter-to))
401
    (kom-force-logoout (who-to-throw-out))
402
403
404
405
406
407
408
    (kom-change-supervisor (what-to-change-supervisor-for) (new-supervisor))
    (kom-who-is-on-in-conference (who-is-on-in-what-conference))
    (kom-who-is-present-in-conference (who-is-present-in-what-conference))
    (kom-add-cross-reference (which-conf-to-xref) (which-pers-to-xref))
    (kom-edit-add-cross-reference (which-conf-to-xref) (which-pers-to-xref))
    (kom-edit-insert-link (which-conf-to-link) (which-pers-to-link))
    (kom-status-conf (conf-for-status))
409
    (kom-status-session (session-for-status))
David Byers's avatar
David Byers committed
410
    (kom-force-logout (who-to-throw-out))
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
    (kom-status-person (pers-for-status))
    (kom-set-garb-nice (conf-to-set-garb-nice-q))
    (kom-set-super-conf (conf-to-set-super-conf-q) (new-super-conf-q))
    (kom-set-personal-label (label-what-pers) (label-what-conf))
    (kom-will-person-read-text (pers-to-check-will-read-for))
    (kom-create-aux-item (which-conf-to-add-aux-to))
    (kom-recommend-conference (recommend-which-conf))
    (kom-limit-import (limit-import-to-conf))
    (kom-edit-add-recipient (added-recipient))
    (kom-edit-add-bcc (added-blank-carbon-copy))
    (kom-edit-add-copy (added-carbon-copy))
    (kom-edit-move-text (who-to-move-to-q))
    (kom-add-faq (conf-to-add-faq))
    (kom-del-faq (conf-to-del-faq))
    (kom-review-faq (view-which-faq))
    (kom-unread-faq (unread-which-faq))
    (kom-change-conf-faq (what-to-change-faq-you))
    (kom-list-faqs (conf-to-list-faqs))
    (kom-filter-subject (filter-in-conf))
    (kom-filter-recipient (filter-recipient))
    (kom-filter-text (filter-in-conf))
432
433
    (kom-change-conf-type (what-conf-to-change))
    (kom-change-privileges (what-pers-privs-to-change))
434
    (kom-change-message-flag (set-message-flag-for-conf))
435
436
437
438
439

    (t (t (default . (lyskom-default-conference-at-point
                      lyskom-default-conference-current))))
    )

440
441
  "Strategy for the initial value for conference defaults.

David Byers's avatar
David Byers committed
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
Each element in this list identifies an Emacs och LysKOM command, and
defines the initial values for queries it makes for conference names.

Each element has the following format:

    \(COMMAND . \(\(PROMPT-1 . \(\(default . \(INITIAL-VALUES\\)\\)
                             \(filter  . \(EXCLUDED-CONFS\)\)
                             \(save    . \(SAVE-GROUPS\)\)\)\)
                \(PROMPT-2 . \(\(default . \(INITIAL-VALUES\)\)
                             \(filter  . \(EXCLUDED-CONFS\)\)
                             \(save    . \(SAVE-GROUPS\)\)\)\)
                ...\)\)

COMMAND is the name of a LysKOM or Emacs command. PROMPT-1 and
PROMPT-2 \(there can be any number of prompts liste in a single
command\) are symbols representing the prompt. These are defined
in lyskom-messages in swedish-strings.el and english-strings.el. 

INITIAL-VALUES are functions to call to generate a list of possible
initial values for the prompt. These functions must return lists of
conference numbers. EXCLUDED-CONFS are functions that are called to
eliminate possible initial values. These must take a single argument,
an uconf-stat, and should return the uconf-stat itself if it is a
valid candidate for the initial value, or nil if it is not. Finally,
SAVE-GROUPS are symbols under which the value the user inputs will be
saved.

As a special case, a list in INITIAL-VALUES is interpreted as a
function with arguments. The first element in the list is applied to
the remaining elements.

If `t' is used for COMMAND, it indicates the default to use when no
COMMAND listed matches the current command. If `t' is used for PROMPT,
it indicates defaults, filters and save groups to use when no other
PROMPT matches.


Some useful functions for INITIAL-VALUES are:

lyskom-default-conference-at-point returns the conference shown where
point is. If point is on a conference name, that name will be used as
the initial value.

lyskom-default-conference-current returns the current conference.

lyskom-default-conference-self returns the logged-in person.

lyskom-default-conference-last-author returns the author of the most
recently read text.

492
493
494
lyskom-default-conference-author-of-text-at-point returns the author
of the text at point.

David Byers's avatar
David Byers committed
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
lyskom-default-conference-saved returns saved input. This must be
specified as a list in INITAL-VALUES, where the argument (second
element of the list) is the symbol under which the input was saved,
from \(SAVE-GROUPS\) in one or more commands.


Some useful functions for EXCLUDE-CONFS are:

lyskom-default-conference-not-self excludes the logged-in person.

lyskom-default-conference-not-current excludes the current conference.


The format of this variable may change in the future.
")
510
511


512
(defconst kom-old-farts-text-prompt-strategy
513
  '((kom-comment-previous (nil lyskom-get-previous-text))
514
515
516
517
518
519
520
521
522
    (kom-view-previous-commented-text (nil lyskom-get-previous-text))
    (kom-private-answer-previous (nil lyskom-get-previous-text))
    (t  (t   lyskom-get-last-read-text)
        (nil     lyskom-get-last-read-text)
        (0       lyskom-get-text-at-point)
        (lyskom-eq-dash   (lambda () (lyskom-get-text-above-point 1)))
        (listp   (lambda () (lyskom-tnpa-prompt (lyskom-get-last-read-text))))
        (plusp   current-prefix-arg)
        (minusp  (lambda () (lyskom-get-text-above-point (- current-prefix-arg))))))
David Byers's avatar
David Byers committed
523
524
525
526
527
528
529
530
"Put in your `kom-pick-text-no-strategy-alist' to get the 0.46 behaviour:
 * No prefix argument refers to the most recently read text.
 * The prefix argument zero refers to the text under point.
 * A positive prefix argument is interpreted as a text-no.
 * A negative prefix argument will try to find the text-no
   of the text `arg' messages above point from the current
   kom buffer.")

531
532
533
534
(defconst lyskom-old-farts-text-prompt-strategy
  kom-old-farts-text-prompt-strategy
  "Obsolete: Alias for kom-old-farts-text-prompt-strategy.")

David Byers's avatar
David Byers committed
535
(def-kom-var kom-pick-text-no-strategy-alist
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
  '(

    ;; Abstract specifications

    (read-or-written
     (t   (lambda () (lyskom-tnpa-prompt (lyskom-get-text-at-point))))
     (nil lyskom-get-text-at-point
          (lambda () (lyskom-tnpa-valid
                      (lyskom-tnpa-prompt (lyskom-get-last-written-or-read-by-me))))
          :constraint lyskom-text-written-by-me-p))
    (previous-text (nil lyskom-get-previous-text))
    (commented-text (nil lyskom-maybe-get-commented-text))
    (footnoted-text (nil lyskom-maybe-get-footnoted-text))

    ;; Specifications for actual commands

    (kom-comment-previous             :refer previous-text)
    (kom-view-previous-commented-text :refer previous-text)
    (kom-unread-previous-commented-text :refer previous-text)
    (kom-private-answer-previous      :refer previous-text)
    (kom-sub-comment                  :refer commented-text)
    (kom-sub-footnote                 :refer footnoted-text)
    (kom-write-footnote               :refer read-or-written)
    (kom-add-no-comments              :refer read-or-written)
    (kom-add-private-answer           :refer read-or-written)
    (kom-add-request-confirm          :refer read-or-written)

    ;; Default specification

    (t (nil     lyskom-get-text-at-point)
       (0       (lambda () (lyskom-tnpa-prompt (lyskom-get-text-at-point))))
       (lyskom-eq-dash (lambda () (lyskom-get-text-above-point 1)))
       (car     (lambda () (lyskom-get-text-at-point-ancestor (/ (logb (car current-prefix-arg)) 2))))
       (plusp   (lambda () (lyskom-get-text-below-point current-prefix-arg)))
       (minusp  (lambda () (lyskom-get-text-above-point (- current-prefix-arg))))
       (t       (lambda () (lyskom-tnpa-prompt (lyskom-get-text-at-point))))
       :constraint nil
       :filter  nil
       )
    )
David Byers's avatar
David Byers committed
576
577
  "**Defines how prefix arguments are used by commands to find a text to operate on.

578
579
The format of this list is as follows:

580
<
581
582
583
584
585
586
\((FN-KEY . ((PFX-KEY-1 . (FN1 FN2 ... PROP1 VAL1 PROP2 VAL2 ...)) 
            (PFX-KEY-2 . (FN1 FN2 ... PROP1 VAL1 PROP2 VAL2 ...))
            GPROP1 GVAL1
            GPROP2 GVAL2
            ...))
 ...)
587
>
588

589
`FN-KEY' is the name of a command, `t' or a symbol that does not
590
591
592
593
594
595
correspond to any function. Keys corresponding to commands indicate
configuration for that command. The `t' key indicates fallback
condiguration that applies to all commands, unless overridden by a
command-specific configuration. Other keys can be referenced from
command-specific configurations.

596
`PFX-KEY' is a key that indicates a prefix. If it is an atom not bound
597
to a function, it indicates configuration for prefix arguments eq to
598
the atom \(e.g. 0, - or `nil'). The special key `t' indicates fallback
599
600
601
configuration, used when all prefix-specific configurationas failed to
generate valid values.

602
`FN' is a function or variable used to generate lists of text numbers.
603
604
605
606
If a variable name, the value of the variable is used to generate a
list of text numbers. If a function, the function is called with no
arguments, and is expected to return a list of text numbers.

607
`PROP' is a property name \(see below) and VAL is the corresponding
608
609
610
value. Properties defined at the inner level apply only to results
generated for that prefix. Properties defined at the outer level apply
irrespective of prefix arguments. Properties defined in the default
611
element \(with `FN-KEY' set to `t'\) always apply, unless overridden by
612
613
614
615
non-nil properties in command-specific elements.

The following properties are available:

616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
    Key             Value
    ------------------------------------------------------------------
    `:filter'       A function that is called on all text numbers. The
                    filter function is expected to return a new or 
                    modified text number. This can be used to indicate 
                    that the command should prompt or bypass the 
                    constraint.
    
    `:constraint'  A function that is called on all text numbers. It 
                   should return non-nil for text numbers that are 
                   valid for the command.
    
    `:refer'       A symbol indicating a configuration to use. Useful 
                   when several commands share the same (complex)
                   configuration. May not be used in the default 
                   element.
    ------------------------------------------------------------------
633
634
635
636


The following filter functions may be useful:

637
638
639
640
641
642
643
644
645
    Name                    What it does
    ------------------------------------------------------------------
    `lyskom-tnpa-prompt'    Prompt the user for the text number. The 
                            number used as the argument will be the 
                            default. 
    
    `lyskom-tnpa-valid'     Declare that the text number is valid, 
                            regardless of any constraint functions.
    ------------------------------------------------------------------
646
647
648
649
650
651
652
653
654
655

When `lyskom-read-text-no-prefix-arg' is called, this list is searched
both for a command-specific element and for the default element. Any
`:refer' links are resolved in the command-specific element. The
filter and constraint properties are extracted. These elements are
then searched for prefix-specific elements that match the current
prefix argument. The first text number that is generated that passes
the filter and constraint functions is used as the text number
argument for the command."
)
David Byers's avatar
David Byers committed
656

David Byers's avatar
David Byers committed
657
(def-kom-var kom-url-transformation-rules 
658
659
660
  '(
    ("^http://[^/]*aftonbladet\\.se/.*/story/.*html?$" . "\\&.")
    )
David Byers's avatar
David Byers committed
661
662
  "**An alist specifying transformations to be applied to URLs.

663
Elements in this list are of the form \(`PATTERN' . `REPLACEMENT').
David Byers's avatar
David Byers committed
664
665
666
Before an URL is opened, it is transformed by matching the URL against
each `PATTERN' in turn, and when a match is found, generating a new
URL according to `REPLACEMENT'.
David Byers's avatar
David Byers committed
667

668
All characters in `REPLACEMENT' except \\ are copied verbatim. The
David Byers's avatar
David Byers committed
669
backslash character starts one of the following sequences:
David Byers's avatar
David Byers committed
670

David Byers's avatar
David Byers committed
671
    Sequence    Meaning
672
673
674
675
    ---------------------------------------------------------------
    `\\&'        Substitute the matched text

    `\\N'        Substitute match for text matching the Nth (...)
David Byers's avatar
David Byers committed
676
                group in `PATTERN'
677
678
679

    `\\\\'        Insert one backslash.
    ---------------------------------------------------------------
David Byers's avatar
David Byers committed
680
"
David Byers's avatar
David Byers committed
681
682
683
684
  server
  )


685
(def-kom-var kom-check-configuration-on-startup t
David Byers's avatar
David Byers committed
686
687
688
689
690
691
692
693
694
695
696
697
698
  "**When non-nil, check Emacs configuration on client startup.

Valid values for this variable are `t' and `nil'. All other values are
reserved for future extensions. When non-nil, several checks will be
performed:

* Check that multibyte character support is enabled, if available.

* Check that the character coding Emacs uses matches the coding system
  used by the server.

Warnings will be shown in the LysKOM buffer on logon.
")
699

David Byers's avatar
David Byers committed
700

701
(def-kom-var kom-keyboard-menu-immediate-selection nil
David Byers's avatar
David Byers committed
702
703
704
705
706
707
708
709
710
  "**Controls how keyboard menus work.

When displaying text-based menus (typically by pressing the `=' key
when the cursor is on an active area), there are two modes of
selection. Setting this variable to `t' means pressing the letter
corresponding to an item selects that item. When this variable is
`nil', selection has to be confirmed by pressing enter.

Values other tha `t' and `nil' are reserved for future use."
711
712
713
  server)


714
(def-kom-var kom-edit-hide-add-button nil
David Byers's avatar
David Byers committed
715
716
717
718
  "**Controls the \"add\" button in the edit buffer.

When set to `t', hide the add button shown after the headers when
editing a text. When set to `nil' (the default), show the button.
719

David Byers's avatar
David Byers committed
720
Values other than `t' and `nil' are reserved for future use."
721
722
723
  server
)

David Byers's avatar
David Byers committed
724
(def-kom-var kom-max-overlays 120
David Byers's avatar
David Byers committed
725
726
727
728
  "**Maximum number of overlays to use to highlight texts.

When a text is displayed with its own background color (see
`kom-highlight-text-body', `kom-highlight-first-line',
729
`kom-highlight-dashed-lines', `kom-async-highlight-text-body' and
David Byers's avatar
David Byers committed
730
731
732
733
734
735
736
737
738
`kom-async-highlight-dashed-lines') one or more overlays are created.
Since a large number of overlays has a serious impact on performance,
the total number of overlays in the buffer can be limited using this
variable.

When set to a positive integer, limit the number of overlays to that
number. When set to `nil', do not limit the number of overlays. Values
other than a positive integer and `nil' are reserved for future use
and may cause unpredictible results."
David Byers's avatar
David Byers committed
739
740
741
  server
)

742
(def-kom-var kom-highlight-text-body t
David Byers's avatar
David Byers committed
743
744
745
  "**Controls highlighting of text bodies.

If `t', overlay `kom-text-body-face' on printed text bodies in LysKOM.
David Byers's avatar
David Byers committed
746
747
When this is enabled, an overlay or extent will be created that may
override certain aspects of the underlying text's formatting. Values
David Byers's avatar
David Byers committed
748
749
750
751
other than `t' or `nil' are reserved for future use.

See `kom-max-overlays' for information on how to limit the number of
overlays."
752
753
754
  server
)

755
(def-kom-var kom-highlight-first-line t
David Byers's avatar
David Byers committed
756
757
758
759
760
761
762
763
764
  "**Controls highlighting of the first line of text headers.

If `t', overlay `kom-first-line-face' on the first header line of
texts. When this is enabled, an overlay or extent will be created that
may override certain aspects of the underlying text's formatting.
Values other than `t' or `nil' are reserved for future use.

See `kom-max-overlays' for information on how to limit the number of
overlays."
765
766
767
768
  server
)

(def-kom-var kom-highlight-dashed-lines t
David Byers's avatar
David Byers committed
769
770
771
772
773
774
775
776
777
  "**Controls highlighting of dashed lines around texts.

If `t', overlay `kom-dashed-lines-face' on the lines surrounding
texts. When this is enabled, an overlay or extent will be created that
may override certain aspects of the underlying text's formatting.
Values other than `t' or `nil' are reserved for future use.

See `kom-max-overlays' for information on how to limit the number of
overlays."
778
779
780
  server
)

781
(def-kom-var kom-async-highlight-text-body t
David Byers's avatar
David Byers committed
782
783
784
785
786
787
788
789
790
  "**Controls highlighting of asynchronous messages.

If `t', overlay `kom-async-text-body-face' on asynchronous messages in
LysKOM. When this is enabled, an overlay or extent will be created
that may override certain aspects of the underlying text's formatting.
Values other than `t' or `nil' are reserved for future use.

See `kom-max-overlays' for information on how to limit the number of
overlays."
791
792
793
794
  server
)

(def-kom-var kom-async-highlight-dashed-lines t
David Byers's avatar
David Byers committed
795
796
797
798
799
800
801
802
803
  "**Controls highlighting of dashed lines around asynchronous messages.

If `t', overlay `kom-dashed-lines-face' on the lines surrounding
messages. When this is enabled, an overlay or extent will be created
that may override certain aspects of the underlying text's formatting.
Values other than `t' or `nil' are reserved for future use.

See `kom-max-overlays' for information on how to limit the number of
overlays."
804
805
806
  server
)

David Byers's avatar
David Byers committed
807
(def-kom-var kom-extended-status-information nil
David Byers's avatar
David Byers committed
808
809
810
  "**Controls display of extra information when displaying LysKOM objects.

If `t', extended status information is listed for all objects in
811
812
813
814
815
816
817
LysKOM. If set to an association list, each element is a pair of tag
and value. The tag specifies a type of extended information. If the
corresponding value is `t', the information is shown. If the
corresponding value is `nil', the information is not shown.

Valid tags are:

818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
    Tag                   Meaning
    ------------------------------------------------------------------
    `conf'                Show all extended information for conferences

    `pers'                Show all extended information for persons

    `server'              Show all extended information for the server

    `read-faq'            Show read FAQs

    `raw-server-stats'    Show raw server statistics

    `raw-boottime-info'   Show raw boot-time server information

    `t'                   Any information not explicitly listed
    ------------------------------------------------------------------
834
835
836
837
838
839
840
841
842

The information controlled by this variable is the kind of data that
most users are not interested in, and, if displayed, would make more
important information hard to find.

Currently this includes read FAQs (for letterboxes) and full
statistics and boot-time information (for the server).

Values other than those specified are reserved for future extensions."
David Byers's avatar
David Byers committed
843
server )
844

David Byers's avatar
David Byers committed
845
(def-kom-var kom-auto-list-faqs t
David Byers's avatar
David Byers committed
846
847
848
849
850
851
852
853
  "**Controls automatic display of FAQs.

When this variable is set to `t', list unread FAQs when entering a
conference or logging on to the server. When entering a conference,
list FAQs for that conference that have not been read. When logging
on, list FAQs for the server that have not been read.

Values other than `t' or `nil' are reserved for future extension."
David Byers's avatar
David Byers committed
854
855
856
  server
)

857
(def-kom-var kom-auto-review-faqs t
David Byers's avatar
David Byers committed
858
859
860
861
862
863
864
865
866
  "**Controls automatic review of FAQs.

When set to `t', automatically review unread FAQs when entering a
conference or logging on to the server. When entering a conference,
FAQs that are unread for that conference will be reviewed. When
logging on, FAQs that are unread for the server will be reviewed.

Values other than `t' or `nil' are reserved for future use."

867
868
869
  server
)

David Byers's avatar
X    
David Byers committed
870
(def-kom-var kom-allow-incompleteness nil
David Byers's avatar
David Byers committed
871
872
873
874
875
876
877
878
879
880
  "**Allow or disallow operation on incomplete membership information.

If `nil', commands like `kom-list-news' will wait for all membership
information to be read. If this flag is set to `t', commands will not
wait for all membership information. Not waiting for complete
information allows certain commands to execute faster, particularly
during the login phase, but may result in incorrect or incomplete
answers.

Values other than `t' or `nil' are reserved for future use."
David Byers's avatar
X    
David Byers committed
881
882
  server
)
883

David Byers's avatar
X    
David Byers committed
884
(def-kom-var kom-bury-buffers t
David Byers's avatar
David Byers committed
885
886
887
888
889
890
891
  "**Controls the behaviour of `kom-next-kom' and its cousins.

If this variable is `t' the current buffer is sent to the back of the
buffer list when one of the commands `kom-next-kom',
`kom-previous-kom' or `kom-next-unread-kom' is invoked.

Values other than `t' or `nil' are reserved for future use."
David Byers's avatar
X    
David Byers committed
892
  server)
893

David Byers's avatar
X    
David Byers committed
894
(def-kom-var kom-write-texts-in-window nil
David Byers's avatar
David Byers committed
895
  "**Determines where to edit texts.
David Byers's avatar
David Byers committed
896

David Byers's avatar
David Byers committed
897
898
899
900
901
902
903
904
905
906
The value must be one of `nil', `other', `new-frame', `other-frame', a
string or a buffer.

When set to `nil', edit texts in the same window as the LysKOM buffer.
When set to `other', edit in another window, creating it if necessary.
When set to `other-frame', edit in another frame, if there is one
\(otherwise edit in the same window as the LysKOM buffer). When set to
`new-frame', create a new frame for editing. This frame will be
removed when editing is finished. A string means edit in the buffer
with that name. A buffer means edit in that buffer."
David Byers's avatar
X    
David Byers committed
907
  server)
908

David Byers's avatar
X    
David Byers committed
909
(def-kom-var kom-view-commented-in-window 'other
David Byers's avatar
David Byers committed
910
911
912
  "**Where to view commented texts. 

See the documentation for `kom-write-texts-in-window' for details."
David Byers's avatar
X    
David Byers committed
913
  server)
David Byers's avatar
David Byers committed
914

David Byers's avatar
X    
David Byers committed
915
(def-kom-var kom-edit-filters-in-window nil
David Byers's avatar
David Byers committed
916
917
918
  "**Where to edit filters with `kom-filter-edit'.

See the documentation for `kom-write-texts-in-window' for details."
David Byers's avatar
X    
David Byers committed
919
  server)
David Byers's avatar
David Byers committed
920

David Byers's avatar
X    
David Byers committed
921
(def-kom-var kom-list-membership-in-window 'other
David Byers's avatar
David Byers committed
922
923
924
  "**Where to list membership with `kom-list-membership'.

See the documentation for `kom-write-texts-in-window' for details."
David Byers's avatar
X    
David Byers committed
925
  server)
926

927
(def-kom-var kom-personal-messages-in-window 'other
David Byers's avatar
David Byers committed
928
929
930
  "**Where to display personal messages. 

See the documentation for `kom-write-texts-in-window' for details."
931
932
  server)

David Byers's avatar
X    
David Byers committed
933
(def-kom-var kom-customize-format 'long
David Byers's avatar
David Byers committed
934
935
936
937
938
939
940
941
  "**Determines the format of the customize buffer.

This variable currently only controls initial display of documentation
in the customize buffer (the buffer shown by `kom-customize'. When set
to the symbol `long', display documentation. When set to the symbol
`short', don't display documentation.

Values other than `long' or `short' are reserved for future use."
David Byers's avatar
X    
David Byers committed
942
  server)
943

David Byers's avatar
X    
David Byers committed
944
(def-kom-var kom-user-prompt-format "%[%c% %m%] - "
David Byers's avatar
David Byers committed
945
946
947
948
949
950
  "**Format of LysKOM prompt when waiting for input.

The value of this variable must be a string, which is displayed as the
LysKOM prompt, while waiting for a command. The string may contain the
following special sequences:

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
    Sequence      Meaning
    -----------------------------------------------------------------
    `%c'          Inserts the current default command.

    `%['          Inserts `[' if the ansaphone is on.

    `%]'          Inserts `]' is the ansaphone is on.

    `%m'          Inserts information about recorded messages.

    `%s'          Inserts the name of the LysKOM system

    `%S'          Inserts the server name.

    `%p'          Inserts the name of the user currently logged on.

    `%w'          Inserts the name of the current conference.

    `%a'          Inserts `anonymous' in the current language.

    `%A'          Inserts `Anonymous' in the current language.

    `%#'          Inserts the current session number.

    `% '          Inserts a space if it seems necessary (percent SPC).

    `%%'          Inserts a percent sign.
    -----------------------------------------------------------------
David Byers's avatar
David Byers committed
979
980
981

Here are a few examples:

982
983
984
985
986
987
    Format string                 What it does
    -----------------------------------------------------------------
    `\"%[%c% %m%] - \"'           The default prompt

    `\"%[%s: %c% %m%] - \"'       Could display \"LysKOM: Time - \"
    -----------------------------------------------------------------
David Byers's avatar
David Byers committed
988
989

Note that multiline prompts are not supported."
David Byers's avatar
X    
David Byers committed
990
  server)
David Byers's avatar
David Byers committed
991

Per Cederqvist's avatar
.  
Per Cederqvist committed
992

David Byers's avatar
X    
David Byers committed
993
(def-kom-var kom-user-prompt-format-executing "%[%c% %m%]."
David Byers's avatar
David Byers committed
994
995
996
997
  "**Format of LysKOM prompt when executing a default command.

The value of this variable must be a string. See
`kom-user-prompt-format' for details."
David Byers's avatar
X    
David Byers committed
998
  server)
David Byers's avatar
David Byers committed
999
1000


For faster browsing, not all history is shown. View entire blame