Initial Commit
[packages] / xemacs-packages / ilisp / ilisp-def.el
1 ;;; -*- Mode: Emacs-Lisp -*-
2
3 ;;; ilisp-def.el --
4 ;;; ILISP defvar's
5 ;;;
6 ;;; This file is part of ILISP.
7 ;;; Please refer to the file COPYING for copyrights and licensing
8 ;;; information.
9 ;;; Please refer to the file ACKNOWLEGDEMENTS for an (incomplete) list
10 ;;; of present and past contributors.
11 ;;;
12 ;;; $Id: ilisp-def.el,v 1.5 2002-06-03 23:37:00 wbd Exp $
13
14 ;;;%Variables
15 ;;;%%Deflocal
16 (defvar ilisp-locals '(comint-prompt-regexp 
17                        input-ring-size
18                        comint-get-old-input
19                        comint-input-sentinel
20                        comint-input-filter
21                        comint-input-sender
22                        comint-eol-on-send
23                        comint-send-newline
24                        comint-always-scroll
25                        comint-fix-error
26                        comint-continue
27                        comint-interrupt-regexp
28                        comint-error-regexp
29                        comint-output-filter
30                        comint-interrupt-start
31                        comint-handler
32                        comint-update-status
33                        comint-prompt-status
34                        comint-abort-hook
35                        comint-use-prompt-regexp-instead-of-fields)
36   "List of ilisp local variables.")
37
38 (defun lisp-deflocal (local)
39   (unless (memq local ilisp-locals)
40     (setq ilisp-locals (cons local ilisp-locals))))
41
42
43 ;;;
44 (defmacro deflocal (variable default &optional documentation)
45   "Define an ilisp local variable."
46   (` (progn (lisp-deflocal '(, variable))
47             (defvar (, variable) (, default) (, documentation)))))
48
49 ;;;%%Simple customization
50
51 (defcustom ilisp-*prefix*
52   (if (and (boundp 'ilisp-*use-fsf-compliant-keybindings*)
53            ilisp-*use-fsf-compliant-keybindings*)
54       "\C-c"
55       "\C-z")
56   "Prefix sequence for ilisp commands.")
57
58
59 (deflocal ilisp-program nil
60   "*Program and arguments for invoking an inferior LISP.
61 The program can be an rsh to run on a remote machine.  If there is not
62 a common file system, the interface files will be sent down the pipe
63 instead.  The value of this variable is set from DIALECT-program, or
64 inherited from a less specific dialect if DIALECT-program is nil.")
65
66 (defvar ilisp-motd 
67   "ILISP V%s  Use M-x ilisp-bug for problems and suggestions."
68   "*Message of the day format string for ILISP given VERSION. To
69 prevent any message from being printed, set this to nil.")
70
71 (defvar lisp-wait-p nil
72   "*T if LISP eval/compile commands should wait for the result.
73 A minus prefix to the command will change the sense of this switch
74 for just the next command.")
75
76 (defvar lisp-no-popper 'message
77   "*T if all output goes to the inferior LISP rather than in a pop-up window.
78 '(quote message) if you want output of one line to go to the echo area
79 (usually the Minibuffer) or to a pop-up window if more.  You should
80 probably also set comint-always-scroll to T as well so that output is
81 always visible.")
82
83 (defvar ilisp-*use-frame-for-output* t
84   "*If T, ILISP uses a frame for its output, rather than a pop-up window.
85 The output going to the frame is usually multiline.  Single line
86 output usually goes to the echo area in the minibuffer. If no window
87 system is running then the value of this variable is ininfluent.")
88
89 (defcustom ilisp-*use-fsf-compliant-keybindings* nil
90   "*If non-nil,  ILISP will use FSF Emacs compliant keybindings.
91
92 In brief, this means all ilisp-specific features will be bound to C-c
93 KEY, where KEY is a control character, a digit, or one of }, {, >, <,
94 :, or ;.  In some cases ilisp may rebind a regular Emacs key, if the
95 new binding does \"the same thing\" as the original binding but in a
96 way more appropriate for ilisp."
97   :type     'boolean
98   :version  "20.5"
99   :group    'ILisp-interaction
100   ;; note: custom-ilisp.el is not loaded yet, so I'm just getting
101   ;; ready for the future by specifying a group above.
102   )
103
104 (defvar lisp-show-status t 
105   "*Set to nil to stop showing process status in lisp-mode buffers.")
106
107 (defvar ilisp-*prefix-match* nil
108   "*If T, when completing through the inferior LISP matches only as a prefix.
109 This will speed up completion, but you no longer get partial
110 completion.")
111
112 (deflocal ilisp-filter-regexp nil
113   "*What not to save on an inferior LISP's input history.
114 Input matching this regexp is not saved on the input history in ilisp
115 mode.")
116
117 (deflocal ilisp-filter-length 3
118   "*Do not save strings less than this in the command history.")
119
120 (deflocal ilisp-other-prompt nil
121   "*Regexp to recognise \"other\" prompts in the inferior LISP.
122 These 'prompts' are those of non-(read/eval/print) top-levels that
123 bol-ilisp skips them.")
124
125 (deflocal ilisp-raw-echo nil
126   "*Set this to T to cause echoing in raw keyboard mode.")
127
128 (deflocal ilisp-load-no-compile-query nil
129   "*Set this to T to stop load querying about compile.")
130
131 ;;;%%%Hooks
132 (defvar ilisp-site-hook nil
133   "Hook for site customization of ilisp mode when it is loaded.")
134
135 (defvar ilisp-load-hook '()
136   "Hook for customizing ilisp mode when it is loaded.")
137
138 (defvar ilisp-mode-hook '()
139   "Hook for customizing ilisp mode.")
140
141 (defvar ilisp-init-hook nil
142   "Hook of functions to call on first prompt in inferior LISP.")
143
144 (deflocal ilisp-init-hook-local nil
145   "Local Hook of functions to call on first prompt in inferior LISP.")
146
147 ;;;%%Advanced customization
148 ;;;%%%Commands
149 (deflocal ilisp-reset nil
150   "String for resetting the top-level of the inferior LISP.")
151
152 (deflocal ilisp-load-or-send-command nil
153   "Format string for loading BINARY if possible otherwise loading FILE.
154 If you can't load either, return NIL.")
155
156 (deflocal ilisp-hash-form-regexp nil
157   "Regular expression for finding a package specification in a buffer.
158 The entire sexp starting with this pattern will be passed to
159 ilisp-package-command to find the package.")
160
161 (deflocal ilisp-in-package-command-string nil
162   "Regular expression for finding a command that makes some package active.")
163
164 (deflocal ilisp-defpackage-command-string nil
165   "Regular expression for finding a command that defines a package.")
166
167 (deflocal ilisp-package-separator-regexp nil
168   "Regular expression that matches the package separator.")
169
170 (deflocal ilisp-package-command nil
171   "Format string to find the package given PACKAGE.")
172
173 (deflocal ilisp-package-name-command nil
174   "Format string to return the name of the current package.")
175
176 (deflocal ilisp-in-package-command nil
177   "Format string to set the package given PACKAGE.")
178
179 (deflocal ilisp-last-command nil
180   "Format string for getting the last returned value.")
181
182 (deflocal ilisp-save-command nil
183   "Format string for saving result history given FORM.")
184
185 (deflocal ilisp-restore-command nil
186   "Format string for restoring result history.")
187
188 (deflocal ilisp-block-command nil
189   "Format string for grouping FORMS into one.")
190
191 (deflocal ilisp-no-package-in-core-regexp nil
192   "Regexp that matches to ilisp-package-block-command's result in a
193 case when the package was not found in core.  Remember to set
194 `ilisp-fallback-package' too.")
195
196 (deflocal ilisp-fallback-package nil
197   "Package name to be used when the buffer's real package cannot be found
198 from the core.")
199
200 (deflocal ilisp-eval-command nil
201   "Format string for evaluating FORM in PACKAGE from FILE at LINE.")
202
203 (deflocal ilisp-defvar-regexp nil
204   "Regular expression for identifying a defvar form.")
205
206 (deflocal ilisp-defvar-command nil
207   "Format string for re-evaluating DEFVAR in PACKAGE from FILE at LINE.")
208
209 (deflocal ilisp-describe-command nil
210   "Format string for describing FORM in PACKAGE.")
211
212 (deflocal ilisp-compile-command nil
213   "Format string for compiling FORM in PACKAGE.")
214
215 (deflocal ilisp-inspect-command nil
216   "Format string for inspecting FORM in PACKAGE.")
217
218 (deflocal ilisp-arglist-command nil
219   "Format string for arglist of SYMBOL in PACKAGE.")
220
221 (deflocal ilisp-documentation-types nil
222   "((\"type\") ...) possible LISP documentation types.")
223
224 (deflocal ilisp-documentation-command nil
225   "Format string for documentation given SYMBOL in PACKAGE and TYPE.")
226
227 (deflocal ilisp-macroexpand-1-command nil
228   "Format string for top-level macroexpand given FORM and PACKAGE.")
229
230 (deflocal ilisp-macroexpand-command  nil
231   "Format string for macroexpand given FORM and PACKAGE.")
232
233 (deflocal ilisp-complete-command nil
234   "Format string for finding possibly matching symbols.
235 Given SYMBOL, PACKAGE, FUNCTIONP, EXTERNALP and PARTIAL-MATCHP, it
236 should print '((string) (string) ...)'.")
237
238 (deflocal ilisp-callers-command nil
239   "Format for finding the callers of SYMBOL in PACKAGE.
240 The function should print out callers with one per line.")
241
242 (deflocal ilisp-trace-command nil
243   "Format for tracing SYMBOL in PACKAGE.")
244 (deflocal ilisp-untrace-command nil
245   "Format for untracing SYMBOL in PACKAGE.")
246
247 (deflocal ilisp-directory-command nil
248   "Format for getting default DIRECTORY.")
249 (deflocal ilisp-set-directory-command nil
250   "Format for setting default DIRECTORY.")
251
252 (deflocal ilisp-binary-command nil
253   "Command to return the extension for binary files.")
254
255 (deflocal ilisp-binary-extension nil
256   "*The extension to use for LISP binaries.
257 If there is an ilisp-binary-command, this string will be determined at
258 initialization time.")
259
260 (deflocal ilisp-init-binary-command nil
261   "Command to return the extension for initialization binary files.")
262
263 (deflocal ilisp-init-binary-extension nil
264   "The extension for initialization binary files.
265 If there is an ilisp-init-binary-command, this string will be
266 determined at initialization time.")
267
268 (deflocal ilisp-load-command nil
269   "Format string for loading a file in LISP given FILE.")
270
271 (deflocal ilisp-compile-file-command nil
272   "Format string for compiling a file in LISP given FILE and EXTENSION.")
273
274 (deflocal ilisp-print-info-message-command nil
275   "Format string for printing argument list information etc. given a STRING.")
276
277 ;;;%%%%Source
278 (deflocal ilisp-source-types nil
279   "Alist of strings for source types.
280 The strings can be either symbols or list expressions since the input
281 accepts symbols or open ended lists as type specifiers.")
282
283 (deflocal ilisp-find-source-command nil
284   "Format string for finding the source file that defined SYMBOL in PACKAGE.
285 It should return NIL if no source is found.")
286
287 (deflocal ilisp-locator nil
288   "Function that finds the next SYMBOL TYPE definition in the current buffer.
289 The complete argument list is \(SYMBOL TYPE FIRST-P BACK-P): FIRST-P
290 is T the first time it is called in a buffer.  BACK-P is T to move
291 backwards.")
292
293 (deflocal ilisp-calls-locator nil
294   "Function  that finds calls to SYMBOL in the current buffer.
295 The complete argument list is \(SYMBOL TYPE FIRST-P BACK-P )FIRST-P is
296 T the first time it is called in a buffer.  BACK-P is T to move
297 backwards.")
298
299 (deflocal ilisp-source-directory-fixup-alist
300     nil
301   "*Alist of matchers to be used in conjuction with 'edit-definition-alist'.
302 The elements of the alist have the form (REGEXP . FIXUP-FUNCTION)
303 which will be applied to lists of source filenames to be used with
304 'edit-definitions-list'.  FIXUP-FUNCTION takes no arguments and should
305 use replace-match to fix the filenames.")
306
307
308 ;;;%%%Misc
309 (deflocal ilisp-use-map nil "Keymap to use in ILISP mode.")
310
311 (defvar ilisp-bugs-to "ilisp@cons.org" "Who to send bug reports to.")
312
313 (defvar ilisp-modes '(ilisp-mode) "List of all inferior ilisp modes.")
314
315 (defvar lisp-source-modes '(lisp-mode scheme-mode)
316   "Used to determine if a buffer contains Lisp source code.
317 If it's loaded into a buffer that is in one of these major modes, it's
318 considered a lisp source file by find-file-lisp, load-file-lisp and
319 compile-file-lisp. Used by these commands to determine defaults.")
320
321 (deflocal ilisp-no-newline nil
322   "Set to T to stop ilisp from inserting a newline after a command.")
323
324 (deflocal ilisp-error-filter nil "Function to filter error output.")
325
326 (deflocal ilisp-error-regexp nil "Regular expression to match error.")
327
328 (deflocal ilisp-symbol-delimiters nil
329   "Delimiters found around symbols.")
330
331 ;;;%%Program
332 (defvar ilisp-completion-map nil "Keymap for reading ilisp readers.")
333
334 (defvar ilisp-epoch-running (and (boundp 'epoch::version) epoch::version)
335   "Non-nil if epoch is running.")
336
337 (defvar ilisp-*version*
338   "5.12.0" ;; ILISP-VERSION marker
339   "ILISP version.")
340
341 (defvar ilisp-*directory* nil "The directory that ilisp is found in.")
342
343 (defvar ilisp-mode-map nil "Key map for ILISP.")
344
345 (defvar ilisp-raw-map  nil
346   "Keyboard map for sending characters directly to the inferior LISP.")
347
348 (defvar ilisp-raw-message "Raw keyboard mode until C-g"
349   "Message for how to stop raw mode.")
350
351 (defvar ilisp-buffer nil "Name of selected ilisp buffer.")
352
353 (defvar ilisp-status nil "Status string for selected ilisp buffer.")
354
355 (defvar ilisp-buffers nil "List of ILISP buffers.")
356
357 (defvar ilisp-dialects nil "List of ILISP dialects.")
358
359 (deflocal ilisp-load-inits nil
360   "Alist of dialect files to load when initializing an inferior LISP.
361 By default the file will be loaded from the ilisp-directory.")
362
363 ;;; This is useful to have a clause in ilisp code like:
364 ;;; (if (memq 'allegro (ilisp-value 'ilisp-dialect)) 
365 ;;;     allegro-code
366 ;;;     normal-code)
367 (deflocal ilisp-dialect nil
368   "List of the dialects that defined the current inferior LISP.")
369
370 (defvar ilisp-initialized nil
371   "List of buffer names that have been initialized.")
372
373 (deflocal ilisp-initializing nil
374   "Set to T while waiting for inferior LISP to get initialized.")
375
376 (deflocal ilisp-load-files nil "List of files being loaded.")
377
378 (defvar lisp-changes nil
379   "List of markers for changed forms.")
380
381 (deflocal ilisp-pending-changes nil
382   "List of changes that are pending, but have not been confirmed yet.")
383
384 ;;;%%%Completion
385 ;;; Dynamically bound variables for controlling reading
386
387 (defvar ilisp-complete nil "T if in minibuffer completion mode.")
388
389 (defvar ilisp-no-complete nil "T if incomplete symbols are allowed.")
390
391 (defvar ilisp-table nil "Completion table for ilisp readers.")
392
393 (defvar ilisp-paren nil "T if paren is allowed in ilisp readers.")
394
395 (defvar ilisp-completion-package nil 
396   "Package of buffer requesting completion.")
397
398 (defvar ilisp-completion-function-p nil
399   "T if only symbols with function values are allowed.")
400
401 ;;; State variables for ilisp reading
402
403 (defvar ilisp-mini-prefix nil "Package and qualification from minibuffer.")
404
405 (defvar ilisp-original nil "Original string for ilisp completion.")
406
407 (defvar ilisp-original-function-p nil "Function-p for ilisp completion.")
408
409 (defvar ilisp-original-table nil "Completion table for ilisp-original.")
410
411 ;;;%Buffer
412 ;;;%Packages
413
414 (defvar buffer-package 'not-yet-computed "Cached package name.")
415
416 (defvar buffer-mode-name nil "Original mode name.")
417
418 (defvar lisp-buffer-package nil "T if in lisp-buffer-package.")
419
420 (defvar lisp-dont-cache-package nil 
421   "If Non-Nil then refind the most recent in-package each time.")
422
423 ;;;%Globals from ilisp-ext.el
424 ;;;
425
426 (defvar ilisp-ext-load-hook nil "Hook to run when extensions are loaded.")
427
428 (defvar left-delimiter "\(" "*Left delimiter for find-unbalanced.")
429
430 (defvar right-delimiter "\)" "*Right delimiter for find-unbalanced.")
431
432 ;;; Copies of ilisp var definitions
433
434 (defvar ilisp-complete nil "T when ilisp is in completion mode.")
435
436 (defvar ilisp-modes '(ilisp-mode) "List of all inferior ilisp modes.")
437
438 (defvar lisp-fill-marker (make-marker)
439   "Keeps track of point so that it does not move during a reindent-lisp.")
440
441 (defvar ilisp-comment-marker (make-marker)
442   "Marker for end of a comment region.")
443
444
445 (defvar lisp-buffer-file nil 
446   "Cons of buffer-file-name and the expanded name.")
447
448 (make-variable-buffer-local 'lisp-buffer-file)
449
450 (defvar ilisp-last-message nil)
451
452 (defvar ilisp-last-prompt nil)
453
454 (defvar lisp-prev-l/c-dir/file nil
455   "Saves the (directory . file) pair used in the last file handling command.
456 A \"file handling command\" may be 'find-file-lisp', 'load-file-lisp'
457 or 'compile-file-lisp' command. Used for determining the default in
458 the next one.")
459
460 (defvar ilisp-last-buffer nil
461   "The last used LISP buffer.")
462
463
464 ;;; ilisp-bindings-*bind-right-bracket-p*
465
466 (defcustom ilisp-bindings-*bind-right-bracket-p*
467   nil
468   "If non-nil the key ']' will be bound to #'close-all-lisp."
469   :group 'ILisp-interaction)
470
471 ;;; ilisp-bindings-*bind-space-p*
472 (defcustom ilisp-bindings-*bind-space-p*
473   t
474   "If non-nil the 'SPACE' key will be bound to #'ilisp-arglist-message-lisp-space."
475   :group 'ILisp-interaction)
476
477 ;;; ilisp-arglist-message-space-lisp --
478 ;;;
479 ;; 19990806 Martin Atzmueller
480
481 (defvar ilisp-*arglist-message-lisp-space-p* t
482   "If T display the arglist or value of a function/symbol after a #\\Space.
483 Set to 'all if you want the arglist or value of a function/symbol
484 to be printed.")
485
486 (defvar ilisp-*arglist-message-switch-back-p* nil
487   "If T, the edited buffer is selected after the arglist has been displayed.")
488
489 (defvar ilisp-*use-frame-for-arglist-output-p* t
490   "If T, ILISP uses a distinct frame for its arglist output.
491 Otherwise ILISP uses the default 'lisp-display-ouput'.
492 The output going to the frame is usually multiline. If no window
493 system is running then the value of this variable is ininfluent.
494 Default is T.
495
496 Note: this can be set once before startup. Changing this after startup
497 will not have any effect! This effectively means, that this variable
498 must be set here. It relies on ilisp-*use-frame-for-output*, too.
499 Only if both are t the output will be sent to a frame.")
500
501 (defvar ilisp-*enable-ilisp-special-frame-p* nil
502   "If T, the ILISP inferior lisp buffer-name will be in
503 special-display-buffer-names; therefore the lisp-interaction buffer
504 will be in a 'special' seperate frame.")
505
506 (defvar ilisp-*enable-imenu-p* t
507   "Enables/disables loading/use of IMENU.
508 It  provides for a index of all functions in a file. Default is T.")
509
510
511 ;;; ilisp-enable-easy-menu-p --
512 ;;;
513 ;; 19990806 Martin Atzmueller
514
515 (defvar ilisp-*enable-cl-easy-menu-p* t
516   "Set to t if you want the new (and better!) menu for ILISP CL.")
517
518 (defvar ilisp-*enable-scheme-easy-menu-p* nil
519   "Set to t if you want the new (and better!) menu for ILISP Scheme.")
520
521
522 ;;; ilisp-*enable-ild-support-p*
523 ;;; 19990818 Marco Antoniotti
524
525 (defvar ilisp-*enable-ild-support-p* t
526   "Enables/disables loading of ILD package by J. M. Siskind.
527 Default is T.")
528
529
530 ;;; ilisp-*use-hyperspec-interface-p*
531 ;;; 19990820 Marco Antoniotti
532
533 (defvar ilisp-*use-hyperspec-interface-p* t
534   "Enables/disables loading of the 'hyperspec' module provided with ILISP.
535 Default is T.")
536
537 (defvar ilisp-*use-fi-clman-interface-p* nil
538   "Enables/disables use of Franz Inc's 'fi:clman' module.
539 Default is NIL.")
540
541 (defvar ilisp-*use-cltl2-interface-p* t
542   "Enables/disables loading of the CLtL2 lookup module provided with ILISP.
543 Default is T.")
544
545 ;;; end of file -- ilisp-def.lisp --