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