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