ba3ca54d0a954c80209fab8619de8ac8ec2dab08
[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-directory "~/.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 riece-ctcp riece-unread)
104   "Add-ons insinuated into Riece."
105   :type '(repeat symbol)
106   :group 'riece-options)
107
108 (defgroup riece-server nil
109   "Server settings"
110   :prefix "riece-"
111   :group 'riece)
112
113 (defgroup riece-channel nil
114   "Channel settings"
115   :prefix "riece-"
116   :group 'riece)
117
118 (define-widget 'riece-service-spec 'radio
119   "Edit service spec entries"
120   :convert-widget 'riece-service-spec-convert)
121
122 (defun riece-service-spec-convert (widget)
123   (widget-put widget :args '((integer :tag "Port Number")
124                              (string :tag "Name")))
125   widget)
126
127 (define-widget 'riece-server-spec 'repeat
128   "Edit server spec entries"
129   :match (lambda (widget value)
130            (eval `(and ,@(mapcar
131                           (lambda (entry)
132                             (or (stringp (cdr entry))
133                                 (listp (cdr entry))))
134                           value))))
135   :convert-widget 'riece-server-spec-convert)
136
137 (defun riece-server-spec-convert (widget)
138   (let* ((host '(const :format "" :value :host))
139          (service '(const :format "" :value :service))
140          (host
141           `(group :inline t ,host (string :tag "Host")))
142          (service
143           `(group :inline t ,service riece-service-spec))
144          (spec
145           `(cons (string :tag "Name")
146                  (radio (string :tag "Host")
147                         (list ,host ,service))))
148          (args (list spec)))
149     (widget-put widget :args args)
150     widget))
151   
152 (defcustom riece-server-alist nil
153   "An alist mapping server names to plist."
154   :type 'riece-server-spec
155   :group 'riece-server)
156
157 (defcustom riece-server (getenv "IRCSERVER")
158   "IRC server host we are connecting to."
159   :type 'string
160   :group 'riece-server)
161
162 (defcustom riece-default-password (getenv "IRCPASSWORD")
163   "Your password."
164   :type '(radio (string :tag "Password")
165                 (const :tag "No" nil))
166   :group 'riece-server)
167
168 (defcustom riece-username (or (getenv "IRCNAME")
169                               (user-real-login-name))
170   "Your user name."
171   :type 'string
172   :group 'riece-server)
173
174 (defcustom riece-nickname (or (getenv "IRCNICK")
175                               (user-real-login-name))
176   "Your nickname."
177   :type 'string
178   :group 'riece-server)
179
180 (defcustom riece-retry-with-new-nickname nil
181   "When nickname has already been in use, grow-tail automatically."
182   :type 'boolean
183   :group 'riece-server)
184
185 (defcustom riece-quit-timeout 10
186   "Quit timeout when there is no response from server."
187   :type 'integer
188   :group 'riece-server)
189
190 (defcustom riece-channel-buffer-mode t
191   "When non-nil, Riece will display a channel buffer."
192   :type 'boolean
193   :group 'riece-looks)
194
195 (defcustom riece-user-list-buffer-mode t
196   "When non-nil, Riece will display a nick list buffer."
197   :type 'boolean
198   :group 'riece-looks)
199
200 (defcustom riece-channel-list-buffer-mode t
201   "When non-nil, Riece will display a channel list buffer."
202   :type 'boolean
203   :group 'riece-looks)
204
205 (defcustom riece-default-freeze nil
206   "Channel buffer local freeze flag is on at starting."
207   :type 'boolean
208   :group 'riece-looks)
209
210 (defcustom riece-default-channel-binding nil
211   "The channel list to bind the channel number when joining."
212   :type '(repeat (radio (string :tag "Bound Channel")
213                         (const nil)))
214   :group 'riece-channel)
215
216 (defcustom riece-blink-parens nil
217   "Should we blink matching parenthesis in the command buffer?"
218   :type 'boolean
219   :group 'riece-options)
220
221 (defcustom riece-quit-message nil
222   "Default quit message."
223   :type '(radio (string :tag "Quit message"))
224   :group 'riece-options)
225
226 (defcustom riece-away-message nil
227   "Default away message."
228   :type '(radio (string :tag "Away message"))
229   :group 'riece-options)
230
231 (defcustom riece-gather-channel-modes t
232   "If non-nil, gather channel modes when we join a channel."
233   :type 'boolean
234   :group 'riece-options)
235
236 (defcustom riece-buffer-dispose-function #'bury-buffer
237   "Function called after the buffer was disposed."
238   :type 'function
239   :group 'riece-options)
240
241 (defcustom riece-format-time-function #'current-time-string
242   "Function to convert the specified time to the human readable form."
243   :type 'function
244   :group 'riece-options)
245
246 (defcustom riece-channel-history-length 3
247   "Length of riece-channel-history."
248   :type 'integer
249   :group 'riece-options)
250
251 (provide 'riece-options)
252
253 ;;; riece-options.el ends here