93be792976ae14e2cb900f49fa982fe3794b00c3
[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 (defcustom riece-command-prefix "\C-c"
52   "Key sequence to be used as prefix for command mode key bindings."
53   :type 'string
54   :group 'riece-options)
55
56 (defgroup riece-looks nil
57   "Related to look and feel"
58   :prefix "riece-"
59   :group 'riece)
60
61 (defcustom riece-truncate-partial-width-windows nil
62   "If non-nil, truncate lines in splitting windows such as others buffer."
63   :type 'boolean
64   :group 'riece-looks)
65
66 (defcustom riece-use-full-window t
67   "If non-nil, whole Emacs window is used to display dialogue."
68   :type 'boolean
69   :group 'riece-looks)
70
71 (defcustom riece-directory (expand-file-name "~/.riece")
72   "Where to look for data files."
73   :type 'directory
74   :group 'riece-options)
75
76 (defcustom riece-addon-directory
77   (expand-file-name "addons" riece-directory)
78   "Where to look for add-on files."
79   :type 'directory
80   :group 'riece-options)
81   
82 (defcustom riece-variables-file
83   (expand-file-name "init" riece-directory)
84   "Where to look for variables."
85   :type 'file
86   :group 'riece-options)
87
88 (defcustom riece-saved-variables-file
89   (expand-file-name "save" riece-directory)
90   "Where to look for variables.
91 This file was saved the last session."
92   :type 'file
93   :group 'riece-options)
94
95 (defcustom riece-variables-files
96   (list riece-saved-variables-file riece-variables-file)
97   "Where to look for variables.  Helps to remove clutter from your .emacs.
98 This feature is most likely to dissappear in near future.  The preferred
99 way is to put Riece variables on .emacs or file loaded from there."
100   :type '(repeat (file :tag "Initialization File"))
101   :group 'riece-options)
102
103 (defcustom riece-addons '(riece-highlight
104                           riece-ctcp
105                           riece-guess
106                           riece-unread
107                           riece-history
108                           riece-url
109                           riece-button
110                           riece-menu)
111   "Add-ons insinuated into Riece."
112   :type '(repeat symbol)
113   :group 'riece-options)
114
115 (defgroup riece-server nil
116   "Server settings"
117   :prefix "riece-"
118   :group 'riece)
119
120 (defgroup riece-channel nil
121   "Channel settings"
122   :prefix "riece-"
123   :group 'riece)
124
125 (define-widget 'riece-service-spec 'radio
126   "Edit service spec entries"
127   :convert-widget 'riece-service-spec-convert)
128
129 (defun riece-service-spec-convert (widget)
130   (widget-put widget :args '((integer :tag "Port Number")
131                              (string :tag "Name")))
132   widget)
133
134 (define-widget 'riece-server-spec 'repeat
135   "Edit server spec entries"
136   :match (lambda (widget value)
137            (eval `(and ,@(mapcar
138                           (lambda (entry)
139                             (or (stringp (cdr entry))
140                                 (listp (cdr entry))))
141                           value))))
142   :convert-widget 'riece-server-spec-convert)
143
144 (defun riece-server-spec-convert (widget)
145   (let* ((host '(const :format "" :value :host))
146          (service '(const :format "" :value :service))
147          (host
148           `(group :inline t ,host (string :tag "Host")))
149          (service
150           `(group :inline t ,service riece-service-spec))
151          (spec
152           `(cons (string :tag "Name")
153                  (radio (string :tag "Host")
154                         (list ,host ,service))))
155          (args (list spec)))
156     (widget-put widget :args args)
157     widget))
158   
159 (defcustom riece-server-alist nil
160   "An alist mapping server names to plist."
161   :type 'riece-server-spec
162   :group 'riece-server)
163
164 (defcustom riece-server (getenv "IRCSERVER")
165   "IRC server host we are connecting to."
166   :type 'string
167   :group 'riece-server)
168
169 (defcustom riece-default-password (getenv "IRCPASSWORD")
170   "Your password."
171   :type '(radio (string :tag "Password")
172                 (const :tag "No" nil))
173   :group 'riece-server)
174
175 (defcustom riece-username (or (getenv "IRCNAME")
176                               (user-real-login-name))
177   "Your user name."
178   :type 'string
179   :group 'riece-server)
180
181 (defcustom riece-nickname (or (getenv "IRCNICK")
182                               (user-real-login-name))
183   "Your nickname."
184   :type 'string
185   :group 'riece-server)
186
187 (defcustom riece-startup-channel-list nil
188   "A list of channels to join automatically at startup."
189   :type '(repeat (choice (string :tag "Channel")
190                          (list (string :tag "Channel") (string :tag "Key"))))
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-quit-timeout 10
199   "Quit timeout when there is no response from server."
200   :type 'integer
201   :group 'riece-server)
202
203 (defcustom riece-channel-buffer-mode t
204   "When non-nil, Riece will display a channel buffer."
205   :type 'boolean
206   :group 'riece-looks)
207
208 (defcustom riece-user-list-buffer-mode t
209   "When non-nil, Riece will display a nick list buffer."
210   :type 'boolean
211   :group 'riece-looks)
212
213 (defcustom riece-channel-list-buffer-mode t
214   "When non-nil, Riece will display a channel list buffer."
215   :type 'boolean
216   :group 'riece-looks)
217
218 (defcustom riece-default-freeze nil
219   "Channel buffer local 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 quit message."
236   :type '(radio (string :tag "Quit message"))
237   :group 'riece-options)
238
239 (defcustom riece-away-message nil
240   "Default away message."
241   :type '(radio (string :tag "Away message"))
242   :group 'riece-options)
243
244 (defcustom riece-gather-channel-modes t
245   "If non-nil, gather channel modes when we join a channel."
246   :type 'boolean
247   :group 'riece-options)
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