-
Notifications
You must be signed in to change notification settings - Fork 0
/
specials.lisp
397 lines (357 loc) · 16.3 KB
/
specials.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: LW-ADD-ONS; Base: 10 -*-
;;; $Header: /usr/local/cvsrep/lw-add-ons/specials.lisp,v 1.41 2015/03/06 12:54:25 edi Exp $
;;; Copyright (c) 2005-2015, Dr. Edmund Weitz. All rights reserved.
;;; Redistribution and use in source and binary forms, with or without
;;; modification, are permitted provided that the following conditions
;;; are met:
;;; * Redistributions of source code must retain the above copyright
;;; notice, this list of conditions and the following disclaimer.
;;; * Redistributions in binary form must reproduce the above
;;; copyright notice, this list of conditions and the following
;;; disclaimer in the documentation and/or other materials
;;; provided with the distribution.
;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;; This code copied almost verbatim from SLIME, see
;;; <http://common-lisp.net/project/slime/>
(in-package :lw-add-ons)
(defvar *show-doc-string-when-showing-arglist* nil
"Whether the editor command `Insert Space and Show Arglist`
is supposed to show the documentation string as well.")
(defvar *max-completions-to-show* 14
"The maximum number of possible completions shown in the echo
area by \"Complete Symbol Without Dialog.\"")
(defvar *insert-right-parenthesis-if-no-args* t
"Whether \"Complete Symbol Without Dialog\" should insert a
right parenthesis if the function is known to have an empty
argument list.")
(defvar *mop-page* "c:/home/lisp/doc/mop/dictionary.html"
"A pathname specifier denoting the location of the dictionary
page from the `AMOP` `HTML` version. The page is available online at
<http://www.lisp.org/mop/dictionary.html>
**TODO:** A link above does not work anymore. We need to find another source.")
(defvar *completion-match-function* 'compound-prefix-match
"The function used by **\"Complete Symbol Without Dialog\"** to
check possible completions. Should be a designator for a
function of two arguments and return true iff the second argument
is a possible completion of the first one.")
(defvar *use-abbreviated-complete-symbol* t
"Whether **\"Indent And Complete Symbol\"** should call
**\"Abbreviated Complete Symbol\"** \(only available in LispWorks 5.1 or higher) instead
of **\"Complete Symbol Without Dialog\"**.")
(defvar *make-backup-filename-function* nil
"If the value of this variable is not NIL, then it should be a
designator for a function of one argument which accepts a pathname and
returns a pathname. LispWork's own EDITOR::MAKE-BACKUP-FILENAME
function will be replaced with this one in this case.")
(defvar *backup-directory*
#+(or :win32 :macosx)
(merge-pathnames "LW-ADD-ONS/Backups/"
(probe-file
(sys:get-folder-path #+:win32 :local-appdata
#+:macosx :my-appsupport
:create t)))
#+:linux #p"~/.lw-backups/"
"The directory where backups are stored if the value of
*MAKE-BACKUP-FILENAME-FUNCTION* denotes the function
'MAKE-BACKUP-FILENAME-USING-BACKUP-DIRECTORY. It is recommended that
you dont't use this directory for other purposes.")
(defvar *swank-loader-pathname* #p"c:/emacs/site-lisp/slime/swank-loader.lisp"
"A pathname specifier denoting the location of the
`swank-loader.lisp' file. Only needed if one wants to start the
Swank server from LW - see function START-SWANK-SERVER.")
(defvar *translate-asdf-systems* t
"Whether ASDF systems should be automatically converted to LispWorks
Common Defsystem systems.")
(defvar *max-info-length* 400
"The maximum length \(in characters) of a message shown by
SHOW-INFO \(unless FULL-LENGTH-P is true).")
(defvar *apropos-max-search-list-length* 20
"The maximal number of items in the CAPI:TEXT-INPUT-CHOICE in the
Apropos Dialog.")
(defvar *apropos-max-string-length* 50
"The maximum amount of characters to show when an object is printed
in the pull down menu of an Apropos Dialog.")
(defvar *apropos-print-length* 5
"*PRINT-LENGTH* is bound to this value while the Apropos Dialog
displays objects.")
(defvar *apropos-print-level* 5
"*PRINT-LEVEL* is bound to this value while the Apropos Dialog
displays objects.")
(defvar *product-registry-path* '("Software" "Edi Weitz" "LW-ADD-ONS")
"The product registry path used for storing and retrieving user
preferences.")
(defconstant +apropos-headline+ '("Symbol Name" "Package" "Fun" "Var" "Class" "Exp")
"The headline of the Apropos Dialog's result panel.")
(eval-when (:compile-toplevel :load-toplevel :execute)
(defvar *use-quicklisp-for-shortcut-l* t
"Whether listener shortcuts should prefer Quicklisp."))
(defvar *listener-shortcuts*
(load-time-value
(append
(list '("c" . "Compile ASDF System")
'("t" . "Test ASDF System")
'("p" . "Change Package")
'("i" . "Change Package")
'("cd" . "Change Directory")
'("pwd" . "Show Directory")
'("q" . "Quit")
'("s" . "Quit"))
#-:quicklisp
(list '("l" . "Load ASDF System"))
#+:quicklisp
(if *use-quicklisp-for-shortcut-l*
(list '("a" . "Load ASDF System") '("l" . "Quickload Library"))
(list '("l" . "Load ASDF System") '("ql" . "Quickload Library")))))
"An alist of commands that can be invoked with \"Invoke Listener
Shortcut\" or with comma at beginning of listener line, each one
preceded by a shortcut.")
(defvar *swank-started-p* nil
"Whether START-SWANK-SERVER has already been called.")
(defvar *doc-hash* (make-hash-table :test #'equalp)
"A hash table which maps entries \(mostly strings) for the
\"Meta Documentation\" command to URLs.")
(defvar *doc-hash-entries* nil
"The list of all keys of *DOC-HASH*.")
(defvar *hyperdoc-packages* nil
"Temporarily set to a list of all packages that have a symbol named
HYPERDOC-LOOKUP during execution of \"Meta Documentation\" command.")
(defvar *doc-entries* nil
"Temporarily set to a list of all candidates during completion in
\"Meta Documentation\" command.")
(defconstant +cl-user-package+ (load-time-value (find-package :cl-user))
"The CL-USER package.")
(defconstant +keyword-package+ (load-time-value (find-package :keyword))
"The KEYWORD package.")
(defvar *all-asdf-systems* nil
"Temporarily bound to a list of all ASDF system names while
prompting for a system name.")
(defvar *search-end* nil
"If this variable is bound to a true value then it should be a
pointer and EDITOR::FIND-PATTERN \(and EDITOR:I-FIND-PATTERN) won't
search beyond this point \(unless called with a non-NIL LIMIT
argument).")
(defvar *change-default-for-file-prompt* nil
"If this variable is bound to a a true value then the function
EDITOR:PROMPT-FOR-FILE will use the full file name \(as opposed
to the file's location) as its default string \(unless a default
string was explicitly specified or the DEFAULT argument is a
string).")
#+:editor-does-not-have-go-back
(defvar *find-definitions-stack* nil
"Stack of previous positions \(points) within the editor, used by
new \"Pop Definitions Stack\" command. See docs.")
(defvar *lw-add-ons-break-on-signals* nil
"The value *BREAK-ON-SIGNALS* is bound to in IGNORE-ERRORS*. Set
this to NIL to debug LW-ADD-ONS.")
(defvar *temp-files* nil
"A list of temporary files which should be deleted when the image
exits.")
(defvar *clhs-add-ons*
'(("~C: Character" "22_caa.htm")
("~%: Newline" "22_cab.htm")
("~&: Freshline" "22_cac.htm")
("~|: Page" "22_cad.htm")
("~~: Tilde" "22_cae.htm")
("~R: Radix" "22_cba.htm")
("~D: Decimal" "22_cbb.htm")
("~B: Binary" "22_cbc.htm")
("~O: Octal" "22_cbd.htm")
("~X: Hexadecimal" "22_cbe.htm")
("~F: Fixed-Format Floating-Point" "22_cca.htm")
("~E: Exponential Floating-Point" "22_ccb.htm")
("~G: General Floating-Point" "22_ccc.htm")
("~$: Monetary Floating-Point" "22_ccd.htm")
("~A: Aesthetic" "22_cda.htm")
("~S: Standard" "22_cdb.htm")
("~W: Write" "22_cdc.htm")
("~_: Conditional Newline" "22_cea.htm")
("~<: Logical Block" "22_ceb.htm")
("~I: Indent" "22_cec.htm")
("~/: Call Function" "22_ced.htm")
("~T: Tabulate" "22_cfa.htm")
("~<: Justification" "22_cfb.htm")
("~>: End of Justification" "22_cfc.htm")
("~*: Go-To" "22_cga.htm")
("~[: Conditional Expression" "22_cgb.htm")
("~]: End of Conditional Expression" "22_cgc.htm")
("~{: Iteration" "22_cgd.htm")
("~}: End of Iteration" "22_cge.htm")
("~?: Recursive Processing" "22_cgf.htm")
("~(: Case Conversion" "22_cha.htm")
("~): End of Case Conversion" "22_chb.htm")
("~P: Plural" "22_chc.htm")
("~;: Clause Separator" "22_cia.htm")
("~^: Escape Upward" "22_cib.htm")
("~NEWLINE: Ignored Newline" "22_cic.htm")
("\(" "02_da.htm")
(")" "02_db.htm")
("'" "02_dc.htm")
(";" "02_dd.htm")
("\"" "02_de.htm")
("`" "02_df.htm")
("," "02_dg.htm")
("#" "02_dh.htm")
("#\\" "02_dha.htm")
("#'" "02_dhb.htm")
("#\(" "02_dhc.htm")
("#*" "02_dhd.htm")
("#:" "02_dhe.htm")
("#." "02_dhf.htm")
("#b" "02_dhg.htm")
("#o" "02_dhh.htm")
("#x" "02_dhi.htm")
("#r" "02_dhj.htm")
("#c" "02_dhk.htm")
("#a" "02_dhl.htm")
("#s" "02_dhm.htm")
("#p" "02_dhn.htm")
("#=" "02_dho.htm")
("##" "02_dhp.htm")
("#+" "02_dhq.htm")
("#-" "02_dhr.htm")
("#|" "02_dhs.htm")
("#<" "02_dht.htm")
("loop:with" "06_abb.htm")
("loop:for-as-..." "06_aba.htm")
("loop:for-as-arithmetic" "06_abaa.htm")
("loop:for-as-in-list" "06_abab.htm")
("loop:for-as-on-list" "06_abac.htm")
("loop:for-as-equals-then" "06_abad.htm")
("loop:for-as-across" "06_abae.htm")
("loop:for-as-hash" "06_abaf.htm")
("loop:for-as-package" "06_abag.htm")
("loop:collect" "06_ac.htm")
("loop:append" "06_ac.htm")
("loop:nconc" "06_ac.htm")
("loop:count" "06_ac.htm")
("loop:maximize" "06_ac.htm")
("loop:minimize" "06_ac.htm")
("loop:sum" "06_ac.htm")
("loop:repeat" "06_ad.htm")
("loop:always" "06_ad.htm")
("loop:never" "06_ad.htm")
("loop:thereis" "06_ad.htm")
("loop:while" "06_ad.htm")
("loop:until" "06_ad.htm")
("loop:do" "06_ae.htm")
("loop:return" "06_ae.htm")
("loop:if" "06_af.htm")
("loop:when" "06_af.htm")
("loop:unless" "06_af.htm")
("loop:else" "06_af.htm")
("loop:it" "06_af.htm")
("loop:end" "06_af.htm")
("loop:named" "06_aga.htm")
("loop:initially" "06_agb.htm")
("loop:finally" "06_agb.htm")
(":test" "17_ba.htm")
(":test-not" "17_ba.htm")
(":key" "17_bb.htm")
(":eof-error-p" "23_aca.htm")
(":recursive-p" "23_acb.htm"))
"A couple of additions to the `standard' CLHS entries that can
be found in the symbol-index.")
(defparameter *mop-links*
'(("add-dependent" "#add-dependent")
("add-direct-method" "#add-direct-method")
("add-direct-subclass" "#add-direct-subclass")
("add-method" "#add-method")
("allocate-instance" "#allocate-instance")
("class-... " "#class-")
("class-default-initargs" "#class-mo-readers")
("class-direct-default-initargs" "#class-mo-readers")
("class-direct-slots" "#class-mo-readers")
("class-direct-subclasses" "#class-mo-readers")
("class-direct-superclasses" "#class-mo-readers")
("class-finalized-p" "#class-mo-readers")
("class-name" "#class-mo-readers")
("class-precedence-list" "#class-mo-readers")
("class-prototype" "#class-mo-readers")
("class-slots" "#class-mo-readers")
("compute-applicable-methods" "#compute-applicable-methods")
("compute-applicable-methods-using-classes" "#compute-applicable-methods-using-classes")
("compute-class-precedence-list" "#compute-class-precedence-list")
("compute-default-initargs" "#compute-default-initargs")
("compute-discriminating-function" "#compute-discriminating-function")
("compute-effective-method" "#compute-effective-method")
("compute-effective-slot-definition" "#compute-effective-slot-definition")
("compute-slots" "#compute-slots")
("direct-slot-definition-class" "#direct-slot-definition-class")
("effective-slot-definition-class" "#effective-slot-definition-class")
("ensure-class" "#ensure-class")
("ensure-class-using-class" "#ensure-class-using-class")
("ensure-generic-function" "#ensure-generic-function")
("ensure-generic-function-using-class" "#ensure-generic-function-using-class")
("eql-specializer-object" "#eql-specializer-object")
("extract-lambda-list" "#extract-lambda-list")
("extract-specializer-names" "#extract-specializer-names")
("finalize-inheritance" "#finalize-inheritance")
("find-method-combination" "#find-method-combination")
("funcallable-standard-instance-access" "#funcallable-standard-instance-access")
("generic-function-..." "#generic-function-")
("generic-function-argument-precedence-order" "#gf-mo-readers")
("generic-function-declarations" "#gf-mo-readers")
("generic-function-lambda-list" "#gf-mo-readers")
("generic-function-method-class" "#gf-mo-readers")
("generic-function-method-combination" "#gf-mo-readers")
("generic-function-methods" "#gf-mo-readers")
("generic-function-name" "#gf-mo-readers")
("Initialization of Class Metaobjects" "#class-mo-init")
("Initialization of Generic Function Metaobjects" "#gf-mo-init")
("Initialization of Method Metaobjects" "#Initialization")
("Initialization of Slot Definition Metaobjects" "#Initialization")
("intern-eql-specializer" "#intern-eql-specializer")
("make-instance" "#make-instance")
("make-method-lambda" "#make-method-lambda")
("map-dependents" "#map-dependents")
("method-..." "#method-")
("method-function" "#method-mo-readers")
("method-generic-function" "#method-mo-readers")
("method-lambda-list" "#method-mo-readers")
("method-specializers" "#method-mo-readers")
("method-qualifiers" "#method-mo-readers")
("accessor-method-slot-definition" "#method-mo-readers")
("Readers for Class Metaobjects" "#class-mo-readers")
("Readers for Generic Function Metaobjects" "#gf-mo-readers")
("Readers for Method Metaobjects" "#method-mo-readers")
("Readers for Slot Definition Metaobjects" "#slotd-mo-readers")
("reader-method-class" "#reader-method-class")
("remove-dependent" "#remove-dependent")
("remove-direct-method" "#remove-direct-method")
("remove-direct-subclass" "#remove-direct-subclass")
("remove-method" "#remove-method")
("set-funcallable-instance-function" "#set-funcallable-instance-function")
("\(setf class-name)" "#\(setf class-name)")
("\(setf generic-function-name)" "#\(setf generic-function-name)")
("\(setf slot-value-using-class)" "#\(setf slot-value-using-class)")
("slot-boundp-using-class" "#slot-boundp-using-class")
("slot-definition-..." "#slot-definition-")
("slot-definition-allocation" "#slotd-mo-readers")
("slot-definition-initargs" "#slotd-mo-readers")
("slot-definition-initform" "#slotd-mo-readers")
("slot-definition-initfunction" "#slotd-mo-readers")
("slot-definition-location" "#slotd-mo-readers")
("slot-definition-name" "#slotd-mo-readers")
("slot-definition-readers" "#slotd-mo-readers")
("slot-definition-writers" "#slotd-mo-readers")
("slot-definition-type" "#slotd-mo-readers")
("slot-makunbound-using-class" "#slot-makunbound-using-class")
("slot-value-using-class" "#slot-value-using-class")
("specializer-direct-generic-functions" "#specializer-direct-generic-functions")
("specializer-direct-methods" "#specializer-direct-methods")
("standard-instance-access" "#standard-instance-access")
("update-dependent" "#update-dependent")
("validate-superclass" "#validate-superclass")
("writer-method-class" "#writer-method-class"))
"URL fragments for all relevant entries in the MOP dictionary
page.")