1a0f37d1fb9225f2e5f781dba5d94118f714855b
[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-others-buffer-mode
43     riece-user-list-buffer-mode
44     riece-channel-list-buffer-mode
45     riece-layout
46     riece-addons)
47   "Variables saved after each session is completed."
48   :type 'string
49   :group 'riece-options)
50
51 (defcustom riece-debug nil
52   "If non-nil, random debug spews."
53   :type 'boolean
54   :group 'riece-options)
55
56 (defcustom riece-command-prefix "\C-c"
57   "Key sequence to be used as prefix for command mode key bindings."
58   :type 'string
59   :group 'riece-options)
60
61 (defgroup riece-looks nil
62   "Look and feel."
63   :prefix "riece-"
64   :group 'riece)
65
66 (defcustom riece-use-full-window t
67   "If non-nil, whole Emacs window is used to display dialogue."
68   :type 'boolean
69   :group 'riece-looks)
70
71 (defcustom riece-window-center-line -2
72   "Line number of center point in window when scrolling.
73 If nil, erases the entire frame and then redraws with point in the
74 center of the window.  Negative means relative to bottom of window.
75 See the document of the function `recenter'."
76   :type 'integer
77   :group 'riece-looks)
78
79 (defcustom riece-directory (expand-file-name "~/.riece")
80   "Where to look for startup files."
81   :type 'directory
82   :group 'riece-options)
83
84 (defcustom riece-addon-directory
85   (expand-file-name "addons" riece-directory)
86   "Where to look for add-on files."
87   :type 'directory
88   :group 'riece-options)
89
90 (defcustom riece-data-directory
91   (if (fboundp 'locate-data-directory)
92       (locate-data-directory "riece")
93     (file-name-directory load-file-name))
94   "Where to look for data files."
95   :type 'directory
96   :group 'riece-options)
97
98 (defcustom riece-variables-file
99   (expand-file-name "init" riece-directory)
100   "Where to look for variables."
101   :type 'file
102   :group 'riece-options)
103
104 (defcustom riece-saved-variables-file
105   (expand-file-name "save" riece-directory)
106   "Where to look for variables.
107 This file was saved the last session."
108   :type 'file
109   :group 'riece-options)
110
111 (defcustom riece-variables-files
112   (list riece-saved-variables-file riece-variables-file)
113   "Where to look for variables.  Helps to remove clutter from your .emacs.
114 This feature is most likely to dissappear in near future.  The preferred
115 way is to put Riece variables on .emacs or file loaded from there."
116   :type '(repeat (file :tag "Initialization File"))
117   :group 'riece-options)
118
119 (defcustom riece-addons '(riece-highlight
120                           riece-ctcp
121                           riece-guess
122                           riece-unread
123                           riece-history
124                           riece-url
125                           riece-button
126                           riece-menu
127                           riece-icon
128                           riece-ignore
129                           riece-log
130                           riece-toolbar
131                           riece-alias
132                           riece-ctlseq
133                           riece-keyword)
134   "Add-ons insinuated into Riece."
135   :type '(repeat symbol)
136   :group 'riece-options)
137
138 (defgroup riece-server nil
139   "Server settings."
140   :prefix "riece-"
141   :group 'riece)
142
143 (defgroup riece-channel nil
144   "Channel settings."
145   :prefix "riece-"
146   :group 'riece)
147
148 (define-widget 'riece-service-spec 'radio
149   "Edit service spec entries"
150   :convert-widget 'riece-service-spec-convert)
151
152 (defun riece-service-spec-convert (widget)
153   (widget-put widget :args '((integer :tag "Port Number")
154                              (string :tag "Name")))
155   widget)
156
157 (define-widget 'riece-server-spec 'repeat
158   "Edit server spec entries"
159   :match (lambda (widget value)
160            (eval `(and ,@(mapcar
161                           (lambda (entry)
162                             (or (stringp (cdr entry))
163                                 (listp (cdr entry))))
164                           value))))
165   :convert-widget 'riece-server-spec-convert)
166
167 (defun riece-server-spec-convert (widget)
168   (let* ((host '(const :format "" :value :host))
169          (service '(const :format "" :value :service))
170          (host
171           `(group :inline t ,host (string :tag "Host")))
172          (service
173           `(group :inline t ,service riece-service-spec))
174          (spec
175           `(cons (string :tag "Name")
176                  (radio (string :tag "Host")
177                         (list ,host ,service))))
178          (args (list spec)))
179     (widget-put widget :args args)
180     widget))
181
182 (defcustom riece-server-alist nil
183   "An alist mapping server names to plist."
184   :type 'riece-server-spec
185   :group 'riece-server)
186
187 (defcustom riece-server (getenv "IRCSERVER")
188   "IRC server host we are connecting to."
189   :type 'string
190   :group 'riece-server)
191
192 (defcustom riece-protocol 'irc
193   "Protocol support."
194   :type 'symbol
195   :group 'riece-server)
196
197 (defcustom riece-max-send-size 512
198   "Maximum size of messages to be sent at a time."
199   :type 'integer
200   :group 'riece-server)
201
202 (defcustom riece-send-delay 2
203   "Duration of multiple send."
204   :type 'integer
205   :group 'riece-server)
206   
207 (defcustom riece-default-password (getenv "IRCPASSWORD")
208   "Your password."
209   :type '(radio (string :tag "Password")
210                 (const :tag "No" nil))
211   :group 'riece-server)
212
213 (defcustom riece-username nil
214   "Your user name."
215   :type 'string
216   :group 'riece-server)
217
218 (defcustom riece-nickname (or (getenv "IRCNICK")
219                               (user-real-login-name))
220   "Your nickname."
221   :type 'string
222   :group 'riece-server)
223
224 (defcustom riece-startup-channel-list nil
225   "A list of channels to join automatically at startup."
226   :type '(repeat (choice (string :tag "Channel")
227                          (list (string :tag "Channel") (string :tag "Key"))))
228   :group 'riece-channel)
229
230 (defcustom riece-startup-server-list nil
231   "A list of servers to connect automatically at startup."
232   :type '(repeat (string :tag "Server"))
233   :group 'riece-server)
234
235 (defcustom riece-retry-with-new-nickname nil
236   "When nickname has already been in use, grow-tail automatically."
237   :type 'boolean
238   :group 'riece-server)
239
240 (defcustom riece-quit-timeout 1
241   "Quit timeout when there is no response from server."
242   :type '(radio (integer :tag "Seconds")
243                 (const nil))
244   :group 'riece-server)
245
246 (defcustom riece-default-open-connection-function #'open-network-stream
247   "Default function used for connecting to an IRC server."
248   :type 'function
249   :group 'riece-server)
250
251 (defcustom riece-user-cache-max-size 512
252   "Maximum size of cache of usernames."
253   :type 'integer
254   :group 'riece-server)
255
256 (defcustom riece-channel-buffer-mode t
257   "When non-nil, Riece will display a channel buffer."
258   :type 'boolean
259   :group 'riece-looks)
260
261 (defcustom riece-others-buffer-mode t
262   "When non-nil, Riece will display an \"*Others*\" buffer."
263   :type 'boolean
264   :group 'riece-looks)
265
266 (defcustom riece-user-list-buffer-mode t
267   "When non-nil, Riece will display a nick list buffer."
268   :type 'boolean
269   :group 'riece-looks)
270
271 (defcustom riece-channel-list-buffer-mode t
272   "When non-nil, Riece will display a channel list buffer."
273   :type 'boolean
274   :group 'riece-looks)
275
276 (defcustom riece-default-freeze nil
277   "Channel buffer local freeze flag is on at starting."
278   :type 'boolean
279   :group 'riece-looks)
280
281 (defcustom riece-default-channel-binding nil
282   "The channel list to bind the channel number when joining."
283   :type '(repeat (radio (string :tag "Bound Channel")
284                         (const nil)))
285   :group 'riece-channel)
286
287 (defcustom riece-blink-parens nil
288   "Should we blink matching parenthesis in the command buffer?"
289   :type 'boolean
290   :group 'riece-options)
291
292 (defcustom riece-quit-message (riece-extended-version)
293   "Default quit message."
294   :type '(string :tag "Quit message")
295   :group 'riece-options)
296
297 (defcustom riece-part-message nil
298   "Default part message."
299   :type '(choice (const :tag "No message" nil)
300                  (string :tag "Part message"))
301   :group 'riece-options)
302
303 (defcustom riece-away-message "Gone"
304   "Default away message."
305   :type '(string :tag "Away message")
306   :group 'riece-options)
307
308 (defcustom riece-gather-channel-modes nil
309   "If non-nil, gather channel modes when we join a channel."
310   :type 'boolean
311   :group 'riece-options)
312
313 (defcustom riece-buffer-dispose-function #'kill-buffer
314   "Function called after the buffer was disposed."
315   :type 'function
316   :group 'riece-options)
317
318 (defcustom riece-format-time-function #'current-time-string
319   "Function to convert the specified time to the human readable form."
320   :type 'function
321   :group 'riece-options)
322
323 (provide 'riece-options)
324
325 ;;; riece-options.el ends here