




An editor pane is an editor that has all of the functionality described in the LispWorks Guide To The Editor .
The text in the editor pane.
If 
t
 the editor pane will accept input from the mouse and keyboard.
A list specifying the modes of the editor buffer.
The name of the editor buffer.
A flag determining whether the editor pane has an Echo Area.
An integer specifying the fill length, or 
nil
.
The accessor 
editor-pane-text
 is provided to read and write the text in the editor buffer. The accessor 
editor-pane-enabled
 is used to enable and disable the editor (when it is disabled, it ignores all input from the mouse and keyboard).
The 
editor-pane
 stores text in buffers which are uniquely named, and so to create an 
editor-pane
 using an existing buffer you should pass the 
buffer-name
. To create an 
editor-pane
 with a new buffer, pass a 
buffer-name
 that does not match any existing buffer. If 
buffer-name
 is not passed, then the 
editor-pane
 uses some existing buffer.
buffer-modes
 allows you to specify the initial major mode and minor modes of the 
editor-pane
's buffer. It should be a list of the form 
(
major-mode-name
 . 
minor-mode-names
)
. See the 
LispWorks Editor User Guide
 for a description of major and minor modes in the LispWorks edtor.
Note: buffer-modes is used only when the CAPI creates the buffer, and not when it reuses a buffer.
If 
echo-area
 is non-
nil
. then an Echo Area is added. 
echo-area
 defaults to 
nil
.
If 
fixed-fill
 is non-
nil
, the editor pane tries to form lines of length close to, but no more than, 
fixed-fill
. It does this by forcing line breaks at spaces between words. 
fixed-fill
 defaults to 
nil
.
The cursor in an 
editor-pane
 blinks on and off by the mechanism described in editor-pane-blink-rate.
Note: editor panes support GNU Emacs keys on all platforms. Addtionally on Windows and Motif, they support MS Windows keys. Additionally on Cocoa, they support Mac OS X editor keys. Exactly one style of emulation is active at any one time for each editor pane. By default, editor panes in the Common LispWorks development environment use Emacs emulation on all platforms. By default, editor panes in delivered applications use Windows emulation on Windows, and Emacs emulation on other platforms. To alter the choice of emulation, see interface-keys-style.
In LispWorks 4.4 and previous versions, editor-pane supports only fixed-width fonts. In LispWorks 5.0 and later, variable-width fonts can also be used on Windows and Motif. Specify the font via the 
:font
 initarg (see simple-pane).
(capi:contain (make-instance 'capi:editor-pane
:text "Hello world"))
(setq ed (capi:contain
(make-instance 'capi:editor-pane
:text "Hello world"
:enabled nil)))
Note that you cannot type into the editor pane.
(capi:apply-in-pane-process
ed #'(setf capi:editor-pane-enabled) t ed)
Now you can enter text into the editor pane interactively.
You can also change the text programmatically:
(capi:apply-in-pane-process
ed #'(setf capi:editor-pane-text) "New text" ed)
In this example the callback modifies the buffer in the correct editor context so you that see the editor update immediately:
(capi:define-interface updating-editor ()
()
(:panes
(numbers capi:list-panel
:items '(1 2 3)
:selection-callback 'update-editor
:callback-type :interface
:visible-min-height '(:character 3))
(editor capi:editor-pane
:text
"Select numbers in the list above."
:visible-min-width
(list :character 35))))
(defun update-editor (interface)
(with-slots (numbers editor) interface
(editor:process-character
(list #'(setf capi:editor-pane-text)
(format nil "~R"
(capi:choice-selected-item numbers))
editor)
(capi:editor-window editor))))
(capi:display (make-instance 'updating-editor))
This example illustrates the use of buffer-modes to specify a major mode:
(defclass my-lisp-editor (capi:editor-pane) ()
(:default-initargs
:buffer-modes '("Lisp")
:echo-area t
:text
";; Lisp mode functionality such as command bindings and
;; parenthesis balancing work in this window.
(list 1 2 3)
"
:visible-min-width '(:character 60)
:name "My Lisp Editor Pane"))
(capi:define-interface my-lisp-editor-interface ()
()
(:panes
(ed
my-lisp-editor
))
(:default-initargs
:title "My Lisp Editor Interface"))
;; Ensure Emacs-like bindings regardless of platform
(defmethod capi:interface-keys-style
((self my-lisp-editor-interface))
:emacs)
(capi:display
(make-instance 'my-lisp-editor-interface))
Also see the example in the directory 
examples/capi/editor/
.
call-editor
editor-pane-blink-rate
*editor-cursor-active-style*
*editor-cursor-color*
*editor-cursor-drag-style*
*editor-cursor-inactive-style*
interface-keys-style
modify-editor-pane-buffer