09403d5f94ee8c396872cd09f2134f500cea414d
[riece] / lisp / riece-options.el
1 ;;; riece-options.el --- customization
2 ;; Copyright (C) 1998-2003 Daiki Ueno
3
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
5 ;; Created: 1998-09-28
6 ;; Keywords: IRC, riece
7
8 ;; This file is part of Riece.
9
10 ;; This program is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; This program is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Code:
26
27 (require 'riece-version)
28 (require 'riece-globals)
29
30 ;; User modifiable variables.
31 (defgroup riece nil
32   "Riece specific customize group")
33
34 (defgroup riece-options nil
35   "Riece user customizable variables"
36   :prefix "riece-"
37   :group 'riece)
38
39 (defcustom riece-saved-forms
40   '(riece-server-alist
41     riece-channel-buffer-mode
42     riece-user-list-buffer-mode
43     riece-layout)
44   "Variables saved after each session is completed."
45   :type 'string
46   :group 'riece-options)
47
48 (defcustom riece-debug nil
49   "If non-nil, random debug spews."
50   :type 'boolean
51   :group 'riece-options)
52
53 (defcustom riece-command-prefix "\C-c"
54   "Key sequence to be used as prefix for command mode key bindings."
55   :type 'string
56   :group 'riece-options)
57
58 (defgroup riece-looks nil
59   "Related to look and feel"
60   :prefix "riece-"
61   :group 'riece)
62
63 (defcustom riece-use-full-window t
64   "If non-nil, whole Emacs window is used to display dialogue."
65   :type 'boolean
66   :group 'riece-looks)
67
68 (defcustom riece-window-center-line -2
69   "Line number of center point in window when scrolling.
70 If nil, erases the entire frame and then redraws with point in the
71 center of the window.  Negative means relative to bottom of window.
72 See the document of the function `recenter'."
73   :type 'integer
74   :group 'riece-looks)
75
76 (defcustom riece-directory (expand-file-name "~/.riece")
77   "Where to look for data files."
78   :type 'directory
79   :group 'riece-options)
80
81 (defcustom riece-addon-directory
82   (expand-file-name "addons" riece-directory)
83   "Where to look for add-on files."
84   :type 'directory
85   :group 'riece-options)
86
87 (defcustom riece-variables-file
88   (expand-file-name "init" riece-directory)
89   "Where to look for variables."
90   :type 'file
91   :group 'riece-options)
92
93 (defcustom riece-saved-variables-file
94   (expand-file-name "save" riece-directory)
95   "Where to look for variables.
96 This file was saved the last session."
97   :type 'file
98   :group 'riece-options)
99
100 (defcustom riece-variables-files
101   (list riece-saved-variables-file riece-variables-file)
102   "Where to look for variables.  Helps to remove clutter from your .emacs.
103 This feature is most likely to dissappear in near future.  The preferred
104 way is to put Riece variables on .emacs or file loaded from there."
105   :type '(repeat (file :tag "Initialization File"))
106   :group 'riece-options)
107
108 (defcustom riece-addons '(riece-highlight
109                           riece-ctcp
110                           riece-guess
111                           riece-unread
112                           riece-history
113                           riece-url
114                           riece-button
115                           riece-menu
116                           riece-icon
117                           riece-ignore
118                           riece-log
119                           riece-toolbar
120                           riece-alias
121                           riece-ctlseq)
122   "Add-ons insinuated into Riece."
123   :type '(repeat symbol)
124   :group 'riece-options)
125
126 (defgroup riece-server nil
127   "Server settings"
128   :prefix "riece-"
129   :group 'riece)
130
131 (defgroup riece-channel nil
132   "Channel settings"
133   :prefix "riece-"
134   :group 'riece)
135
136 (define-widget 'riece-service-spec 'radio
137   "Edit service spec entries"
138   :convert-widget 'riece-service-spec-convert)
139
140 (defun riece-service-spec-convert (widget)
141   (widget-put widget :args '((integer :tag "Port Number")
142                              (string :tag "Name")))
143   widget)
144
145 (define-widget 'riece-server-spec 'repeat
146   "Edit server spec entries"
147   :match (lambda (widget value)
148            (eval `(and ,@(mapcar
149                           (lambda (entry)
150                             (or (stringp (cdr entry))
151                                 (listp (cdr entry))))
152                           value))))
153   :convert-widget 'riece-server-spec-convert)
154
155 (defun riece-server-spec-convert (widget)
156   (let* ((host '(const :format "" :value :host))
157          (service '(const :format "" :value :service))
158          (host
159           `(group :inline t ,host (string :tag "Host")))
160          (service
161           `(group :inline t ,service riece-service-spec))
162          (spec
163           `(cons (string :tag "Name")
164                  (radio (string :tag "Host")
165                         (list ,host ,service))))
166          (args (list spec)))
167     (widget-put widget :args args)
168     widget))
169
170 (defcustom riece-server-alist nil
171   "An alist mapping server names to plist."
172   :type 'riece-server-spec
173   :group 'riece-server)
174
175 (defcustom riece-server (getenv "IRCSERVER")
176   "IRC server host we are connecting to."
177   :type 'string
178   :group 'riece-server)
179
180 (defcustom riece-protocol 'irc
181   "Protocol support."
182   :type 'symbol
183   :group 'riece-server)
184
185 (defcustom riece-max-send-size 512
186   "Maximum size of messages to be sent at a time."
187   :type 'integer
188   :group 'riece-server)
189
190 (defcustom riece-send-delay 2
191   "Duration of multiple send."
192   :type 'integer
193   :group 'riece-server)
194   
195 (defcustom riece-default-password (getenv "IRCPASSWORD")
196   "Your password."
197   :type '(radio (string :tag "Password")
198                 (const :tag "No" nil))
199   :group 'riece-server)
200
201 (defcustom riece-username nil
202   "Your user name."
203   :type 'string
204   :group 'riece-server)
205
206 (defcustom riece-nickname (or (getenv "IRCNICK")
207                               (user-real-login-name))
208   "Your nickname."
209   :type 'string
210   :group 'riece-server)
211
212 (defcustom riece-startup-channel-list nil
213   "A list of channels to join automatically at startup."
214   :type '(repeat (choice (string :tag "Channel")
215                          (list (string :tag "Channel") (string :tag "Key"))))
216   :group 'riece-channel)
217
218 (defcustom riece-startup-server-list nil
219   "A list of servers to connect automatically at startup."
220   :type '(repeat (string :tag "Server"))
221   :group 'riece-server)
222
223 (defcustom riece-retry-with-new-nickname nil
224   "When nickname has already been in use, grow-tail automatically."
225   :type 'boolean
226   :group 'riece-server)
227
228 (defcustom riece-quit-timeout 10
229   "Quit timeout when there is no response from server."
230   :type '(radio (integer :tag "Seconds")
231                 (const nil))
232   :group 'riece-server)
233
234 (defcustom riece-default-open-connection-function #'open-network-stream
235   "Default function used for connecting to an IRC server."
236   :type 'function
237   :group 'riece-server)
238
239 (defcustom riece-channel-buffer-mode t
240   "When non-nil, Riece will display a channel buffer."
241   :type 'boolean
242   :group 'riece-looks)
243
244 (defcustom riece-user-list-buffer-mode t
245   "When non-nil, Riece will display a nick list buffer."
246   :type 'boolean
247   :group 'riece-looks)
248
249 (defcustom riece-channel-list-buffer-mode t
250   "When non-nil, Riece will display a channel list buffer."
251   :type 'boolean
252   :group 'riece-looks)
253
254 (defcustom riece-default-freeze nil
255   "Channel buffer local freeze flag is on at starting."
256   :type 'boolean
257   :group 'riece-looks)
258
259 (defcustom riece-default-channel-binding nil
260   "The channel list to bind the channel number when joining."
261   :type '(repeat (radio (string :tag "Bound Channel")
262                         (const nil)))
263   :group 'riece-channel)
264
265 (defcustom riece-blink-parens nil
266   "Should we blink matching parenthesis in the command buffer?"
267   :type 'boolean
268   :group 'riece-options)
269
270 (defcustom riece-quit-message (riece-extended-version)
271   "Default quit message."
272   :type '(string :tag "Quit message")
273   :group 'riece-options)
274
275 (defcustom riece-part-message nil
276   "Default part message."
277   :type '(choice (const :tag "No message" nil)
278                  (string :tag "Part message"))
279   :group 'riece-options)
280
281 (defcustom riece-away-message "Gone"
282   "Default away message."
283   :type '(string :tag "Away message")
284   :group 'riece-options)
285
286 (defcustom riece-gather-channel-modes nil
287   "If non-nil, gather channel modes when we join a channel."
288   :type 'boolean
289   :group 'riece-options)
290
291 (defcustom riece-buffer-dispose-function #'kill-buffer
292   "Function called after the buffer was disposed."
293   :type 'function
294   :group 'riece-options)
295
296 (defcustom riece-shrink-buffer-idle-time-delay 5
297   "Number of idle seconds to wait before shrinking channel buffers."
298   :type 'integer
299   :group 'riece-options)
300
301 (defcustom riece-max-buffer-size 65535
302   "Maximum size of channel buffers."
303   :type '(radio (integer :tag "Number of characters")
304                 (const nil))
305   :group 'riece-options)
306
307 (defcustom riece-shrink-buffer-remove-chars (/ riece-max-send-size 2)
308   "Number of chars removed when shrinking channel buffers."
309   :type 'integer
310   :group 'riece-options)
311
312 (defcustom riece-format-time-function #'current-time-string
313   "Function to convert the specified time to the human readable form."
314   :type 'function
315   :group 'riece-options)
316
317 (provide 'riece-options)
318
319 ;;; riece-options.el ends here