Add 5.0.0 changes.
[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 (define-widget 'riece-service-spec 'radio
153   "Edit service spec entries"
154   :convert-widget 'riece-service-spec-convert)
155
156 (defun riece-service-spec-convert (widget)
157   (widget-put widget :args '((integer :tag "Port Number")
158                              (string :tag "Name")))
159   widget)
160
161 (define-widget 'riece-server-spec 'repeat
162   "Edit server spec entries"
163   :match (lambda (widget value)
164            (eval `(and ,@(mapcar
165                           (lambda (entry)
166                             (or (stringp (cdr entry))
167                                 (listp (cdr entry))))
168                           value))))
169   :convert-widget 'riece-server-spec-convert)
170
171 (defun riece-server-spec-convert (widget)
172   (let* ((host '(const :format "" :value :host))
173          (service '(const :format "" :value :service))
174          (host
175           `(group :inline t ,host (string :tag "Host")))
176          (service
177           `(group :inline t ,service riece-service-spec))
178          (spec
179           `(cons (string :tag "Name")
180                  (radio (string :tag "Host")
181                         (list ,host ,service))))
182          (args (list spec)))
183     (widget-put widget :args args)
184     widget))
185
186 (defcustom riece-server-alist nil
187   "An alist mapping server names to plist."
188   :type 'riece-server-spec
189   :group 'riece-server)
190
191 (defcustom riece-server (getenv "IRCSERVER")
192   "IRC server host we are connecting to."
193   :type 'string
194   :group 'riece-server)
195
196 (defcustom riece-protocol 'irc
197   "Protocol support."
198   :type 'symbol
199   :group 'riece-server)
200
201 (defcustom riece-max-send-size 512
202   "Maximum size of messages to be sent at a time."
203   :type 'integer
204   :group 'riece-server)
205
206 (defcustom riece-send-delay 2
207   "Duration of multiple send."
208   :type 'integer
209   :group 'riece-server)
210   
211 (defcustom riece-default-password (getenv "IRCPASSWORD")
212   "Your password."
213   :type '(radio (string :tag "Password")
214                 (const :tag "No" nil))
215   :group 'riece-server)
216
217 (defcustom riece-username nil
218   "Your login name."
219   :type 'string
220   :group 'riece-server)
221
222 (defcustom riece-realname nil
223   "Your user name."
224   :type 'string
225   :group 'riece-server)
226
227 (defcustom riece-nickname (or (getenv "IRCNICK")
228                               (user-real-login-name))
229   "Your nickname."
230   :type 'string
231   :group 'riece-server)
232
233 (defcustom riece-startup-channel-list nil
234   "A list of channels to join automatically at startup."
235   :type '(repeat (choice (string :tag "Channel")
236                          (list (string :tag "Channel") (string :tag "Key"))))
237   :group 'riece-channel)
238
239 (defcustom riece-startup-server-list nil
240   "A list of servers to connect automatically at startup."
241   :type '(repeat (string :tag "Server"))
242   :group 'riece-server)
243
244 (defcustom riece-retry-with-new-nickname nil
245   "When nickname has already been in use, grow-tail automatically."
246   :type 'boolean
247   :group 'riece-server)
248
249 (defcustom riece-quit-timeout 1
250   "Quit timeout when there is no response from server."
251   :type '(radio (integer :tag "Seconds")
252                 (const nil))
253   :group 'riece-server)
254
255 (defcustom riece-default-open-connection-function #'open-network-stream
256   "Default function used for connecting to an IRC server."
257   :type 'function
258   :group 'riece-server)
259
260 (defcustom riece-user-cache-max-size 512
261   "Maximum size of cache of user names."
262   :type 'integer
263   :group 'riece-server)
264
265 (defcustom riece-channel-cache-max-size 512
266   "Maximum size of cache of channel names."
267   :type 'integer
268   :group 'riece-server)
269
270 (defcustom riece-channel-buffer-mode t
271   "When non-nil, Riece will display a channel buffer."
272   :type 'boolean
273   :group 'riece-looks)
274
275 (defcustom riece-others-buffer-mode t
276   "When non-nil, Riece will display an \"*Others*\" buffer."
277   :type 'boolean
278   :group 'riece-looks)
279
280 (defcustom riece-user-list-buffer-mode t
281   "When non-nil, Riece will display a nick list buffer."
282   :type 'boolean
283   :group 'riece-looks)
284
285 (defcustom riece-channel-list-buffer-mode t
286   "When non-nil, Riece will display a channel list buffer."
287   :type 'boolean
288   :group 'riece-looks)
289
290 (defcustom riece-default-freeze nil
291   "Channel buffer local freeze flag is on at starting."
292   :type 'boolean
293   :group 'riece-looks)
294
295 (defcustom riece-default-channel-binding nil
296   "The channel list to bind the channel number when joining."
297   :type '(repeat (radio (string :tag "Bound Channel")
298                         (const nil)))
299   :group 'riece-channel)
300
301 (defcustom riece-blink-parens nil
302   "Should we blink matching parenthesis in the command buffer?"
303   :type 'boolean
304   :group 'riece-options)
305
306 (defcustom riece-quit-message (riece-extended-version)
307   "Default quit message."
308   :type '(string :tag "Quit message")
309   :group 'riece-options)
310
311 (defcustom riece-part-message nil
312   "Default part message."
313   :type '(choice (const :tag "No message" nil)
314                  (string :tag "Part message"))
315   :group 'riece-options)
316
317 (defcustom riece-away-message "Gone"
318   "Default away message."
319   :type '(string :tag "Away message")
320   :group 'riece-options)
321
322 (defcustom riece-gather-channel-modes nil
323   "If non-nil, gather channel modes when we join a channel."
324   :type 'boolean
325   :group 'riece-options)
326
327 (defcustom riece-buffer-dispose-function #'kill-buffer
328   "Function called after the buffer was disposed."
329   :type 'function
330   :group 'riece-options)
331
332 (defcustom riece-format-time-function #'current-time-string
333   "Function to convert the specified time to the human readable form."
334   :type 'function
335   :group 'riece-options)
336
337 (provide 'riece-options)
338
339 ;;; riece-options.el ends here