Update.
[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-globals)
28
29 ;; User modifiable variables.
30 (defgroup riece nil
31   "Riece specific customize group")
32
33 (defgroup riece-options nil
34   "Riece user customizable variables"
35   :prefix "riece-"
36   :group 'riece)
37
38 (defcustom riece-saved-forms
39   '(riece-server-alist
40     riece-channel-buffer-mode
41     riece-user-list-buffer-mode
42     riece-layout)
43   "Variables saved after each session is completed."
44   :type 'string
45   :group 'riece-options)
46
47 (defcustom riece-debug nil
48   "If non-nil, random debug spews."
49   :type 'boolean
50   :group 'riece-options)
51
52 (defcustom riece-command-prefix "\C-c"
53   "Key sequence to be used as prefix for command mode key bindings."
54   :type 'string
55   :group 'riece-options)
56
57 (defgroup riece-looks nil
58   "Related to look and feel"
59   :prefix "riece-"
60   :group 'riece)
61
62 (defcustom riece-truncate-partial-width-windows nil
63   "If non-nil, truncate lines in splitting windows such as others buffer."
64   :type 'boolean
65   :group 'riece-looks)
66
67 (defcustom riece-use-full-window t
68   "If non-nil, whole Emacs window is used to display dialogue."
69   :type 'boolean
70   :group 'riece-looks)
71
72 (defcustom riece-directory (expand-file-name "~/.riece")
73   "Where to look for data files."
74   :type 'directory
75   :group 'riece-options)
76
77 (defcustom riece-addon-directory
78   (expand-file-name "addons" riece-directory)
79   "Where to look for add-on files."
80   :type 'directory
81   :group 'riece-options)
82   
83 (defcustom riece-variables-file
84   (expand-file-name "init" riece-directory)
85   "Where to look for variables."
86   :type 'file
87   :group 'riece-options)
88
89 (defcustom riece-saved-variables-file
90   (expand-file-name "save" riece-directory)
91   "Where to look for variables.
92 This file was saved the last session."
93   :type 'file
94   :group 'riece-options)
95
96 (defcustom riece-variables-files
97   (list riece-saved-variables-file riece-variables-file)
98   "Where to look for variables.  Helps to remove clutter from your .emacs.
99 This feature is most likely to dissappear in near future.  The preferred
100 way is to put Riece variables on .emacs or file loaded from there."
101   :type '(repeat (file :tag "Initialization File"))
102   :group 'riece-options)
103
104 (defcustom riece-addons '(riece-highlight
105                           riece-ctcp
106                           riece-guess
107                           riece-unread
108                           riece-history
109                           riece-url
110                           riece-button
111                           riece-menu
112                           riece-icon)
113   "Add-ons insinuated into Riece."
114   :type '(repeat symbol)
115   :group 'riece-options)
116
117 (defgroup riece-server nil
118   "Server settings"
119   :prefix "riece-"
120   :group 'riece)
121
122 (defgroup riece-channel nil
123   "Channel settings"
124   :prefix "riece-"
125   :group 'riece)
126
127 (define-widget 'riece-service-spec 'radio
128   "Edit service spec entries"
129   :convert-widget 'riece-service-spec-convert)
130
131 (defun riece-service-spec-convert (widget)
132   (widget-put widget :args '((integer :tag "Port Number")
133                              (string :tag "Name")))
134   widget)
135
136 (define-widget 'riece-server-spec 'repeat
137   "Edit server spec entries"
138   :match (lambda (widget value)
139            (eval `(and ,@(mapcar
140                           (lambda (entry)
141                             (or (stringp (cdr entry))
142                                 (listp (cdr entry))))
143                           value))))
144   :convert-widget 'riece-server-spec-convert)
145
146 (defun riece-server-spec-convert (widget)
147   (let* ((host '(const :format "" :value :host))
148          (service '(const :format "" :value :service))
149          (host
150           `(group :inline t ,host (string :tag "Host")))
151          (service
152           `(group :inline t ,service riece-service-spec))
153          (spec
154           `(cons (string :tag "Name")
155                  (radio (string :tag "Host")
156                         (list ,host ,service))))
157          (args (list spec)))
158     (widget-put widget :args args)
159     widget))
160   
161 (defcustom riece-server-alist nil
162   "An alist mapping server names to plist."
163   :type 'riece-server-spec
164   :group 'riece-server)
165
166 (defcustom riece-server (getenv "IRCSERVER")
167   "IRC server host we are connecting to."
168   :type 'string
169   :group 'riece-server)
170
171 (defcustom riece-default-password (getenv "IRCPASSWORD")
172   "Your password."
173   :type '(radio (string :tag "Password")
174                 (const :tag "No" nil))
175   :group 'riece-server)
176
177 (defcustom riece-username (or (getenv "IRCNAME")
178                               (user-real-login-name))
179   "Your user name."
180   :type 'string
181   :group 'riece-server)
182
183 (defcustom riece-nickname (or (getenv "IRCNICK")
184                               (user-real-login-name))
185   "Your nickname."
186   :type 'string
187   :group 'riece-server)
188
189 (defcustom riece-startup-channel-list nil
190   "A list of channels to join automatically at startup."
191   :type '(repeat (choice (string :tag "Channel")
192                          (list (string :tag "Channel") (string :tag "Key"))))
193   :group 'riece-channel)
194
195 (defcustom riece-retry-with-new-nickname nil
196   "When nickname has already been in use, grow-tail automatically."
197   :type 'boolean
198   :group 'riece-server)
199
200 (defcustom riece-quit-timeout 10
201   "Quit timeout when there is no response from server."
202   :type '(radio (integer :tag "Seconds")
203                 (const nil))
204   :group 'riece-server)
205
206 (defcustom riece-default-open-connection-function #'open-network-stream
207   "Default function used for connecting to an IRC server."
208   :type 'function
209   :group 'riece-server)
210
211 (defcustom riece-channel-buffer-mode t
212   "When non-nil, Riece will display a channel buffer."
213   :type 'boolean
214   :group 'riece-looks)
215
216 (defcustom riece-user-list-buffer-mode t
217   "When non-nil, Riece will display a nick list buffer."
218   :type 'boolean
219   :group 'riece-looks)
220
221 (defcustom riece-channel-list-buffer-mode t
222   "When non-nil, Riece will display a channel list buffer."
223   :type 'boolean
224   :group 'riece-looks)
225
226 (defcustom riece-default-freeze nil
227   "Channel buffer local freeze flag is on at starting."
228   :type 'boolean
229   :group 'riece-looks)
230
231 (defcustom riece-default-channel-binding nil
232   "The channel list to bind the channel number when joining."
233   :type '(repeat (radio (string :tag "Bound Channel")
234                         (const nil)))
235   :group 'riece-channel)
236
237 (defcustom riece-blink-parens nil
238   "Should we blink matching parenthesis in the command buffer?"
239   :type 'boolean
240   :group 'riece-options)
241
242 (defcustom riece-quit-message nil
243   "Default quit message."
244   :type '(radio (string :tag "Quit message"))
245   :group 'riece-options)
246
247 (defcustom riece-away-message nil
248   "Default away message."
249   :type '(radio (string :tag "Away message"))
250   :group 'riece-options)
251
252 (defcustom riece-gather-channel-modes nil
253   "If non-nil, gather channel modes when we join a channel."
254   :type 'boolean
255   :group 'riece-options)
256
257 (defcustom riece-buffer-dispose-function #'bury-buffer
258   "Function called after the buffer was disposed."
259   :type 'function
260   :group 'riece-options)
261
262 (defcustom riece-shrink-buffer-idle-time-delay 5
263   "Number of idle seconds to wait before shrinking channel buffers."
264   :type 'integer
265   :group 'riece-options)
266
267 (defcustom riece-max-buffer-size 65535
268   "Maximum size of channel buffers."
269   :type '(radio (integer :tag "Number of characters")
270                 (const nil))
271   :group 'riece-options)
272
273 (defcustom riece-format-time-function #'current-time-string
274   "Function to convert the specified time to the human readable form."
275   :type 'function
276   :group 'riece-options)
277
278 (provide 'riece-options)
279
280 ;;; riece-options.el ends here