;;;;; -*- emacs-lisp -*- ;;;;; $Id$ ;;;;; Copyright (C) 1991 Lysator Academic Computer Association. ;;;;; ;;;;; This file is part of the LysKOM server. ;;;;; ;;;;; LysKOM is free software; you can redistribute it and/or modify it ;;;;; under the terms of the GNU General Public License as published by ;;;;; the Free Software Foundation; either version 1, or (at your option) ;;;;; 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. ;;;;; ;;;; ================================================================ ;;;; ================================================================ ;;;; ;;;; File: vars.el ;;;; ;;;; This file contains almost all the variables used in lyskom. ;;;; (defconst lyskom-clientversion-long "$Id$\n" "Version for every file in the client.") (provide 'lyskom) ;;;; ================================================================ ;;;; Emacs dependant variables (defvar kom-emacs-knows-iso-8859-1 t "*If non-nil then dont convert texts and other things to swascii. This variable is not saved. It should be set in your .emacs This variable is not saved in the LysKOM server.") ;;;; ================================================================ ;;;; 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. This variable is stored in the LysKOM server.") (defvar kom-cite-string ">" "*String to insert before each line of a commented text. This variable is stored in the LysKOM server.") (defvar kom-created-texts-are-read t "*Non-nil means automatically mark texts that you create as read. This variable is stored in the LysKOM server.") (defvar kom-dont-restore-window-after-editing nil "*If non-nil then don't restore the window configuration after sending a text. This variable is not saved in the LysKOM server.") (defvar kom-default-mark 100 "*If non-nil (must be an integer) then the user is not asked for type of mark. This variable is stored in the LysKOM server.") (defvar kom-reading-puts-comments-in-pointers-last t "*If Non-nil the texts are shown with comments references at the end. This variable is stored in the LysKOM server.") (defvar kom-dashed-lines t "*If Non-nil then all texts will be surrounded by lines of dashes. This variable is stored in the LysKOM server.") (defvar kom-print-number-of-unread-on-entrance t "*If Non-nil then print automatically the number of unread articles when entering a conference. This variable is stored in the LysKOM server.") (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. If you want the messages in the buffer you could set the variable kom-presence-messages-in-buffer. This variable is stored in the LysKOM server.") (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. This variable is stored in the LysKOM server.") (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. This variable is stored in the LysKOM server.") (defvar kom-show-footnotes-immediately t "*Non-nil means show footnotes immediately following the text. This variable is stored in the LysKOM server.") (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. This variable is stored in the LysKOM server.") (defvar kom-read-depth-first t "*Non-nil means read comments and footnotes to a text before other texts. This variable is stored in the LysKOM server.") (defvar kom-continuous-scrolling t "*Non-nil means scroll LysKOM window as text is inserted. The last viewed position (generally the most recent prompt) will always be visible. This variable is stored in the LysKOM server.") ;; Should this be set to nil if baud-rate is low? (defvar kom-deferred-printing t "*Non-nil means delay printing of some information not in the cache. You might want to turn this off to have the old, linear behaviour. This variable is not stored in the LysKOM server.") (defvar lyskom-defer-indicator "[...]") (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. This variable is stored in the LysKOM server.") (defvar kom-after-load-hook nil "Hook to run once after lyskom is loaded. This variable is not saved in the LysKOM server.") (defvar kom-login-hook 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. This variable is stored in the LysKOM server.") (defvar kom-do-when-done '(kom-review-all-marked-texts kom-display-time) "*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. This variable is stored in the LysKOM server.") (defvar kom-page-before-command nil "*This is a list of all commands before which the screen is cleared. If it isn't a list and isn't nil the screen is cleared before all commands. This variable is stored in the LysKOM server.") (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. This variable is stored in the LysKOM server.") (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. This variable is stored in the LysKOM server.") (defvar lyskom-prompt-text " - " "*Text to end the prompt. This variable is stored in the LysKOM server.") (defvar lyskom-prompt-executing-default-command-text ". " "*Text to end the prompt while the default-commands is executing. This variable is stored in the LysKOM server.") (defvar lyskom-no-prompt nil "Tells the session that we have no prompt. This variable is not saved in the LysKOM server.") (defvar kom-show-personal-messages-in-buffer t "*Buffer to show personal messages in. If nil, discard them. If t, insert them in the *kom* buffert. If non-nil and non-t this should be a buffer or a name of a (possibly nonexistent) buffer in which the message is inserted. This variable is stored in the LysKOM server.") (defvar kom-pop-personal-messages nil "*Non-nil means pop up a buffer with personal messages as they arrive. kom-show-personal-messages-in-buffer decides which buffer to pop. This variable is stored in the LysKOM server.") (defvar kom-ding-on-priority-break 1 "*Non-nil means ding if a higher priority text or conference breaks in. A number means the number of times to ding. A string is an argument for the program named by kom-audio-player. This variable is stored in the LysKOM server.") (defvar kom-ding-on-wait-done 1 "*Non-nil means ding when busy-waiting finishes. A number means the number of times to ding. A string is an argument for the program named by kom-audio-player. A symbol is interpreted as a function to call. This variable is stored in the LysKOM server.") (defvar kom-ding-on-common-messages 0 "*Non-nil means ding as common messages arrive. A number means the number of times to ding. A string is an argument for the program named by kom-audio-player. A symbol is interpreted as a function to call. This variable is stored in the LysKOM server.") (defvar kom-ding-on-group-messages 1 "*Non-nil means ding as group messages arrive. A number means the number of times to ding. A string is an argument for the program named by kom-audio-player. A symbol is interpreted as a function to call. This variable is stored in the LysKOM server.") (defvar kom-ding-on-personal-messages 2 "*Non-nil means ding as personal messages arrive. A number means the number of times to ding. A string is an argument for the program named by kom-audio-player. A symbol is interpreted as a function to call. This variable is stored in the LysKOM server") (defvar lyskom-ding-on-no-subject 2 "How to ding if the user has not entered a subject line. A number means the number of times to ding. A string is an argument for the program named by kom-audio-player. A symbol is interpreted as a function to call. This variable is not saved in the LysKOM server.") (defvar kom-audio-player "audioplay" "*Program to play audio files. This variable is not saved in the LysKOM server.") (defvar kom-default-message-recipient 'group "*Determines default recipient of personal messages. everybody means the default recipient is everybody. group means the default recipient is the group to which the last message was sent, if it was a group message. If the last message was a personal message or a common message, it means the same as sender. sender means the sender of the last message received. This variable is stored in the LysKOM server.") (defvar lyskom-filter-outgoing-messages t "t if outgoing remote-control messages and automatic replies are not to be displayed in the buffer. This variable is not saved in the LysKOM server.") (defvar kom-friends nil "*List of people whose names should be formatted using kom-friends-face. This variable is stored in the LysKOM server.") (defvar kom-default-face-scheme (condition-case err (cond ((null window-system) 'default) ((not (x-display-color-p)) 'monochrome) ((eq (cdr (assoc 'background-mode (frame-parameters))) 'dark) 'inverse) (t 'default)) (error 'default)) "*Face scheme to use per default for new logins. This variable is not saved in the LysKOM server.") (defvar kom-text-properties t "*Non-nil means to insert text properties in the Emacs buffer for various LysKOM elements. This variable is not saved in the LysKOM server.") (defvar kom-use-button-hints t "*Non-nil means use button hints for overriding default actions. This variable is not saved in the LysKOM server.") ;;; ;;; lyskom-button-actions has been moved to swedish-strings.el on account ;;; of there being a bunch of language-dependent strings in it. ;;; (defvar lyskom-text-buttons '( ;; Text numbers ("\\(\\<[0-9][0-9][0-9][0-9][0-9]*\\>\\)" ; Match text ; Button type 0 ; Portion that's a button 1 ; Portion that's the arg nil ; Face or nil (=default) ) ;; URLs ("\\(file://\\|ftp://\\|gopher://\\|http://\\|https://\\|news:\\|wais://\\|mailto:\\|telnet:\\)[^\t \012 \"<>|\\]*[^\t \012 \"<>|.,!(){}?'`]" url 0 nil kom-url-face) ;; JySKom enhancements ("<(m[|ö]te *\\([0-9]+\\)[^0-9]*)>" conf 0 1 nil) ("<(text *\\([0-9]+\\)[^0-9]*)>" text 0 1 nil) ("<(person *\\([0-9]+\\)[^0-9]*)>" pers 0 1 nil) ) "List of buttons to install in the text mass of LysKOM objects. Each element is a list consisting of REGEXP TYPE BUTTON-MATCH BUTTON-ARG-MATCH FACE. REGEXP is the regexp to look for in the text. TYPE is the button type. Valid button types are defined in lyskom-button-actions BUTTON-MATCH is the number of the parenthesized expression that is the actual button. BUTTON-ARG-MATCH is the number of the expression to used as the button argument. FACE is the text face to apply to the button, or nil to use the default face. This variable is not saved in the LysKOM server") (defvar kom-url-viewer-preferences '("emacs" "netscape" "w3") "*LysKOM will attempt to use URL viewers in the order specified here. kom-url-managers is a list of all available viewers. Note that the elements are all strings. When you select an URL, this list is used to determine which URL viewer to use in the following manner: Each element is in turn matched against the manager regexp for each manager in kom-url-managers, and the first manager found that matches is used to display the URL. See kom-url-managers for a list of all available URL viewers. See kom-netscape-command and kom-mosaic-command for information specific to some URL viewers. This variable is not saved in the LysKOM server.") (defvar kom-url-managers '(("w3" "\\(http\\|gopher\\|ftp\\)" "Emacs W3" lyskom-view-url-w3) ("netscape" ".*" "Netscape Navigator" lyskom-view-url-netscape) ("\\(emacs\\|dired\\)" "\\(ftp\\|file\\)" "dired" lyskom-view-url-dired) ("\\(emacs\\|telnet-mode\\)" "telnet" "emacs telnet" lyskom-view-url-telnet) ("\\(emacs\\|mail-mode\\)" "mailto" "mail-mode" lyskom-view-url-mailmode) ("mosaic" "\\(http\\|gopher\\|ftp\\|mailto\\|news\\|wais\\|file\\|te|net\\)" lyskom-view-url-mosaic)) "List of URL managers. Each element is a list consisting of (MANAGER-REGEXP PROTOCOLS NAME VIEW-FUNCTION). When LysKOM attempts to view an URL, kom-url-viewer-preferences is scanned, and the URL manager whose MANAGER-REGEXP first matches an element in kom-url-viewer-preferences and whose PROTOCOLS matches the protocol of the selected URL is used to view the URL by calling its VIEW-FUNCTION with the URL and the manager entry as arguments. This variable is not saved in the LysKOM server.") (defvar kom-mosaic-command "/usr/local/bin/mosaic" "*Command to run to start Mosaic This variable is not saved in the LysKOM server.") (defvar kom-netscape-command "netscape" "*Command to run to start Netscape. If a string, it should be a command that starts Netscape with no arguments. If a list, the first element must be a command that starts Netscape. The remaining elements are used as arguments to Netscape. For instance, a value of \"netscape\" is valid, but \"netscape -d host:0\" is not. Instead, the latter should be \(\"netscape\" \"-d\" \"host:0\"\) This variable is not saved in the LysKOM server.") (defvar kom-confirm-multiple-recipients t "*Non-nil means ask the user for confirmation about recipients. When the user writes a comment to a text with more than one recipient he gets a y-or-n-p question for all recipients. This variable is stored in the LysKOM server.") (defvar kom-inhibit-typeahead nil "*If non-nil, discard keyboard input that arrives while a LysKOM command is executing. This variable is saved in the LysKOM server.") (defvar kom-max-buffer-size nil "*If non-nil, ensure that buffers won't grow any larger than this This variable is not saved in the LysKOM server.") (defvar lyskom-print-complex-dates (and (>= emacs-minor-version 29) (>= emacs-major-version 19)) "If non-nil, print today and yesterday using a special format. Doesn't work very well with Emacs 19.28 or older. You may want to set this to nil, but never set it to non-nil explicitly. This variable is not saved in the LysKOM server.") (defvar kom-server-aliases '(("kom.lysator.liu.se" . "LysKOM") ("kom.ludd.luth.se" . "LuddKOM") ("rydkom.rydnet.lysator.liu.se" . "RydKOM") ("kom.csd.uu.se" . "CSD-KOM") ("striterax.medio.mh.se" . "MedioKOM") ("kom.mds.mdh.se" . "MdS-KOM")) "An alist mapping server names to shorter identification strings This variable is not saved in the LysKOM server.") (defvar kom-ansaphone-on nil "t if automatic replies to personal messages are in effect.") (defvar lyskom-ansaphone-messages nil "Messages collected by the automatic reply facility. The most recent message is the first message in the list.") (defvar lyskom-ansaphone-when-set (current-time-string) "Time when the auto-reply facility was enabled.") (defvar kom-remote-control t "*t if LysKOM may be remotely controlled. This variable is stored in the LysKOM server.") (defvar kom-remote-controllers nil "*Persons who may control LysKOM using messages.By default you can always control your own sessions. See kom-self-control for more information. This variable is stored in the LysKOM server.") (defvar kom-self-control t "*If non-nil, remote control commands are accepted from sessions logged in as the same user as the current session. This variable is stored in the LysKOM server.") (defvar kom-ansaphone-replies '((group nil nil nil nil) (common nil nil nil nil)) "*List of automatic replies to various messages. A list of (MESSAGE-TYPE SENDER RECIPIENT TEXT REPLY) MESSAGE-TYPE is one of personal, group or common or nil SENDER is a list of integers or a single integer or nil RECIPIENT is a list of integers or a single integer or nil TEXT is a regular expression or nil REPLY is a string or nil When an incoming message arrives and the auto-reply facility is on, this list is checked for automatic replies. The message type, sender, recipient and text of the incoming messages is matched against the elements of this list. If a match is found, the corresponding reply is send. A nil in one of the message-type, sender, recipient or text components in the list is taken to mean a wildcard. A null reply means don't send a reply. If none of the elements match, KOM-ANSAPHONE-DEFAULT-REPLY is sent. This variable is not saved in the LysKOM server.") (defconst lyskom-elisp-variables '(kom-ding-on-personal-messages kom-ding-on-group-messages kom-ding-on-common-messages kom-ding-on-priority-break kom-ding-on-wait-done kom-show-personal-messages-in-buffer kom-pop-personal-messages kom-do-when-done kom-higher-priority-breaks kom-login-hook kom-membership-default-placement kom-membership-default-priority kom-mercial kom-inhibit-typeahead kom-page-before-command kom-continuous-scrolling kom-permanent-filter-list kom-presence-messages-in-buffer kom-quit-hook kom-show-where-and-what kom-who-buffer-size-when-displaying kom-default-message-recipient kom-write-texts-in-window kom-cite-string kom-remote-control kom-remote-controllers kom-self-control kom-ansaphone-default-reply kom-ansaphone-replies kom-show-footnotes-immediately kom-friends lyskom-fetch-map-nos lyskom-new-text-hook lyskom-prefetch-conf-tresh lyskom-prefetch-confs lyskom-prefetch-texts lyskom-prompt-executing-default-command-text lyskom-prompt-text lyskom-who-info-has-changed-hook) "Tells the client what flags and hooks that are to be saved in the server. These are the flags that are saved in the elisp-client part of the server.") (defconst lyskom-global-boolean-variables '( 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 kom-confirm-multiple-recipients ) "List of flags that are to be saved as booleans in the common block. Dont change this. These are defined by the protocol.") (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 these. These are defined by the protocol.") ;;; ================================================================ ;;; Internal variables and constants (defconst lyskom-clientversion "@@CLIENTVERSION@@" "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-do-when-done nil "Internal of kom-do-when-done.") (defvar lyskom-do-when-starting nil "Internal of kom-do-when-starting.") (defvar lyskom-list-of-edit-buffers nil "Keeps track of active edit-buffers.") (defvar lyskom-sessions-with-unread nil "List of lyskom-sessions with unread texts. This is not buffer-local.") (defvar lyskom-sessions-with-unread-letters nil "List of lyskom-sessions with unread letters. This is not buffer-local.") (defvar lyskom-buffer nil "What is the lyskom-buffer we are connected to.") (defvar output nil "Uaark. Just to omit a warning...") (defvar lyskom-errno nil "Errno of last lyskom error.") (defvar lyskom-parse-pos nil "Position of parsing.") (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. This variable is not saved in the LysKOM server.") (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-session-priority 0 "*This sessions priority. Only texts in conferences with a priority equal to or higher than this will be shown. This variable is not saved in the LysKOM server.") (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-server-name "" "The name of the server") (defvar lyskom-buffer-list nil "List of all LysKOM buffers.") (defvar lyskom-who-info-cache nil "Cache of who info.") (defvar lyskom-conf-cache nil "Cache of conference statuses.") (defvar lyskom-uconf-cache nil "Cache of small 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-who-info-buffer-is-on t "Says wether we are collecting who-information or not.") (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.") (defvar lyskom-quit-flag nil "A flag indicating if the filter was interrupted by C-g. It is set to the same value as quit-flag on filter exit.") (defvar lyskom-inhibit-minibuffer-messages nil "A flag indicating whether asynchronous minibuffer messages are allowed. If this variable is non-nil, no asynchronous messages will appear.") (defvar lyskom-is-saving nil "A flag indicating whether the server is saving at the moment.") ;;; These variables control prefetch of conf-stats, text-stats and texts: (defvar lyskom-prefetch-texts 3 "*Number of texts to prefetch. This variable is stored in the LysKOM server.") (defvar lyskom-prefetch-conf-tresh 50 "*If fewer than lyskom-prefetch-conf-tresh texts are known, ask for more conf-stats from server. This variable is stored in the LysKOM server.") (defvar lyskom-prefetch-confs 10 "*Number of confs to ask about at once when checking for unread texts. This variable is stored in the LysKOM server.") (defvar lyskom-fetch-map-nos 50 "*Number of text-nos lyskom will fetch when fetching maps. +++ This is not yet used everywhere. This variable is stored in the LysKOM server.") (defvar lyskom-fetch-membership-length 6 "*Number of entries in the membership-list that is fetched at a time. This should be optimized depending on how often you read lyskom and the activity in the first groups in you membership list. Best performance is achieved if you, when logging in, always have an unread article in one of the first lyskom-fetch-membership-length conferences. This variable is not saved in the LysKOM server.") (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-last-conf-done -1 "This variable has obscure uses. I'm not even sure it is necessary.") ;; See lyskom-rest.el for its use. I believe it almost duplicates ;; lyskom-last-conf-received in practical use. (defvar lyskom-membership nil "Sorted membership-list of the logged in person.") (defvar lyskom-unread-confs nil "List containing all unread confs.") (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. This is used by the command kom-busy-wait.") (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-normally-read-texts nil "Stack of texts that are read normally. Used for kom-review-last-normally-read.") (defvar lyskom-current-subject "" "Current subject.") (defvar lyskom-last-added-rcpt 0 "The default conference when adding a recipient.") (defvar lyskom-last-added-ccrcpt 0 "The default conference when adding a ccrecipient.") (defvar lyskom-saved-file-name (concat default-directory "kom-text") "The default file name when saving a lyskom-text.") (defvar lyskom-mode-hook nil "Hook to run when lyskom-mode is entered.") (defvar kom-quit-hook nil "Hook to run when the LysKOM session is correctly ended. This variable is stored in the LysKOM server.") (defvar kom-quit-when-idle t "Non-niil to automatically quit when LysKOM is full and the session is idle") (defvar kom-permanent-filter-list nil "List of patterns to filter permanently This variable is stored in the LysKOM server.") (defvar kom-session-filter-list nil "List of patterns to filter during this session") (defvar lyskom-filter-list nil "List of patterns that are filtered.") (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. This variable is stored in the LysKOM server.") (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. This variable is stored in the LysKOM server.") (defvar lyskom-personal-message-hook nil "*Hook to run when a personal message is received. When the hook is run 'sender' is bound to the pers-stat of the sender of the message (or possibly nil), 'recipient' is 0 if the message is a public message and otherwise the pers-no of the user, and 'message' is a string that holds the message. This variable is not saved in the LysKOM server.") (defvar lyskom-executing-command t "Non-nil means the client is executing a command. Most commands can't be interrupted by another command.") (defvar lyskom-current-command nil "The command currently being executed.") (defvar lyskom-current-function nil "Sometimes set to the current high-level function being executed.") (defvar lyskom-current-function-phase nil "Sometimes set to the phase of the curreht high-level function being executed.") (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.) This variable is not saved in the LysKOM server.") (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 "*kom*-debugs" "Name of the buffer to insert the communications with the server into if lyskom-debug-communications-to-buffer is non-nil.") (defvar lyskom-blocking-process nil "The process the where the lyskom-session is. If blocking-do is called from a buffer that is no well-connected to the lyskom-session, i.e. the lyskom-proc variable is not set, then this variable has to be set for the blocking-do to be able to know what process to send questions to. This is the case when called from the minibuffer when completing.") (defvar lyskom-doing-default-command nil "Non-nil if LysKOM is executing the default command.") (defvar lyskom-first-time-around nil "Non-nil if LysKOM is being entered for the first time.") (defvar lyskom-format-experimental nil "If non-nil, LysKOM is likely to blow up in your face.") (defvar lyskom-count-var 0 "This variable is used for counting things in the client, such as unread texts in list-unread.") (defvar lyskom-default-conf-string nil "The default string to use for an unknown conference. Set this locally when inserting a conference name using lyskom-format-insert if you want to replace the usual description of an unknown conference.") (defvar lyskom-is-administrator nil "This variable is t if the user is in administrator mode and nil otherwise.") (defvar lyskom-emacs19-p nil "This variable is t if LysKOM is running in Emacs 19") (defvar lyskom-last-personal-message-sender "" "Name of sender of last personal message received") (defvar lyskom-last-group-message-recipient "" "Name of target for last group message received") (defvar lyskom-is-new-user nil "An internal variable used in kom-start-anew") (defvar lyskom-apo-timeout-s 1 "Seconds timeout for accept-process-output") (defvar lyskom-apo-timeout-ms nil "Microseconds timeout for accept-process-output") (defvar lyskom-dont-read-user-area nil "If non-nil the user area will not be read on login.") ;;;; lyskom-tell-phrases-validation-keyword-list ;;; This is a list of keywords for kom-tell-phrases. ;;; These are the only keywords that are allowed in kom-tell-phrases. ;;; To coders of the elisp-client: ;;; If you add/delete a reference to any of these keywords make sure ;;; you update these changes. ;;; To everyone: ;;; The kom-tell-phrases list is checked against this list when the ;;; client is loaded, i.e. by lyskom-tell-phrases-validate that causes ;;; an error if any keyword is not present or any non-keyword is ;;; present. (defconst lyskom-tell-phrases-validation-keyword-list '( (kom-tell-silence) (kom-tell-send) (kom-tell-login) (kom-tell-read) (kom-tell-1st-pres) (kom-tell-write-comment) (kom-tell-write-footnote) (kom-tell-write-letter) (kom-tell-write-reply) (kom-tell-write-text) (kom-tell-conf-pres) (kom-tell-recover) (kom-tell-wait) (kom-tell-regret) (kom-tell-review) (kom-tell-change-name) (kom-tell-change-supervisor) (kom-tell-next-lyskom) ) "Users must not change this constant, but are encouraged to change the value of kom-tell-phrases for fun.") ;;; ================================================================ ;;; Commands lists that are removed from extended command depending on ;;; administrator status. (defconst lyskom-admin-removed-commands '(kom-enable-adm-caps)) (defconst lyskom-noadmin-removed-commands '(kom-disable-adm-caps kom-remove-motd kom-set-motd kom-shutdown-server)) ;;; ================================================================ ;;; 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.") (defvar mode-line-conf-name nil "Conf name that is present on the mode-line.") ;;; ================================================================ ;;; Faces (defmacro lyskom-make-face (name &rest body) (` (if (memq (, name) (face-list)) nil (,@ body)))) (put 'lyskom-make-face 'lisp-indent-function 1) (defmacro when (expr &rest body) "Execute BODY if EXPR evaluates to non-nil" (list 'if expr (cons 'progn body))) (put 'when lisp-indent-function 1) (put 'when 'edebug-form-spec t) ;; ;; Set up default faces in case no face scheme is selected ;; (defvar lyskom-faces '(kom-active-face kom-url-face kom-me-face kom-highlight-face kom-text-face kom-subject-face kom-text-no-face kom-friends-face kom-presence-face kom-first-line-face) "This is a list of the faces that LysKOM uses.") (defvar lyskom-face-schemes '((default (kom-active-face default "blue4" nil) (kom-url-face default "BlueViolet" nil) (kom-me-face bold "blue3" "lavender") (kom-highlight-face highlight nil) (kom-text-face default nil nil) (kom-subject-face default nil nil) (kom-text-no-face kom-active-face nil nil) (kom-friends-face default "blue3" "lavender") (kom-presence-face italic "dim gray" nil) (kom-first-line-face default nil nil)) (inverse (kom-active-face default "lightblue" nil) (kom-url-face default "Moccasin" nil) (kom-me-face bold "gold" "black") (kom-highlight-face highlight nil nil) (kom-text-face default nil nil) (kom-subject-face default "Khaki" nil) (kom-text-no-face kom-active-face nil nil) (kom-friends-face default "red" nil) (kom-presence-face italic "grey" nil) (kom-first-line-face default nil nil)) (monochrome (kom-active-face default nil nil) (kom-url-face default nil nil) (kom-me-face bold nil nil) (kom-highlight-face highlight nil nil) (kom-text-face default nil nil) (kom-subject-face default nil nil) (kom-text-no-face kom-active-face nil nil) (kom-friends-face underline nil nil) (kom-presence-face italic nil nil) (kom-first-line-face default nil nil)) (minimal (kom-active-face default nil nil) (kom-url-face default nil nil) (kom-me-face default nil "lavender") (kom-highlight-face highlight nil nil) (kom-text-face default nil nil) (kom-subject-face default nil nil) (kom-text-no-face default nil nil) (kom-friends-face default nil "alice blue") (kom-presence-face italic "dim gray" nil) (kom-first-line-face default nil nil)) (highlight (kom-active-face default nil nil) (kom-url-face default nil "LemonChiffon1") (kom-me-face default nil "thistle") (kom-highlight-face highlight nil nil) (kom-text-face default nil nil) (kom-text-no-face default nil nil) (kom-friends-face default nil "misty rose") (kom-subject-face default nil nil) (kom-presence-face italic "dim gray" nil) (kom-first-line-face default nil "lavender"))) "Face schemes for LysKOM. This variable is an association list that defines the face and color schemes in LysKOM. The car of each element is the scheme key, a symbol, and the cdr is a list of face definitions. Each face definition in tur, is a list of four elements: the face name, the base face, foreground color and background color. When LysKOM defines a face from such a specification, the base face is first copied and then the foreground and background colors are set. If it permissible to substitute nil for any element except the face name. For instance, (kom-me-face bold \"yellow\" \"red\") will cause kom-me-face to be bold with yellow text on a red background." ) (defun lyskom-set-face-foreground (face color) (condition-case error (set-face-foreground face color) (error nil))) (defun lyskom-set-face-background (face color) (condition-case error (set-face-background face color) (error nil))) (defun lyskom-set-face-scheme (scheme &optional) "Set the LysKOM color and face scheme to SCHEME. Valid schemes are listed in lyskom-face-schemes." (let ((tmp (assoc scheme lyskom-face-schemes))) (if (and tmp (eq window-system 'x)) (progn (mapcar (function (lambda (spec) (copy-face (or (elt spec 1) 'default) (elt spec 0)) (if (elt spec 2) (lyskom-set-face-foreground (elt spec 0) (elt spec 2))) (if (elt spec 3) (lyskom-set-face-background (elt spec 0) (elt spec 3))))) (cdr tmp)))))) (lyskom-set-face-scheme kom-default-face-scheme) ;;; Look for X resources specifying faces. (if (eq window-system 'x) (let* ((set-p (function (lambda (face-name resource) (x-get-resource (concat face-name ".attribute" resource) (concat "Face.Attribute" resource))))) (on-p (function (lambda (face-name resource) (let ((set (funcall set-p face-name resource))) (cond ((null set) nil) ((member (downcase set) '("on" "true")) 'on) (t 'off))))))) (mapcar (function (lambda (face) (let* ((face-name (symbol-name face)) (fg (funcall set-p face-name "Foreground")) (bg (funcall set-p face-name "Background")) (bl (funcall on-p face-name "Bold")) (it (funcall on-p face-name "Italic")) (ul (funcall on-p face-name "Underline"))) (if fg (set-face-foreground face fg)) (if bg (set-face-background face bg)) (if (eq bl 'on) (make-face-bold face nil t)) (if (eq bl 'off) (make-face-unbold face nil t)) (if (eq it 'on) (make-face-italic face nil t)) (if (eq it 'off) (make-face-unitalic face nil t)) (if ul (set-face-underline-p face (eq ul 'on)))))) lyskom-faces)))