* riece-300.el (riece-handle-341-message): New handler.
[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   "Variables saved after each session is completed."
43   :type 'string
44   :group 'riece-options)
45
46 (defcustom riece-debug nil
47   "If non-nil, random debug spews."
48   :type 'boolean
49   :group 'riece-options)
50
51 (defgroup riece-looks nil
52   "Related to look and feel"
53   :prefix "riece-"
54   :group 'riece)
55
56 (defcustom riece-truncate-partial-width-windows nil
57   "If non-nil, truncate lines in splitting windows such as others buffer."
58   :type 'boolean
59   :group 'riece-looks)
60
61 (defcustom riece-use-full-window t
62   "If non-nil, whole Emacs window is used to display dialogue."
63   :type 'boolean
64   :group 'riece-looks)
65
66 (defcustom riece-tab-stop-list '(2 4 6 8 10 12 14 16)
67   "To override `tab-stop-list'."
68   :type '(repeat integer)
69   :group 'riece-looks)
70
71 (defcustom riece-icon-directory nil
72   "Location of the icon directory."
73   :type 'directory
74   :group 'riece-looks)
75
76 (defcustom riece-user-image-alist
77   '((?@ . "ball.red.xpm")
78     (?+ . "ball.gray.xpm")
79     (?  . "ball.blank.xpm"))
80   "An alist of icons to display user's mode."
81   :type '(repeat (list (character :tag "Mark")
82                        (string :tag "XPM file")))
83   :group 'riece-looks)
84
85 (defcustom riece-inhibit-startup-message nil
86   "If non-nil, the startup message will not be displayed."
87   :group 'riece-looks
88   :type 'boolean)
89
90 (defcustom riece-directory "~/.riece"
91   "Where to look for data files."
92   :type 'directory
93   :group 'riece-options)
94   
95 (defcustom riece-variables-file
96   (expand-file-name "init" riece-directory)
97   "Where to look for variables."
98   :type 'file
99   :group 'riece-options)
100
101 (defcustom riece-saved-variables-file
102   (expand-file-name "save" riece-directory)
103   "Where to look for variables.
104 This file was saved the last session."
105   :type 'file
106   :group 'riece-options)
107
108 (defcustom riece-variables-files
109   (list riece-saved-variables-file riece-variables-file)
110   "Where to look for variables.  Helps to remove clutter from your .emacs.
111 This feature is most likely to dissappear in near future.  The preferred
112 way is to put Riece variables on .emacs or file loaded from there."
113   :type '(repeat (file :tag "Initialization File"))
114   :group 'riece-options)
115
116 (defgroup riece-server nil
117   "Server settings"
118   :prefix "riece-"
119   :group 'riece)
120
121 (defgroup riece-channel nil
122   "Channel settings"
123   :prefix "riece-"
124   :group 'riece)
125
126 (define-widget 'riece-service-spec 'radio
127   "Edit service spec entries"
128   :convert-widget 'riece-service-spec-convert)
129
130 (defun riece-service-spec-convert (widget)
131   (widget-put widget :args '((integer :tag "Port Number")
132                              (string :tag "Name")))
133   widget)
134
135 (define-widget 'riece-server-spec 'repeat
136   "Edit server spec entries"
137   :match (lambda (widget value)
138            (eval `(and ,@(mapcar
139                           (lambda (entry)
140                             (or (stringp (cdr entry))
141                                 (listp (cdr entry))))
142                           value))))
143   :convert-widget 'riece-server-spec-convert)
144
145 (defun riece-server-spec-convert (widget)
146   (let* ((host '(const :format "" :value :host))
147          (service '(const :format "" :value :service))
148          (host
149           `(group :inline t ,host (string :tag "Host")))
150          (service
151           `(group :inline t ,service riece-service-spec))
152          (spec
153           `(cons (string :tag "Name")
154                  (radio (string :tag "Host")
155                         (list ,host ,service))))
156          (args (list spec)))
157     (widget-put widget :args args)
158     widget))
159   
160 (defcustom riece-server-alist nil
161   "An alist mapping server names to plist."
162   :type 'riece-server-spec
163   :group 'riece-server)
164
165 (defcustom riece-server (getenv "IRCSERVER")
166   "IRC server host we are connecting to."
167   :type 'string
168   :group 'riece-server)
169
170 (defcustom riece-default-password (getenv "IRCPASSWORD")
171   "Your password."
172   :type '(radio (string :tag "Password")
173                 (const :tag "No" nil))
174   :group 'riece-server)
175
176 (defcustom riece-username (or (getenv "IRCNAME")
177                               (user-real-login-name))
178   "Your user name."
179   :type 'string
180   :group 'riece-server)
181
182 (defcustom riece-nickname (or (getenv "IRCNICK")
183                               (user-real-login-name))
184   "Your nickname."
185   :type 'string
186   :group 'riece-server)
187
188 (defcustom riece-startup-channel-list nil
189   "A list of channels to join automatically at startup."
190   :type '(repeat (string :tag "Startup Channel"))
191   :group 'riece-channel)
192
193 (defcustom riece-retry-with-new-nickname nil
194   "When nickname has already been in use, grow-tail automatically."
195   :type 'boolean
196   :group 'riece-server)
197
198 (defcustom riece-channel-buffer-mode t
199   "When non-nil, Riece will display a channel buffer."
200   :type 'boolean
201   :group 'riece-looks)
202
203 (defcustom riece-user-list-buffer-mode t
204   "When non-nil, Riece will display a nick list buffer."
205   :type 'boolean
206   :group 'riece-looks)
207
208 (defcustom riece-channel-list-buffer-mode t
209   "When non-nil, Riece will display a channel list buffer."
210   :type 'boolean
211   :group 'riece-looks)
212
213 (defcustom riece-default-freeze nil
214   "If non nil, channel buffer local freeze flag is on at starting."
215   :type 'boolean
216   :group 'riece-looks)
217
218 (defcustom riece-default-own-freeze nil
219   "If non nil, channel buffer local own freeze flag is on at starting."
220   :type 'boolean
221   :group 'riece-looks)
222
223 (defcustom riece-default-channel-binding nil
224   "The channel list to bind the channel number when joining."
225   :type '(repeat (radio (string :tag "Bound Channel")
226                         (const nil)))
227   :group 'riece-channel)
228
229 (defcustom riece-blink-parens nil
230   "Should we blink matching parenthesis in the command buffer?"
231   :type 'boolean
232   :group 'riece-options)
233
234 (defcustom riece-quit-message nil
235   "Default signoff message."
236   :type '(radio (string :tag "Signoff message"))
237   :group 'riece-options)
238
239 (defcustom riece-gather-channel-modes t
240   "If non-nil, gather channel modes when we join a channel."
241   :type 'boolean
242   :group 'riece-options)
243
244 (defcustom riece-connection-timeout 60
245   "Default timeout interval."
246   :type 'integer
247   :group 'riece-server)
248   
249 (defcustom riece-buffer-dispose-function #'bury-buffer
250   "Function called after the buffer was disposed."
251   :type 'function
252   :group 'riece-options)
253
254 (defcustom riece-format-time-function #'current-time-string
255   "Function to convert the specified time to the human readable form."
256   :type 'function
257   :group 'riece-options)
258
259 (provide 'riece-options)
260
261 ;;; riece-options.el ends here