48d78a24ce72ad48bccf6b3717e1c8b5fb3a3d88
[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   "Add-ons insinuated into Riece."
121   :type '(repeat symbol)
122   :group 'riece-options)
123
124 (defgroup riece-server nil
125   "Server settings"
126   :prefix "riece-"
127   :group 'riece)
128
129 (defgroup riece-channel nil
130   "Channel settings"
131   :prefix "riece-"
132   :group 'riece)
133
134 (define-widget 'riece-service-spec 'radio
135   "Edit service spec entries"
136   :convert-widget 'riece-service-spec-convert)
137
138 (defun riece-service-spec-convert (widget)
139   (widget-put widget :args '((integer :tag "Port Number")
140                              (string :tag "Name")))
141   widget)
142
143 (define-widget 'riece-server-spec 'repeat
144   "Edit server spec entries"
145   :match (lambda (widget value)
146            (eval `(and ,@(mapcar
147                           (lambda (entry)
148                             (or (stringp (cdr entry))
149                                 (listp (cdr entry))))
150                           value))))
151   :convert-widget 'riece-server-spec-convert)
152
153 (defun riece-server-spec-convert (widget)
154   (let* ((host '(const :format "" :value :host))
155          (service '(const :format "" :value :service))
156          (host
157           `(group :inline t ,host (string :tag "Host")))
158          (service
159           `(group :inline t ,service riece-service-spec))
160          (spec
161           `(cons (string :tag "Name")
162                  (radio (string :tag "Host")
163                         (list ,host ,service))))
164          (args (list spec)))
165     (widget-put widget :args args)
166     widget))
167
168 (defcustom riece-server-alist nil
169   "An alist mapping server names to plist."
170   :type 'riece-server-spec
171   :group 'riece-server)
172
173 (defcustom riece-server (getenv "IRCSERVER")
174   "IRC server host we are connecting to."
175   :type 'string
176   :group 'riece-server)
177
178 (defcustom riece-protocol 'irc
179   "Protocol support."
180   :type 'symbol
181   :group 'riece-server)
182
183 (defcustom riece-max-send-size 512
184   "Maximum size of messages to be sent at a time."
185   :type 'integer
186   :group 'riece-server)
187
188 (defcustom riece-send-delay 2
189   "Duration of multiple send."
190   :type 'integer
191   :group 'riece-server)
192   
193 (defcustom riece-default-password (getenv "IRCPASSWORD")
194   "Your password."
195   :type '(radio (string :tag "Password")
196                 (const :tag "No" nil))
197   :group 'riece-server)
198
199 (defcustom riece-username (or (getenv "IRCNAME")
200                               user-full-name)
201   "Your user name."
202   :type 'string
203   :group 'riece-server)
204
205 (defcustom riece-nickname (or (getenv "IRCNICK")
206                               (user-real-login-name))
207   "Your nickname."
208   :type 'string
209   :group 'riece-server)
210
211 (defcustom riece-startup-channel-list nil
212   "A list of channels to join automatically at startup."
213   :type '(repeat (choice (string :tag "Channel")
214                          (list (string :tag "Channel") (string :tag "Key"))))
215   :group 'riece-channel)
216
217 (defcustom riece-startup-server-list nil
218   "A list of servers to connect automatically at startup."
219   :type '(repeat (string :tag "Server"))
220   :group 'riece-server)
221
222 (defcustom riece-retry-with-new-nickname nil
223   "When nickname has already been in use, grow-tail automatically."
224   :type 'boolean
225   :group 'riece-server)
226
227 (defcustom riece-quit-timeout 10
228   "Quit timeout when there is no response from server."
229   :type '(radio (integer :tag "Seconds")
230                 (const nil))
231   :group 'riece-server)
232
233 (defcustom riece-default-open-connection-function #'open-network-stream
234   "Default function used for connecting to an IRC server."
235   :type 'function
236   :group 'riece-server)
237
238 (defcustom riece-channel-buffer-mode t
239   "When non-nil, Riece will display a channel buffer."
240   :type 'boolean
241   :group 'riece-looks)
242
243 (defcustom riece-user-list-buffer-mode t
244   "When non-nil, Riece will display a nick list buffer."
245   :type 'boolean
246   :group 'riece-looks)
247
248 (defcustom riece-channel-list-buffer-mode t
249   "When non-nil, Riece will display a channel list buffer."
250   :type 'boolean
251   :group 'riece-looks)
252
253 (defcustom riece-default-freeze nil
254   "Channel buffer local freeze flag is on at starting."
255   :type 'boolean
256   :group 'riece-looks)
257
258 (defcustom riece-default-channel-binding nil
259   "The channel list to bind the channel number when joining."
260   :type '(repeat (radio (string :tag "Bound Channel")
261                         (const nil)))
262   :group 'riece-channel)
263
264 (defcustom riece-blink-parens nil
265   "Should we blink matching parenthesis in the command buffer?"
266   :type 'boolean
267   :group 'riece-options)
268
269 (defcustom riece-quit-message (riece-extended-version)
270   "Default quit message."
271   :type '(string :tag "Quit message")
272   :group 'riece-options)
273
274 (defcustom riece-away-message "Gone"
275   "Default away message."
276   :type '(string :tag "Away message")
277   :group 'riece-options)
278
279 (defcustom riece-gather-channel-modes nil
280   "If non-nil, gather channel modes when we join a channel."
281   :type 'boolean
282   :group 'riece-options)
283
284 (defcustom riece-buffer-dispose-function #'bury-buffer
285   "Function called after the buffer was disposed."
286   :type 'function
287   :group 'riece-options)
288
289 (defcustom riece-shrink-buffer-idle-time-delay 5
290   "Number of idle seconds to wait before shrinking channel buffers."
291   :type 'integer
292   :group 'riece-options)
293
294 (defcustom riece-max-buffer-size 65535
295   "Maximum size of channel buffers."
296   :type '(radio (integer :tag "Number of characters")
297                 (const nil))
298   :group 'riece-options)
299
300 (defcustom riece-shrink-buffer-remove-chars (/ riece-max-send-size 2)
301   "Number of chars removed when shrinking channel buffers."
302   :type 'integer
303   :group 'riece-options)
304
305 (defcustom riece-format-time-function #'current-time-string
306   "Function to convert the specified time to the human readable form."
307   :type 'function
308   :group 'riece-options)
309
310 (provide 'riece-options)
311
312 ;;; riece-options.el ends here