Previous Section | Next Section | Table of Contents | Glossary | Index |
This chapter is sort of a catch all for any functions and variables which concern Hemlock's interaction with the outside world.
This a standard Common Lisp function. If x is supplied and is a string or pathname, the file specified by x is visited in a hemlock view (opening a new window if necessary, otherwise bringing an existing window with the file to the front), and the hemlock view object is the return value from the function.
If x is null, a new empty hemlock view is created and returned.
If x is a symbol or a setf function name, it attempts to edit the definition of the name. In this last case, the function returns without waiting for the operation to complete (for example, it might put up a non-modal dialog asking the user to select one of multiple definitions) and hence the return value is always NIL.
It is possible to create streams which output to or get input from a buffer. This mechanism is quite powerful and permits easy interfacing of Hemlock to Lisp.
Note that operations on these streams operate directly on buffers, therefore they have the same restrictions as described here for interacting with buffers from outside of the GUI thread.
This function returns a stream that inserts at mark all output directed to it. It works best if mark is a left-inserting mark. Buffered controls whether the stream is buffered or not, and its valid values are the following keywords:
:none--- No buffering is done. This is the default.
:line--- The buffer is flushed whenever a newline is written or when it is explicitly done with force-output.
:full--- The stream is only brought up to date when it is explicitly done with force-output
This macro executes forms in a context with var bound to a stream. Hemlock collects output to this stream and tries to pop up a display of the appropriate height containing all the output. When height is supplied, Hemlock creates the pop-up display immediately, forcing output on line breaks. This is useful for displaying information of temporary interest.
Hemlock commands are executed from an event handler in the initial Cocoa thread. They are executed within a ccl::with-standard-abort-handling form, which means cl:abort, ccl:abort-break, ccl:throw-cancel will abort the current command only and exit the event handler in an orderly fashion.
In addition, for now, lisp errors during command execution dump a
backtrace in the system console and are otherwise handled as if by
handle-lisp-errors
below, which means it is not possible to debug
errors at the point of the error. Once Clozure CL has better support
for debugging errors in the initial Cocoa thread, better Hemlock error
handling will be provided that will allow for some way to debug.
This function is called to report minor errors to the user. These are errors that a normal user could encounter in the course of editing, such as a search failing or an attempt to delete past the end of the buffer. This function simply aborts the current command. Any args specified are used to format an error message to be placed in the echo area. This function never returns.
Within the body of this macro any Lisp errors that occur are handled by displaying an error message in a dialog and aborting the current command, leaving the error text in the echo area. This macro should be wrapped around code which may get an error due to some action of the user --- for example, evaluating code fragments on the behalf of and supplied by the user.
Hemlock provides commands for finding the definition of a function or variable and placing the user at the definition in a buffer. A function is provided to allow invoking this functionality outside of Hemlock. Note that this function is unusual in that it is it is safe to call outside of the command interpreter, and in fact it can be called from any thread.
This function tries to find the definition of name
, create
or activate the window containing it, and scroll the view
to show the definition. If there are multiple definitions
available, the user is given a choice of which one to
use. This function may return before the operation is complete.
Previous Section | Next Section | Table of Contents | Glossary | Index |