Node:Programming a new layout, Next:Programming special windows, Previous:The layout-engine, Up:The layout-engine
If you just want creating a new layout with the standard ECB-windows
like directories, sources, methods, history and speedbar it's is
strongly recommended to define the new layout interactively with the
command ecb-create-new-layout
(see Creating a new ECB-layout).
If you want creating a new layout and if this layout should contain
other special windows than the standard ECB-windows then it's still
recommended to define this layout interactively with
ecb-create-new-layout
and using the option to give the created
windows user-defined types. For every user defined type you have then
just to program the necessary buffer-set function. For all the details
see Creating a new ECB-layout.
But if you do not like the interactive way (because you are tough and
brave) but you want programming the new layout with Elisp then use the
macro ecb-layout-define
(the following definition has stripped
the prefix "ecb-" for better indexing this manual):
layout-define name type &rest create-code | Macro |
Creates a new ECB-layout with name NAME. TYPE is the type
of the new layout and is literal, i.e. not evaluated. It can be left,
right, top or left-right. DOC is the docstring for the new
layout-function "ecb-layout-function-<name>". CREATE-CODE is
all the lisp code which is necessary to define the
ECB-windows/buffers. This macro adds the layout with NAME and
TYPEto the internal variable ecb-available-layouts .
Preconditions for CREATE-CODE:
Things CREATE-CODE has to do:
Things CREATE-CODE can do or can use:
Things CREATE-CODE must NOT do:
Postconditions for CREATE-CODE:
|
Use this macro to program new layouts within your .emacs
or any
other file which is loaded into your Emacs. After loading the file(s)
with all the new layout-definitions you can use it by customizing the
option ecb-layout-name
to the appropriate name or with the
command ecb-change-layout
.
With the function ecb-layout-undefine
you can remove a layout
from the list of available layouts:
layout-undefine name | Function |
Unbind ecb-layout-function-<NAME>,
ecb-delete-window-ecb-windows-<NAME>,
ecb-delete-other-windows-ecb-windows-<NAME> and remove NAME
from ecb-available-layouts .
|
Here is an example for a new layout programmed with
ecb-layout-define
:
(ecb-layout-define "my-own-layout" left nil ;; The frame is already splitted side-by-side and point stays in the ;; left window (= the ECB-tree-window-column) ;; Here is the creation code for the new layout ;; 1. Defining the current window/buffer as ECB-methods buffer (ecb-set-methods-buffer) ;; 2. Splitting the ECB-tree-windows-column in two windows (ecb-split-ver 0.75 t) ;; 3. Go to the second window (other-window 1) ;; 4. Defining the current window/buffer as ECB-history buffer (ecb-set-history-buffer) ;; 5. Make the ECB-edit-window current (see Postcondition above) (select-window (next-window)))
This layout definition defines a layout with name "my-own-layout"
which looks like:
------------------------------------------------------- | | | | | | | | | | Methods | | | | | | | | | | Edit | | | | | | | |--------------| | | | | | History | | | | | ------------------------------------------------------- | | | Compilation | | | -------------------------------------------------------