| | 1 | [[PageOutline]] |
| | 2 | |
| | 3 | = 18. Auxiliary Systems = |
| | 4 | |
| | 5 | This chapter describes utilities that some implementations |
| | 6 | of Hemlock may leave unprovided or unsupported. |
| | 7 | |
| | 8 | == 18.1. Key-events == |
| | 9 | |
| | 10 | These routines are defined in the "EXTENSIONS" package since other |
| | 11 | projects have often used Hemlock's input translations for interfacing |
| | 12 | to CLX. |
| | 13 | |
| | 14 | === 18.1.1. Introduction === |
| | 15 | |
| | 16 | The canonical representation of editor input is a key-event |
| | 17 | structure. Users can bind commands to keys (see section 1.3.1), which |
| | 18 | are non-zero length sequences of key-events. A key-event consists of |
| | 19 | an identifying token known as a keysym and a field of bits |
| | 20 | representing modifiers. Users define keysyms, integers between 0 and |
| | 21 | 65535 inclusively, by supplying names that reflect the legends on |
| | 22 | their keyboard's keys. Users define modifier names similarly, but the |
| | 23 | system chooses the bit and mask for recognizing the modifier. You can |
| | 24 | use keysym and modifier names to textually specify key-events and |
| | 25 | Hemlock keys in a #k syntax. The following are some examples: |
| | 26 | {{{ |
| | 27 | #k"C-u" |
| | 28 | #k"Control-u" |
| | 29 | #k"c-m-z" |
| | 30 | #k"control-x meta-d" |
| | 31 | #k"a" |
| | 32 | #k"A" |
| | 33 | #k"Linefeed" |
| | 34 | }}} |
| | 35 | |
| | 36 | This is convenient for use within code and in init files containing |
| | 37 | bind-key calls. |
| | 38 | |
| | 39 | The #k syntax is delimited by double quotes, but the system parses the |
| | 40 | contents rather than reading it as a Common Lisp string. Within the |
| | 41 | double quotes, spaces separate multiple key-events. A single key-event |
| | 42 | optionally starts with modifier names terminated by hyphens. Modifier |
| | 43 | names are alphabetic sequences of characters which the system uses |
| | 44 | case-insensitively. Following modifiers is a keysym name, which is |
| | 45 | case-insensitive if it consists of multiple characters, but if the |
| | 46 | name consists of only a single character, then it is case-sensitive. |
| | 47 | |
| | 48 | You can escape special characters---hyphen, double quote, open angle |
| | 49 | bracket, close angle bracket, and space---with a backslash, and you |
| | 50 | can specify a backslash by using two contiguously. You can use angle |
| | 51 | brackets to enclose a keysym name with many special characters in |
| | 52 | it. Between angle brackets appearing in a keysym name position, there |
| | 53 | are only two special characters, the closing angle bracket and |
| | 54 | backslash. |
| | 55 | |
| | 56 | === 18.1.2. Interface === |
| | 57 | |
| | 58 | All of the following routines and variables are exported from the |
| | 59 | "EXTENSIONS" ("EXT") package. |
| | 60 | |
| | 61 | define-keysym keysym preferred-name &rest other-names [Function] |
| | 62 | |
| | 63 | This function establishes a mapping from preferred-name to keysym for |
| | 64 | purposes of #k syntax. Other-names also map to keysym, but the system |
| | 65 | uses preferred-name when printing key-events. The names are |
| | 66 | case-insensitive simple-strings; however, if the string contains a |
| | 67 | single character, then it is used case-sensitively. Redefining a |
| | 68 | keysym or re-using names has undefined effects. |
| | 69 | |
| | 70 | You can use this to define unused keysyms, but primarily this defines |
| | 71 | keysyms defined in the X Window System Protocol, MIT X Consortium |
| | 72 | Standard, X Version 11, Release 4. translate-key-event uses this |
| | 73 | knowledge to determine what keysyms are modifier keysyms and what |
| | 74 | keysym stand for alphabetic key-events. |
| | 75 | |
| | 76 | |
| | 77 | |
| | 78 | define-mouse-keysym button keysym name shifted-bit event-key [Function] |
| | 79 | |
| | 80 | This function defines keysym named name for key-events representing |
| | 81 | the X button cross the X event-key (:button-press or |
| | 82 | :button-release). Shifted-bit is a defined modifier name that |
| | 83 | translate-mouse-key-event sets in the key-event it returns whenever |
| | 84 | the X shift bit is set in an incoming event. |
| | 85 | |
| | 86 | Note, by default, there are distinct keysyms for each button |
| | 87 | distinguishing whether the user pressed or released the button. |
| | 88 | |
| | 89 | Keysym should be an one unspecified in X Window System Protocol, MIT X |
| | 90 | Consortium Standard, X Version 11, Release 4. |
| | 91 | |
| | 92 | |
| | 93 | |
| | 94 | name-keysym name [Function] |
| | 95 | |
| | 96 | This function returns the keysym named name. If name is unknown, this |
| | 97 | returns nil. |
| | 98 | |
| | 99 | |
| | 100 | |
| | 101 | keysym-names keysym [Function] |
| | 102 | |
| | 103 | This function returns the list of all names for keysym. If keysym is |
| | 104 | undefined, this returns nil. |
| | 105 | |
| | 106 | |
| | 107 | |
| | 108 | keysym-preferred-name keysym [Function] |
| | 109 | |
| | 110 | This returns the preferred name for keysym, how it is typically |
| | 111 | printed. If keysym is undefined, this returns nil. |
| | 112 | |
| | 113 | |
| | 114 | |
| | 115 | define-key-event-modifier long-name short-name [Function] |
| | 116 | |
| | 117 | This establishes long-name and short-name as modifier names for |
| | 118 | purposes of specifying key-events in #k syntax. The names are |
| | 119 | case-insensitive simple-strings. If either name is already defined, |
| | 120 | this signals an error. |
| | 121 | |
| | 122 | The system defines the following default modifiers (first the long |
| | 123 | name, then the short name): |
| | 124 | |
| | 125 | * "Hyper", "H" |
| | 126 | * "Super", "S" |
| | 127 | * "Meta", "M" |
| | 128 | * "Control", "C" |
| | 129 | * "Shift", "Shift" |
| | 130 | * "Lock", "Lock" |
| | 131 | |
| | 132 | |
| | 133 | all-modifier-names [Variable] |
| | 134 | |
| | 135 | This variable holds all the defined modifier names. |
| | 136 | |
| | 137 | |
| | 138 | |
| | 139 | define-clx-modifier clx-mask modifier-name [Function] |
| | 140 | |
| | 141 | This function establishes a mapping from clx-mask to a defined |
| | 142 | key-event modifier-name. translate-key-event and |
| | 143 | translate-mouse-key-event can only return key-events with bits defined |
| | 144 | by this routine. |
| | 145 | |
| | 146 | The system defines the following default mappings between CLX |
| | 147 | modifiers and key-event modifiers: |
| | 148 | |
| | 149 | * (xlib:make-state-mask :mod-1) --> "Meta" |
| | 150 | * (xlib:make-state-mask :control) --> "Control" |
| | 151 | * (xlib:make-state-mask :lock) --> "Lock" |
| | 152 | * (xlib:make-state-mask :shift) --> "Shift" |
| | 153 | |
| | 154 | |
| | 155 | make-key-event-bits &rest modifier-names [Function] |
| | 156 | |
| | 157 | This function returns bits suitable for make-key-event from the |
| | 158 | supplied modifier-names. If any name is undefined, this signals an |
| | 159 | error. |
| | 160 | |
| | 161 | |
| | 162 | |
| | 163 | key-event-modifier-mask modifier-name [Function] |
| | 164 | |
| | 165 | This function returns a mask for modifier-name. This mask is suitable |
| | 166 | for use with key-event-bits. If modifier-name is undefined, this |
| | 167 | signals an error. |
| | 168 | |
| | 169 | |
| | 170 | |
| | 171 | key-event-bits-modifiers bits [Function] |
| | 172 | |
| | 173 | This returns a list of key-event modifier names, one for each modifier |
| | 174 | set in bits. |
| | 175 | |
| | 176 | |
| | 177 | |
| | 178 | translate-key-event display scan-code bits [Function] |
| | 179 | |
| | 180 | This function translates the X scan-code and X bits to a |
| | 181 | key-event. First this maps scan-code to an X keysym using |
| | 182 | xlib:keycode->keysym looking at bits and supplying index as 1 if the X |
| | 183 | shift bit is on, 0 otherwise. |
| | 184 | |
| | 185 | If the resulting keysym is undefined, and it is not a modifier keysym, |
| | 186 | then this signals an error. If the keysym is a modifier key, then this |
| | 187 | returns nil. |
| | 188 | |
| | 189 | If these conditions are satisfied |
| | 190 | |
| | 191 | * The keysym is defined. |
| | 192 | * The X shift bit is off. |
| | 193 | * The X lock bit is on. |
| | 194 | * The X keysym represents a lowercase letter. |
| | 195 | |
| | 196 | then this maps the scan-code again supplying index as 1 this time, |
| | 197 | treating the X lock bit as a caps-lock bit. If this results in an |
| | 198 | undefined keysym, this signals an error. Otherwise, this makes a |
| | 199 | key-event with the keysym and bits formed by mapping the X bits to |
| | 200 | key-event bits. |
| | 201 | |
| | 202 | Otherwise, this makes a key-event with the keysym and bits formed by |
| | 203 | mapping the X bits to key-event bits. |
| | 204 | |
| | 205 | |
| | 206 | |
| | 207 | translate-mouse-key-event scan-code bits event-key [Function] |
| | 208 | |
| | 209 | This function translates the X button code, scan-code, and modifier |
| | 210 | bits, bits, for the X event-key into a key-event. See |
| | 211 | define-mouse-keysym. |
| | 212 | |
| | 213 | |
| | 214 | |
| | 215 | make-key-event object bits [Function] |
| | 216 | |
| | 217 | This function returns a key-event described by object with |
| | 218 | bits. Object is one of keysym, string, or key-event. When object is a |
| | 219 | key-event, this uses key-event-keysym. You can form bits with |
| | 220 | make-key-event-bits or key-event-modifier-mask. |
| | 221 | |
| | 222 | |
| | 223 | |
| | 224 | key-event-p object [Function] |
| | 225 | |
| | 226 | This function returns whether object is a key-event. |
| | 227 | |
| | 228 | |
| | 229 | |
| | 230 | key-event-bits key-event [Function] |
| | 231 | |
| | 232 | This function returns the bits field of a key-event. |
| | 233 | |
| | 234 | |
| | 235 | |
| | 236 | key-event-keysym key-event [Function] |
| | 237 | |
| | 238 | This function returns the keysym field of a key-event. |
| | 239 | |
| | 240 | |
| | 241 | |
| | 242 | char-key-event character [Function] |
| | 243 | |
| | 244 | This function returns the key-event associated with character. You can |
| | 245 | associate a key-event with a character by setf-ing this form. |
| | 246 | |
| | 247 | |
| | 248 | |
| | 249 | key-event-char key-event [Function] |
| | 250 | |
| | 251 | This function returns the character associated with key-event. You can |
| | 252 | associate a character with a key-event by setf'ing this form. The |
| | 253 | system defaultly translates key-events in some implementation |
| | 254 | dependent way for text insertion; for example, under an ASCII system, |
| | 255 | the key-event #k"C-h", as well as #k"backspace" would map to the |
| | 256 | Common Lisp character that causes a backspace. |
| | 257 | |
| | 258 | |
| | 259 | |
| | 260 | key-event-bit-p key-event bit-name [Function] |
| | 261 | |
| | 262 | This function returns whether key-event has the bit set named by |
| | 263 | bit-name. This signals an error if bit-name is undefined. |
| | 264 | |
| | 265 | |
| | 266 | |
| | 267 | do-alpha-key-events (var kind &optional result) form [Macro] |
| | 268 | |
| | 269 | This macro evaluates each form with var bound to a key-event |
| | 270 | representing an alphabetic character. Kind is one of :lower, :upper, |
| | 271 | or :both, and this binds var to each key-event in order as specified |
| | 272 | in X Window System Protocol, MIT X Consortium Standard, X Version 11, |
| | 273 | Release 4. When :both is specified, this processes lowercase letters |
| | 274 | first. |
| | 275 | |
| | 276 | |
| | 277 | |
| | 278 | print-pretty-key key &optional stream long-names-p [Function] |
| | 279 | |
| | 280 | This prints key, a key-event or vector of key-events, in a |
| | 281 | user-expected fashion to stream. Long-names-p indicates whether |
| | 282 | modifiers should print with their long or short name. Stream defaults |
| | 283 | to standard-output. |
| | 284 | |
| | 285 | |
| | 286 | |
| | 287 | print-pretty-key-event key-event &optional stream long-names-p [Function] |
| | 288 | |
| | 289 | This prints key-event to stream in a user-expected |
| | 290 | fashion. Long-names-p indicates whether modifier names should appear |
| | 291 | using the long name or short name. Stream defaults to standard-output. |
| | 292 | |
| | 293 | |
| | 294 | |
| | 295 | == 18.2. CLX Interface == |
| | 296 | |
| | 297 | === 18.2.1. Graphics Window Hooks === |
| | 298 | |
| | 299 | This section describes a few hooks used by Hemlock's internals to |
| | 300 | handle graphics windows that manifest Hemlock windows. Some heavy |
| | 301 | users of Hemlock as a tool have needed these in the past, but |
| | 302 | typically functions that replace the default values of these hooks |
| | 303 | must be written in the "HEMLOCK-INTERNALS" package. All of these |
| | 304 | symbols are internal to this package. |
| | 305 | |
| | 306 | If you need this level of control for your application, consult the |
| | 307 | current implementation for code fragments that will be useful in |
| | 308 | correctly writing your own window hook functions. |
| | 309 | |
| | 310 | create-window-hook [Variable] |
| | 311 | |
| | 312 | This holds a function that Hemlock calls when make-window executes |
| | 313 | under CLX. Hemlock passes the CLX display and the following arguments |
| | 314 | from make-window: starting mark, ask-user, x, y, width, height, and |
| | 315 | modelinep. The function returns a CLX window or nil indicating one |
| | 316 | could not be made. |
| | 317 | |
| | 318 | |
| | 319 | |
| | 320 | delete-window-hook [Variable] |
| | 321 | |
| | 322 | This holds a function that Hemlock calls when delete-window executes |
| | 323 | under CLX. Hemlock passes the CLX window and the Hemlock window to |
| | 324 | this function. |
| | 325 | |
| | 326 | |
| | 327 | |
| | 328 | random-typeout-hook [Variable] |
| | 329 | |
| | 330 | This holds a function that Hemlock calls when random typeout occurs |
| | 331 | under CLX. Hemlock passes it a Hemlock device, a pre-existing CLX |
| | 332 | window or nil, and the number of pixels needed to display the number |
| | 333 | of lines requested in the with-pop-up-display form. It should return a |
| | 334 | window, and if a new window is created, then a CLX gcontext must be |
| | 335 | the second value. |
| | 336 | |
| | 337 | |
| | 338 | |
| | 339 | create-initial-windows-hook [Variable] |
| | 340 | |
| | 341 | This holds a function that Hemlock calls when it initializes the |
| | 342 | screen manager and makes the first windows, typically windows for the |
| | 343 | Main and Echo Area buffers. Hemlock passes the function a Hemlock |
| | 344 | device. |
| | 345 | |
| | 346 | |
| | 347 | |
| | 348 | === 18.2.2. Entering and Leaving Windows === |
| | 349 | |
| | 350 | Enter Window Hook (initial value ) [Variable] |
| | 351 | |
| | 352 | When the mouse enters an editor window, Hemlock invokes the functions |
| | 353 | in this hook. These functions take a Hemlock window as an argument. |
| | 354 | |
| | 355 | |
| | 356 | |
| | 357 | Exit Window Hook (initial value ) [Variable] |
| | 358 | |
| | 359 | When the mouse exits an editor window, Hemlock invokes the functions |
| | 360 | in this hook. These functions take a Hemlock window as an argument. |
| | 361 | |
| | 362 | |
| | 363 | |
| | 364 | === 18.2.3 How to Lose Up-Events === |
| | 365 | |
| | 366 | Often the only useful activity user's design for the mouse is to click |
| | 367 | on something. Hemlock sees a character representing the down event, |
| | 368 | but what do you do with the up event character that you know must |
| | 369 | follow? Having the command eat it would be tasteless, and would |
| | 370 | inhibit later customizations that make use of it, possibly adding on |
| | 371 | to the down click command's functionality. Bind the corresponding up |
| | 372 | character to the command described here. |
| | 373 | |
| | 374 | Do Nothing [Command] |
| | 375 | |
| | 376 | This does nothing as many times as you tell it. |
| | 377 | |
| | 378 | |
| | 379 | |
| | 380 | == 18.3 Slave Lisps == |
| | 381 | |
| | 382 | Some implementations of Hemlock feature the ability to manage multiple |
| | 383 | slave Lisps, each connected to one editor Lisp. The routines discussed |
| | 384 | here spawn slaves, send evaluation and compilation requests, return |
| | 385 | the current server, etc. This is very powerful because without it you |
| | 386 | can lose your editing state when code you are developing causes a |
| | 387 | fatal error in Lisp. |
| | 388 | |
| | 389 | The routines described in this section are best suited for creating |
| | 390 | editor commands that interact with slave Lisps, but in the past users |
| | 391 | implemented several independent Lisps as nodes communicating via these |
| | 392 | functions. There is a better level on which to write such code that |
| | 393 | avoids the extra effort these routines take for the editor's sake. See |
| | 394 | the CMU Common Lisp User's Manual for the remote and wire packages. |
| | 395 | |
| | 396 | === 18.3.1 The Current Slave === |
| | 397 | |
| | 398 | There is a slave-information structure that these return which is |
| | 399 | suitable for passing to the routines described in the following |
| | 400 | subsections. |
| | 401 | |
| | 402 | create-slave &optional name [Function] |
| | 403 | |
| | 404 | This creates a slave that tries to connect to the editor. When the |
| | 405 | slave connects to the editor, this returns a slave-information |
| | 406 | structure, and the interactive buffer is the buffer named name. This |
| | 407 | generates a name if name is nil. In case the slave never connects, |
| | 408 | this will eventually timeout and signal an editor-error. |
| | 409 | |
| | 410 | |
| | 411 | |
| | 412 | get-current-eval-server &optional errorp [Function] |
| | 413 | |
| | 414 | Current Eval Server (initial value ) [Variable] |
| | 415 | |
| | 416 | This returns the server-information for the Current Eval Server after |
| | 417 | making sure it is valid. Of course, a slave Lisp can die at |
| | 418 | anytime. If this variable is nil, and errorp is non-nil, then this |
| | 419 | signals an editor-error; otherwise, it tries to make a new slave. If |
| | 420 | there is no current eval server, then this tries to make a new slave, |
| | 421 | prompting the user based on a few variables (see the Hemlock User's |
| | 422 | Manual). |
| | 423 | |
| | 424 | |
| | 425 | get-current-compile-server [Function] |
| | 426 | |
| | 427 | Current Compile Server (initial value ) [Variable] |
| | 428 | |
| | 429 | This returns the server-information for the Current Compile Server |
| | 430 | after making sure it is valid. This may return nil. Since multiple |
| | 431 | slaves may exist, it is convenient to use one for developing code and |
| | 432 | one for compiling files. The compilation commands that use slave Lisps |
| | 433 | prefer to use the current compile server but will fall back on the |
| | 434 | current eval server when necessary. Typically, users only have |
| | 435 | separate compile servers when the slave Lisp can live on a separate |
| | 436 | workstation to save cycles on the editor machine, and the Hemlock |
| | 437 | commands only use this for compiling files. |
| | 438 | |
| | 439 | |
| | 440 | |
| | 441 | === 18.3.2 Asynchronous Operation Queuing === |
| | 442 | |
| | 443 | The routines in this section queue requests with an eval |
| | 444 | server. Requests are always satisfied in order, but these do not wait |
| | 445 | for notification that the operation actually happened. Because of |
| | 446 | this, the user can continue editing while his evaluation or |
| | 447 | compilation occurs. Note, these usually execute in the slave |
| | 448 | immediately, but if the interactive buffer connected to the slave is |
| | 449 | waiting for a form to return a value, the operation requested must |
| | 450 | wait until the slave is free again. |
| | 451 | |
| | 452 | string-eval string [Function] |
| | 453 | |
| | 454 | region-eval region [Function] |
| | 455 | |
| | 456 | region-compile region [Function] |
| | 457 | |
| | 458 | string-eval queues the evaluation of the form read from string on eval |
| | 459 | server server. Server defaults to the result of get-current-server, |
| | 460 | and string is a simple-string. The evaluation occurs with package |
| | 461 | bound in the slave to the package named by package, which defaults to |
| | 462 | Current Package or the empty string; the empty string indicates that |
| | 463 | the slave should evaluate the form in its current package. The slave |
| | 464 | reads the form in string within this context as well. Context is a |
| | 465 | string to use when reporting start and end notifications in the Echo |
| | 466 | Area buffer; it defaults to the concatenation of "evaluation of " and |
| | 467 | string. |
| | 468 | |
| | 469 | region-eval is the same as string-eval, but context defaults |
| | 470 | differently. If the user leaves this unsupplied, then it becomes a |
| | 471 | string involving part of the first line of region. |
| | 472 | |
| | 473 | region-compile is the same as the above. Server defaults the same; it |
| | 474 | does not default to get-current-compile-server since this compiles the |
| | 475 | region into the slave Lisp's environment, to affect what you are |
| | 476 | currently working on. |
| | 477 | |
| | 478 | |
| | 479 | |
| | 480 | file-compile file [Function] |
| | 481 | |
| | 482 | Remote Compile File (initial value nil) [Variable] |
| | 483 | |
| | 484 | This compiles file in a slave Lisp. When output-file is t, this uses a |
| | 485 | temporary output file that is publicly writable in case the client is |
| | 486 | on another machine, which allows for file systems that do not permit |
| | 487 | remote write access. This renames the temporary file to the |
| | 488 | appropriate binary name or deletes it after compilation. Setting |
| | 489 | Remote Compile File to nil, inhibits this. If output-file is non-nil |
| | 490 | and not t, then it is the name of the binary file to write. The |
| | 491 | compilation occurs with package bound in the slave to the package |
| | 492 | named by package, which defaults to Current Package or the empty |
| | 493 | string; the empty string indicates that the slave should evaluate the |
| | 494 | form in its current package. Error-file is the file in which to record |
| | 495 | compiler output, and a nil value inhibits this file's creation. Load |
| | 496 | indicates whether to load the resulting binary file, defaults to |
| | 497 | nil. Server defaults to get-current-compile-server, but if this |
| | 498 | returns nil, then server defaults to get-current-server. |
| | 499 | |
| | 500 | |
| | 501 | |
| | 502 | === 18.3.3. Synchronous Operation Queuing === |
| | 503 | |
| | 504 | The routines in this section queue requests with an eval server and |
| | 505 | wait for confirmation that the evaluation actually occurred. Because |
| | 506 | of this, the user cannot continue editing while the slave executes the |
| | 507 | request. Note, these usually execute in the slave immediately, but if |
| | 508 | the interactive buffer connected to the slave is waiting for a form to |
| | 509 | return a value, the operation requested must wait until the slave is |
| | 510 | free again. |
| | 511 | |
| | 512 | eval-form-in-server server-info string &optional package [Function] |
| | 513 | |
| | 514 | This function queues the evaluation of a form in the server associated |
| | 515 | with server-info and waits for the results. The server read's the form |
| | 516 | from string with package bound to the package named by package. This |
| | 517 | returns the results from the slave Lisp in a list of string |
| | 518 | values. You can read from the strings or simply display them depending |
| | 519 | on the print'ing of the evaluation results. |
| | 520 | |
| | 521 | Package defaults to Current Package. If this is nil, the server uses |
| | 522 | the value of package in the server. |
| | 523 | |
| | 524 | While the slave executes the form, it binds terminal-io to a stream |
| | 525 | that signals errors when read from and dumps output to a |
| | 526 | bit-bucket. This prevents the editor and slave from dead locking by |
| | 527 | waiting for each other to reply. |
| | 528 | |
| | 529 | |
| | 530 | |
| | 531 | eval-form-in-server-1 server-info string &optional package [Function] |
| | 532 | |
| | 533 | This function calls eval-form-in-server and read's the result in the |
| | 534 | first string it returns. This result must be read'able in the editor's |
| | 535 | Lisp. |
| | 536 | |
| | 537 | |
| | 538 | |
| | 539 | == 18.4. Spelling== |
| | 540 | |
| | 541 | Hemlock supports spelling checking and correcting commands based on |
| | 542 | the ITS Ispell dictionary. These commands use the following routines |
| | 543 | which include adding and deleting entries, reading the Ispell |
| | 544 | dictionary in a compiled binary format, reading user dictionary files |
| | 545 | in a text format, and checking and correcting possible spellings. |
| | 546 | |
| | 547 | spell:maybe-read-spell-dictionary [Function] |
| | 548 | |
| | 549 | This reads the default binary Ispell dictionary. Users must call this |
| | 550 | before the following routines will work. |
| | 551 | |
| | 552 | |
| | 553 | |
| | 554 | spell:spell-read-dictionary filename [Function] |
| | 555 | |
| | 556 | This adds entries to the dictionary from the lines in the file |
| | 557 | filename. Dictionary files contain line oriented records like the |
| | 558 | following: |
| | 559 | {{{ |
| | 560 | entry1/flag1/flag2 |
| | 561 | entry2 |
| | 562 | entry3/flag1 |
| | 563 | }}} |
| | 564 | |
| | 565 | The flags are the Ispell flags indicating which endings are |
| | 566 | appropriate for the given entry root, but these are unnecessary for |
| | 567 | user dictionary files. You can consult Ispell documentation if you |
| | 568 | want to know more about them. |
| | 569 | |
| | 570 | |
| | 571 | |
| | 572 | spell:spell-add-entry line &optional word-end [Function] |
| | 573 | |
| | 574 | This takes a line from a dictionary file, and adds the entry described |
| | 575 | by line to the dictionary. Word-end defaults to the position of the |
| | 576 | first slash character or the length of the line. Line is destructively |
| | 577 | modified. |
| | 578 | |
| | 579 | |
| | 580 | |
| | 581 | spell-remove-entry entry [Function] |
| | 582 | |
| | 583 | This removes entry, a simple-string, from the dictionary, so it will |
| | 584 | be an unknown word. This destructively modifies entry. If it is a root |
| | 585 | word, then all words derived with entry and its flags will also be |
| | 586 | deleted. If entry is a word derived from some root word, then the root |
| | 587 | and any words derived from it remain known words. |
| | 588 | |
| | 589 | |
| | 590 | |
| | 591 | spell:correct-spelling word [Function] |
| | 592 | |
| | 593 | This checks the spelling of word and outputs the results. If this |
| | 594 | finds word is correctly spelled due to some appropriate suffix on a |
| | 595 | root, it generates output indicating this. If this finds word as a |
| | 596 | root entry, it simply outputs that it found word. If this cannot find |
| | 597 | word at all, then it outputs possibly correct close spellings. This |
| | 598 | writes to standard-output, and it calls maybe-read-spell-dictionary |
| | 599 | before attempting any lookups. |
| | 600 | |
| | 601 | |
| | 602 | |
| | 603 | spell:spell-try-word word word-len [Function] |
| | 604 | |
| | 605 | max-entry-length [Constant] |
| | 606 | |
| | 607 | This returns an index into the dictionary if it finds word or an |
| | 608 | appropriate root. Word-len must be inclusively in the range 2 through |
| | 609 | max-entry-length, and it is the length of word. Word must be |
| | 610 | uppercase. This returns a second value indicating whether it found |
| | 611 | word due to a suffix flag, nil if word is a root entry. |
| | 612 | |
| | 613 | |
| | 614 | |
| | 615 | spell:spell-root-word index [Function] |
| | 616 | |
| | 617 | This returns a copy of the root word at dictionary entry index. This |
| | 618 | index is the same as returned by spell-try-word. |
| | 619 | |
| | 620 | |
| | 621 | |
| | 622 | spell:spell-collect-close-words word [Function] |
| | 623 | |
| | 624 | This returns a list of words correctly spelled that are close to |
| | 625 | word. Word must be uppercase, and its length must be inclusively in |
| | 626 | the range 2 through max-entry-length. Close words are determined by |
| | 627 | the Ispell rules: |
| | 628 | |
| | 629 | 1. Two adjacent letters can be transposed to form a correct spelling. |
| | 630 | 2. One letter can be changed to form a correct spelling. |
| | 631 | 3. One letter can be added to form a correct spelling. |
| | 632 | 4. One letter can be removed to form a correct spelling. |
| | 633 | |
| | 634 | |
| | 635 | spell:spell-root-flags index [Function] |
| | 636 | |
| | 637 | This returns a list of suffix flags as capital letters that apply to |
| | 638 | the dictionary root entry at index. This index is the same as returned |
| | 639 | by spell-try-word. |
| | 640 | |
| | 641 | |
| | 642 | == 18.5. File Utilities == |
| | 643 | |
| | 644 | Some implementations of Hemlock provide extensive directory editing |
| | 645 | commands, Dired, including a single wildcard feature. An asterisk |
| | 646 | denotes a wildcard. |
| | 647 | |
| | 648 | dired:copy-file spec1 spec2 &key :update :clobber :directory [Function] |
| | 649 | |
| | 650 | This function copies spec1 to spec2. It accepts a single wildcard in |
| | 651 | the filename portion of the specification, and it accepts |
| | 652 | directories. This copies files maintaining the source's write date. |
| | 653 | |
| | 654 | If spec1 and spec2 are both directories, this recursively copies the |
| | 655 | files and subdirectory structure of spec1; if spec2 is in the |
| | 656 | subdirectory structure of spec1, the recursion will not descend into |
| | 657 | it. Use "/spec1/*" to copy only the files from spec1 to directory |
| | 658 | spec2. |
| | 659 | |
| | 660 | If spec2 is a directory, and spec1 is a file, then this copies spec1 |
| | 661 | into spec2 with the same pathname-name. |
| | 662 | |
| | 663 | When :update is non-nil, then the copying process only copies files if |
| | 664 | the source is newer than the destination. |
| | 665 | |
| | 666 | When :update and :clobber are nil, and the destination exists, the |
| | 667 | copying process stops and asks the user whether the destination should |
| | 668 | be overwritten. |
| | 669 | |
| | 670 | When the user supplies :directory, it is a list of pathnames, |
| | 671 | directories excluded, and spec1 is a pattern containing one |
| | 672 | wildcard. This then copies each of the pathnames whose pathname-name |
| | 673 | matches the pattern. Spec2 is either a directory or a pathname whose |
| | 674 | pathname-name contains a wildcard. |
| | 675 | |
| | 676 | |
| | 677 | |
| | 678 | dired:rename-file spec1 spec2 &key :clobber :directory [Function] |
| | 679 | |
| | 680 | This function renames spec1 to spec2. It accepts a single wildcard in |
| | 681 | the filename portion of the specification, and spec2 may be a |
| | 682 | directory with the destination specification resulting in the merging |
| | 683 | of spec2 with spec1. If :clobber is nil, and spec2 exists, then this |
| | 684 | asks the user to confirm the renaming. When renaming a directory, end |
| | 685 | the specification without the trailing slash. |
| | 686 | |
| | 687 | When the user supplies :directory, it is a list of pathnames, |
| | 688 | directories excluded, and spec1 is a pattern containing one |
| | 689 | wildcard. This then copies each of the pathnames whose pathname-name |
| | 690 | matches the pattern. Spec2 is either a directory or a pathname whose |
| | 691 | pathname-name contains a wildcard. |
| | 692 | |
| | 693 | |
| | 694 | |
| | 695 | dired:delete-file spec &key :recursive :clobber [Function] |
| | 696 | |
| | 697 | This function deletes spec. It accepts a single wildcard in the |
| | 698 | filename portion of the specification, and it asks for confirmation on |
| | 699 | each file if :clobber is nil. If :recursive is non-nil, then spec may |
| | 700 | be a directory to recursively delete the entirety of the directory and |
| | 701 | its subdirectory structure. An empty directory may be specified |
| | 702 | without :recursive being non-nil. Specify directories with the |
| | 703 | trailing slash. |
| | 704 | |
| | 705 | |
| | 706 | |
| | 707 | dired:find-file name &optional directory find-all [Function] |
| | 708 | |
| | 709 | This function finds the file with file-namestring name, recursively |
| | 710 | looking in directory. If find-all is non-nil, then this continues |
| | 711 | searching even after finding a first occurrence of file. Name may |
| | 712 | contain a single wildcard, which causes find-all to default to t |
| | 713 | instead of nil. |
| | 714 | |
| | 715 | |
| | 716 | |
| | 717 | dired:make-directory name [Function] |
| | 718 | |
| | 719 | This function creates the directory with name. If it already exists, |
| | 720 | this signals an error. |
| | 721 | |
| | 722 | |
| | 723 | |
| | 724 | dired:pathnames-from-pattern pattern files [Function] |
| | 725 | |
| | 726 | This function returns a list of pathnames from the list files whose |
| | 727 | file-namestring's match pattern. Pattern must be a non-empty string |
| | 728 | and contain only one asterisk. Files contains no directories. |
| | 729 | |
| | 730 | |
| | 731 | |
| | 732 | dired:*update-default* [Variable] |
| | 733 | |
| | 734 | dired:*clobber-default* [Variable] |
| | 735 | |
| | 736 | dired:*recursive-default* [Variable] |
| | 737 | |
| | 738 | These are the default values for the keyword arguments above with |
| | 739 | corresponding names. These default to nil, t, and nil respectively. |
| | 740 | |
| | 741 | |
| | 742 | |
| | 743 | dired:*report-function* [Variable] |
| | 744 | dired:*error-function* [Variable] |
| | 745 | dired:*yesp-function* [Variable] |
| | 746 | |
| | 747 | These are the function the above routines call to report progress, |
| | 748 | signal errors, and prompt for yes or no. These all take format strings |
| | 749 | and arguments. |
| | 750 | |
| | 751 | |
| | 752 | |
| | 753 | merge-relative-pathnames pathname default-directory [Function] |
| | 754 | |
| | 755 | This function merges pathname with default-directory. If pathname is |
| | 756 | not absolute, this assumes it is relative to default-directory. The |
| | 757 | result is always a directory pathname. |
| | 758 | |
| | 759 | |
| | 760 | |
| | 761 | directoryp pathname [Function] |
| | 762 | |
| | 763 | This function returns whether pathname names a directory: it has no |
| | 764 | name and no type fields. |
| | 765 | |
| | 766 | |
| | 767 | == 18.6. Beeping == |
| | 768 | |
| | 769 | hemlock-beep [Function] |
| | 770 | |
| | 771 | Hemlock binds system:*beep-function* to this function to beep the |
| | 772 | device. It is different for different devices. |
| | 773 | |
| | 774 | |
| | 775 | |
| | 776 | Bell Style (initial value :border-flash) [Variable] |
| | 777 | |
| | 778 | Beep Border Width (initial value 20) [Variable] |
| | 779 | |
| | 780 | Bell Style determines what hemlock-beep does in Hemlock under |
| | 781 | CLX. Acceptable values are :border-flash, :feep, |
| | 782 | :border-flash-and-feep, :flash, :flash-and-feep, and nil. |
| | 783 | |
| | 784 | Beep Border Width is the width in pixels of the border flashed by |
| | 785 | border flash beep styles. |
| | 786 | |
| | 787 | |