Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 863 lines (742 sloc) 34.606 kB
e8c3693 first impl. of interactive creating of new layouts
berndl authored
1 ;;; ecb-create-layout.el --- creating new layouts
2
f88254a - Removed Emacs 20.X support completely
berndl authored
3 ;; Copyright (C) 2000 - 2005 Jesper Nordenberg,
7df4b6d Added the same Copyright-header to all sources (incl. copyright for FSF)
berndl authored
4 ;; Klaus Berndl,
5 ;; Kevin A. Burton,
6 ;; Free Software Foundation, Inc.
7
aa7071f Updated Copyright
berndl authored
8 ;; Author: Klaus Berndl <klaus.berndl@sdm.de>
e8c3693 first impl. of interactive creating of new layouts
berndl authored
9 ;; Maintainer: Klaus Berndl <klaus.berndl@sdm.de>
7df4b6d Added the same Copyright-header to all sources (incl. copyright for FSF)
berndl authored
10 ;; Keywords: browser, code, programming, tools
11 ;; Created: 2002
e8c3693 first impl. of interactive creating of new layouts
berndl authored
12
7df4b6d Added the same Copyright-header to all sources (incl. copyright for FSF)
berndl authored
13 ;; This program is free software; you can redistribute it and/or modify it under
14 ;; the terms of the GNU General Public License as published by the Free Software
15 ;; Foundation; either version 2, or (at your option) any later version.
e8c3693 first impl. of interactive creating of new layouts
berndl authored
16
17 ;; This program is distributed in the hope that it will be useful, but WITHOUT
7df4b6d Added the same Copyright-header to all sources (incl. copyright for FSF)
berndl authored
18 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 ;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
20 ;; details.
e8c3693 first impl. of interactive creating of new layouts
berndl authored
21
7df4b6d Added the same Copyright-header to all sources (incl. copyright for FSF)
berndl authored
22 ;; You should have received a copy of the GNU General Public License along with
23 ;; GNU Emacs; see the file COPYING. If not, write to the Free Software
e8c3693 first impl. of interactive creating of new layouts
berndl authored
24 ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
7b56239 Added a line $Id$ so cvs commit can insert the current version etc...
berndl authored
26 ;; $Id$
27
e8c3693 first impl. of interactive creating of new layouts
berndl authored
28 ;;; Commentary:
29 ;;
30 ;; Contains code for easy creating new layouts
31
325e2ec Added a History-comment to each file and changed all to Unix-lineendings
berndl authored
32 ;;; History
33 ;;
34 ;; For the ChangeLog of this file see the CVS-repository. For a complete
35 ;; history of the ECB-package see the file NEWS.
36
37
e8c3693 first impl. of interactive creating of new layouts
berndl authored
38 ;;; Code
39
d789f9c silencing the byte-compiler better
berndl authored
40 (eval-when-compile
d1db9e5 ecb-bytecomp.el was renamed to silentcomp.el - an ECB independent pac…
berndl authored
41 (require 'silentcomp))
d789f9c silencing the byte-compiler better
berndl authored
42
e13dbd3 replaced many `cond'-form by `case' rsp. `typecase' for better readab…
berndl authored
43 (eval-when-compile
44 ;; to avoid compiler grips
45 (require 'cl))
46
e8c3693 first impl. of interactive creating of new layouts
berndl authored
47 (require 'ecb-mode-line)
48 (require 'ecb-util)
81c6903 latest changes for ECB 2.24
berndl authored
49 (require 'ecb-compilation)
e8c3693 first impl. of interactive creating of new layouts
berndl authored
50
ab3b0d8 silencing the byte-compiler even better
berndl authored
51 ;; XEmacs stuff
d1db9e5 ecb-bytecomp.el was renamed to silentcomp.el - an ECB independent pac…
berndl authored
52 (silentcomp-defvar vertical-divider-map)
53 (silentcomp-defvar modeline-map)
ab3b0d8 silencing the byte-compiler even better
berndl authored
54 ;; Emacs 21.X stuff
7364e75 Move to auto-hscroll from automatic-hscrolling
Ryan Ware authored
55 (silentcomp-defvar auto-hscroll-mode)
d1db9e5 ecb-bytecomp.el was renamed to silentcomp.el - an ECB independent pac…
berndl authored
56 (silentcomp-defvar before-make-frame-hook)
57 (silentcomp-defvar after-make-frame-functions)
f43971f naming and managing layouts by name instead by number
berndl authored
58 ;; First loaded during activated ECB
59 (silentcomp-defvar ecb-buildin-layouts)
a79d98e silencing the byte-compiler
berndl authored
60
e8c3693 first impl. of interactive creating of new layouts
berndl authored
61 (defgroup ecb-create-layout nil
62 "Settings for creating new ECB-layouts."
63 :group 'ecb-layout
64 :prefix "ecb-create-layout-")
65
66 (defcustom ecb-create-layout-file "~/.ecb-user-layouts.el"
67 "*File where all layouts created by `ecb-create-new-layout' are stored."
68 :group 'ecb-create-layout
69 :type 'file)
70
f14c015 - rearranged some info-docs
berndl authored
71 (defcustom ecb-create-layout-frame-width 140
2e872ac finishing the new mechanism for creating layouts
berndl authored
72 "*Frame width of the layout creation frame."
73 :group 'ecb-create-layout
74 :type 'integer)
e8c3693 first impl. of interactive creating of new layouts
berndl authored
75
f14c015 - rearranged some info-docs
berndl authored
76 (defcustom ecb-create-layout-frame-height 51
2e872ac finishing the new mechanism for creating layouts
berndl authored
77 "*Frame height of the layout creation frame."
78 :group 'ecb-create-layout
79 :type 'integer)
473b355 finishing the layout creating also for XEmacs
berndl authored
80
2e872ac finishing the new mechanism for creating layouts
berndl authored
81
82 ;; internal vars and consts
e8c3693 first impl. of interactive creating of new layouts
berndl authored
83
2e872ac finishing the new mechanism for creating layouts
berndl authored
84
85 (defconst ecb-create-layout-buf-prefix " *ECB-LC-")
e8c3693 first impl. of interactive creating of new layouts
berndl authored
86 (defconst ecb-create-layout-frame-name "Creation of a new ECB-layout")
2e872ac finishing the new mechanism for creating layouts
berndl authored
87 (defconst ecb-create-layout-all-buf-types
f14c015 - rearranged some info-docs
berndl authored
88 '("directories" "history" "methods" "sources" "speedbar" "analyse" "symboldef"))
2e872ac finishing the new mechanism for creating layouts
berndl authored
89
90 (defconst ecb-create-layout-help-text-left-right
91 "
92 ECB layout creation mode
93 ========================
473b355 finishing the layout creating also for XEmacs
berndl authored
94
27fc756 Adding a new layout type 'left-right' which allows the ECB-tree-windo…
berndl authored
95 This is the help-screen of this mode. The window
96 displaying this help text is called the edit-window
6e1abd0 Fixing a lot of misspellings in strings and comments and in the onlin…
berndl authored
97 which is neither selectable nor delete-able nor
7df4b6d Added the same Copyright-header to all sources (incl. copyright for FSF)
berndl authored
98 split-able in this mode.
473b355 finishing the layout creating also for XEmacs
berndl authored
99
27fc756 Adding a new layout type 'left-right' which allows the ECB-tree-windo…
berndl authored
100 <left/right/up/down-arrow>: Moving around in current
101 window C-n, C-p: Go to next/previous window (beside
102 the edit-window)
473b355 finishing the layout creating also for XEmacs
berndl authored
103
2e872ac finishing the new mechanism for creating layouts
berndl authored
104 C-s: Split current window. You will be asked:
105 - If \"vertical\" or \"horizontal\" split
27fc756 Adding a new layout type 'left-right' which allows the ECB-tree-windo…
berndl authored
106 - How to split: \"at-point\", \"half\" or
107 \"other\" (i.e. you can specify any fraction
108 between 0.1 and 0.9)
f88254a - Removed Emacs 20.X support completely
berndl authored
109 - Which type the current window should be
110 \(see description of C-t below).
27fc756 Adding a new layout type 'left-right' which allows the ECB-tree-windo…
berndl authored
111 C-u: Unsplit, ie. delete current window
6e1abd0 Fixing a lot of misspellings in strings and comments and in the onlin…
berndl authored
112 C-t: Give the current window a built-in type
c4bdcf4 New versions for more flexible speedbar integration and for parsing and
berndl authored
113 (\"directories\", \"sources\", \"methods\",
f88254a - Removed Emacs 20.X support completely
berndl authored
114 \"history\" etc.) or any arbitrary user-defined
115 type (\"other\"). See the Online-manual!
27fc756 Adding a new layout type 'left-right' which allows the ECB-tree-windo…
berndl authored
116
117 C-c: Cancel layout creation. This does not save the
118 layout. Deletes this frame.
119 C-q: Save current defined layout and quit the layout
f43971f naming and managing layouts by name instead by number
berndl authored
120 creation. You will be asked for a layout-name.
121 With TAB-completion you can get the names already
122 in use. You have to choose a new name!
2e872ac finishing the new mechanism for creating layouts
berndl authored
123 Deletes this frame.
124
6e1abd0 Fixing a lot of misspellings in strings and comments and in the onlin…
berndl authored
125 There are NO other commands or keys available. ALL
27fc756 Adding a new layout type 'left-right' which allows the ECB-tree-windo…
berndl authored
126 other keys are disabled in this mode!
2e872ac finishing the new mechanism for creating layouts
berndl authored
127 ")
128
129 (defconst ecb-create-layout-help-text-top
130 " ECB layout creation mode
131 ========================
473b355 finishing the layout creating also for XEmacs
berndl authored
132
2e872ac finishing the new mechanism for creating layouts
berndl authored
133 This is the help-screen of this mode. The window displaying this help text is called
6e1abd0 Fixing a lot of misspellings in strings and comments and in the onlin…
berndl authored
134 the edit-window which is neither selectable nor delete-able nor split-able in this mode.
473b355 finishing the layout creating also for XEmacs
berndl authored
135
2e872ac finishing the new mechanism for creating layouts
berndl authored
136 <left/right/up/down-arrow>: Moving around in current window
137 C-n, C-p: Go to next/previous window (beside the edit-window)
473b355 finishing the layout creating also for XEmacs
berndl authored
138
2e872ac finishing the new mechanism for creating layouts
berndl authored
139 C-s: Split current window. You will be asked:
140 - If \"vertical\" or \"horizontal\" split
141 - How to split: \"at-point\", \"half\" or \"other\" (i.e. you can specify any
142 fraction between 0.1 and 0.9)
f88254a - Removed Emacs 20.X support completely
berndl authored
143 - Which type the current window should be \(see description of C-t below).
27fc756 Adding a new layout type 'left-right' which allows the ECB-tree-windo…
berndl authored
144 C-u: Unsplit, ie. delete current window
6e1abd0 Fixing a lot of misspellings in strings and comments and in the onlin…
berndl authored
145 C-t: Give the current window a built-in type (\"directories\", \"sources\", \"methods\",
f88254a - Removed Emacs 20.X support completely
berndl authored
146 \"history\" etc.) or any arbitrary user-defined type (\"other\").
473b355 finishing the layout creating also for XEmacs
berndl authored
147
2e872ac finishing the new mechanism for creating layouts
berndl authored
148 C-c: Cancel layout creation. This does not save the layout. Deletes this frame.
149 C-q: Save current defined layout and quit the layout creation. You will be asked for a
f43971f naming and managing layouts by name instead by number
berndl authored
150 layout-name. With TAB-completion you can get the names already in use.
151 You have to choose a new name! Deletes this frame.
2e872ac finishing the new mechanism for creating layouts
berndl authored
152
6e1abd0 Fixing a lot of misspellings in strings and comments and in the onlin…
berndl authored
153 There are NO other commands or keys available. ALL other keys are disabled in this mode!
2e872ac finishing the new mechanism for creating layouts
berndl authored
154 ")
155
156 (defconst ecb-create-layout-file-header
157 "
158
f88254a - Removed Emacs 20.X support completely
berndl authored
159 ;; Copyright (C) 2001 - 2005 Jesper Nordenberg
160 ;; Copyright (C) 2001 - 2005 Free Software Foundation, Inc.
161 ;; Copyright (C) 2001 - 2005 Klaus Berndl <klaus.berndl@sdm.de>
2e872ac finishing the new mechanism for creating layouts
berndl authored
162
163 ;; Author: Klaus Berndl <klaus.berndl@sdm.de>
164 ;; Maintainer: Klaus Berndl <klaus.berndl@sdm.de>
165 ;; Keywords: java, class, browser
166
167 ;; This program is free software; you can redistribute it and/or modify it
168 ;; under the terms of the GNU General Public License as published by the Free
169 ;; Software Foundation; either version 2, or (at your option) any later
170 ;; version.
171
172 ;; This program is distributed in the hope that it will be useful, but WITHOUT
173 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
174 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
175 ;; more details.
176
177 ;; You should have received a copy of the GNU General Public License along
178 ;; with GNU Emacs; see the file COPYING. If not, write to the Free Software
179 ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
180
181 ;;; Commentary:
182
1834805 small fixes
berndl authored
183 ;; This file contains all user-defined ECB-layouts created by the command
184 ;; `ecb-create-new-layout'.
2e872ac finishing the new mechanism for creating layouts
berndl authored
185
186 ;; !!! DO NOT EDIT THIS FILE MANUALLY - IT IS GENERATED BY ECB !!!
187
188 ")
189
e8c3693 first impl. of interactive creating of new layouts
berndl authored
190
191 (defvar ecb-create-layout-frame nil)
192 (defvar ecb-create-layout-edit-window nil)
193
194 (defvar ecb-create-layout-old-global-map nil)
195 (defvar ecb-create-layout-old-minor-mode-map-alist nil)
196 (defvar ecb-create-layout-old-hscroll nil)
2e872ac finishing the new mechanism for creating layouts
berndl authored
197 (defvar ecb-create-layout-old-debug-on-error nil)
acd113d fixes for layout creating and using
berndl authored
198 (defvar ecb-create-layout-old-frame nil)
473b355 finishing the layout creating also for XEmacs
berndl authored
199 (defvar ecb-create-layout-old-vertical-div-map nil)
200 (defvar ecb-create-layout-old-modeline-map nil)
a79d98e silencing the byte-compiler
berndl authored
201 (defvar ecb-create-layout-old-after-frame-h nil)
202 (defvar ecb-create-layout-old-before-frame-h nil)
2e872ac finishing the new mechanism for creating layouts
berndl authored
203
204 (defvar ecb-create-layout-generated-lisp nil)
205 (defvar ecb-create-layout-gen-counter 0)
206
207 (defvar ecb-create-layout-buf-types nil)
208
27fc756 Adding a new layout type 'left-right' which allows the ECB-tree-windo…
berndl authored
209 ;; can be 'left, 'right, 'top or 'left-right
2e872ac finishing the new mechanism for creating layouts
berndl authored
210 (defvar ecb-create-layout-type 'left)
211
212 (defun ecb-create-layout-initilize ()
213 (setq ecb-create-layout-buf-types
236875b Removed all calles to cl-functions at runtime. Now only cl-macros are…
berndl authored
214 (ecb-copy-list ecb-create-layout-all-buf-types))
2e872ac finishing the new mechanism for creating layouts
berndl authored
215 (setq ecb-create-layout-frame nil)
216 (setq ecb-create-layout-edit-window nil)
217 (setq ecb-create-layout-old-global-map nil)
218 (setq ecb-create-layout-old-minor-mode-map-alist nil)
219 (setq ecb-create-layout-old-hscroll nil)
acd113d fixes for layout creating and using
berndl authored
220 (setq ecb-create-layout-old-frame nil)
c3520c1 Interactively creating new layouts now works for Emacs 20.X too.
berndl authored
221
222 (if ecb-running-xemacs
223 (progn
224 (setq ecb-create-layout-old-vertical-div-map nil)
225 (setq ecb-create-layout-old-modeline-map nil))
a79d98e silencing the byte-compiler
berndl authored
226 (setq ecb-create-layout-old-after-frame-h nil)
227 (setq ecb-create-layout-old-before-frame-h nil))
c3520c1 Interactively creating new layouts now works for Emacs 20.X too.
berndl authored
228
2e872ac finishing the new mechanism for creating layouts
berndl authored
229 (setq ecb-create-layout-generated-lisp nil)
230 (setq ecb-create-layout-gen-counter 0))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
231
5138981 Fixed a bug when canceling the layout
berndl authored
232 (defvar ecb-create-layout-frame-deleted nil)
233
e8c3693 first impl. of interactive creating of new layouts
berndl authored
234 (defadvice delete-frame (before ecb-create-layout)
f43971f naming and managing layouts by name instead by number
berndl authored
235 "Ensure calling `ecb-create-layout-cancel' during deleting the
5138981 Fixed a bug when canceling the layout
berndl authored
236 layout-creation frame. Does nothing for any other other frame!"
e8c3693 first impl. of interactive creating of new layouts
berndl authored
237 (let ((frame (or (ad-get-arg 0) (selected-frame))))
eb96352 Added ecb-string< and ecb-string= with a ignore-case arg and replaces…
berndl authored
238 (when (ecb-string= (ecb-frame-parameter frame 'name)
239 ecb-create-layout-frame-name)
5138981 Fixed a bug when canceling the layout
berndl authored
240 (setq ecb-create-layout-frame-deleted t)
2e872ac finishing the new mechanism for creating layouts
berndl authored
241 (ecb-create-layout-cancel))))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
242
5138981 Fixed a bug when canceling the layout
berndl authored
243 (defadvice delete-frame (after ecb-create-layout)
244 "Ensures correct deleting of the layout-creation frame. Does nothing for any
245 other other frame!"
246 (when ecb-create-layout-frame-deleted
247 (setq ecb-create-layout-frame-deleted nil)
248 (ecb-activate))
249 (ad-disable-advice 'delete-frame 'after 'ecb-create-layout)
250 (ad-activate 'delete-frame))
251
252
473b355 finishing the layout creating also for XEmacs
berndl authored
253 (defun ecb-create-layout-frame-ok ()
254 "Return not nil if current frame is the `ecb-create-layout-frame'"
255 (and ecb-create-layout-frame
256 (frame-live-p ecb-create-layout-frame)
257 (equal (selected-frame) ecb-create-layout-frame)))
258
2e872ac finishing the new mechanism for creating layouts
berndl authored
259 (defun ecb-create-layout-cancel (&rest ignore)
01acd14 Making the docstrings of the customizable options and the interactive…
berndl authored
260 "Cancel layout-creation without saving the layout."
e8c3693 first impl. of interactive creating of new layouts
berndl authored
261 (interactive)
473b355 finishing the layout creating also for XEmacs
berndl authored
262 (when (ecb-create-layout-frame-ok)
85e6d2a Introduce compatability layer for interactive-p
Ryan Ware authored
263 (ecb-create-layout-clear-all (ecb-interactive-p))
81c6903 latest changes for ECB 2.24
berndl authored
264 (message "ECB Layout Creation canceled - the layout is not saved!")
85e6d2a Introduce compatability layer for interactive-p
Ryan Ware authored
265 (and (ecb-interactive-p) (ecb-activate))))
2e872ac finishing the new mechanism for creating layouts
berndl authored
266
267 (defun ecb-create-layout-clear-all (&optional delete-frame)
268 "Resets all stuff to state before `ecb-create-new-layout' was called. If
269 DELETE-FRAME is not nil then the new created frame will be deleted and the
acd113d fixes for layout creating and using
berndl authored
270 `ecb-create-layout-old-frame' will be selected."
2e872ac finishing the new mechanism for creating layouts
berndl authored
271 ;; disabling the advice
272 (ad-disable-advice 'delete-frame 'before 'ecb-create-layout)
273 (ad-activate 'delete-frame)
274 ;; killing all white-space-filled layout-buffers
b07521f - added missing save-match-data...
berndl authored
275 (save-match-data
276 (dolist (b (buffer-list ecb-create-layout-frame))
277 (if (string-match "^ \\*ECB-LC-" (buffer-name b))
278 (kill-buffer b))))
2e872ac finishing the new mechanism for creating layouts
berndl authored
279 ;; restore the global-map
280 (if (keymapp ecb-create-layout-old-global-map)
281 (use-global-map ecb-create-layout-old-global-map))
282 ;; restore the minor-mode-maps
283 (if ecb-create-layout-old-minor-mode-map-alist
284 (setq minor-mode-map-alist
285 ecb-create-layout-old-minor-mode-map-alist))
286 ;; restore horiz. scrolling
f88254a - Removed Emacs 20.X support completely
berndl authored
287 (unless ecb-running-xemacs
cddcf61 @alexott fix compilation warnings & more changes for Emacs 24.1
alexott authored
288 (setq auto-hscroll-mode ecb-create-layout-old-hscroll))
473b355 finishing the layout creating also for XEmacs
berndl authored
289 ;; for XEmacs restore these maps
c3520c1 Interactively creating new layouts now works for Emacs 20.X too.
berndl authored
290 (if ecb-running-xemacs
291 (progn
292 (setq vertical-divider-map ecb-create-layout-old-vertical-div-map)
293 (setq modeline-map ecb-create-layout-old-modeline-map))
6e1abd0 Fixing a lot of misspellings in strings and comments and in the onlin…
berndl authored
294 ;; before and after making frame stuff
a79d98e silencing the byte-compiler
berndl authored
295 (setq before-make-frame-hook ecb-create-layout-old-before-frame-h)
296 (setq after-make-frame-functions ecb-create-layout-old-after-frame-h))
2e872ac finishing the new mechanism for creating layouts
berndl authored
297 ;; restore old debug-on-error
298 (setq debug-on-error ecb-create-layout-old-debug-on-error)
acd113d fixes for layout creating and using
berndl authored
299 ;; delete the layout-frame and select the ecb-create-layout-old-frame
2e872ac finishing the new mechanism for creating layouts
berndl authored
300 (when delete-frame
acd113d fixes for layout creating and using
berndl authored
301 (when (and ecb-create-layout-old-frame
302 (frame-live-p ecb-create-layout-old-frame))
303 (raise-frame ecb-create-layout-old-frame)
304 (select-frame ecb-create-layout-old-frame))
2e872ac finishing the new mechanism for creating layouts
berndl authored
305 (when (and ecb-create-layout-frame
306 (frame-live-p ecb-create-layout-frame))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
307 (ad-with-originals 'delete-frame
2e872ac finishing the new mechanism for creating layouts
berndl authored
308 (delete-frame ecb-create-layout-frame))))
309 (setq ecb-create-layout-frame nil))
310
311 (defun ecb-create-layout-save-and-quit (&rest ignore)
312 "Quit the ECB Layout creation and save the defined layout."
313 (interactive)
473b355 finishing the layout creating also for XEmacs
berndl authored
314 (when (ecb-create-layout-frame-ok)
2e872ac finishing the new mechanism for creating layouts
berndl authored
315 (if (ecb-create-layout-ready-for-save-p)
85e6d2a Introduce compatability layer for interactive-p
Ryan Ware authored
316 (let ((delete-frame (ecb-interactive-p)))
2e872ac finishing the new mechanism for creating layouts
berndl authored
317 ;; if an error occurs during `ecb-create-layout-save-layout' or the
318 ;; user hits C-q we must clean the layout creation stuff!
319 (unwind-protect
320 (ecb-create-layout-save-layout)
321 ;; clean the layout creation stuff
322 (ecb-create-layout-clear-all delete-frame)
81c6903 latest changes for ECB 2.24
berndl authored
323 (message "ECB Layout Creation finished.")
324 (ecb-activate)))
f43971f naming and managing layouts by name instead by number
berndl authored
325 (ecb-error "You must give every ECB-tree-window a type (use C-t)!"))))
2e872ac finishing the new mechanism for creating layouts
berndl authored
326
327
328 (defun ecb-create-layout-ready-for-save-p ()
27fc756 Adding a new layout type 'left-right' which allows the ECB-tree-windo…
berndl authored
329 "Returns only not nil if all windows in current layout have a type."
2e872ac finishing the new mechanism for creating layouts
berndl authored
330 (let ((save-p t))
331 (save-excursion
c3520c1 Interactively creating new layouts now works for Emacs 20.X too.
berndl authored
332 (dolist (win (ecb-window-list (selected-frame) 0))
2e872ac finishing the new mechanism for creating layouts
berndl authored
333 (unless (equal win ecb-create-layout-edit-window)
334 (set-buffer (window-buffer win))
335 (setq save-p (ecb-create-layout-buffer-type)))))
336 save-p))
337
338
339 (defmacro ecb-create-layout-insert-line (line)
340 "Insert LINE in current-buffer and adds a newline."
341 `(progn
342 (insert ,line)
343 (insert "\n")))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
344
2e872ac finishing the new mechanism for creating layouts
berndl authored
345 (defun ecb-create-layout-insert-file-header ()
346 (insert (format ";;; %s --- user defined ECB-layouts" ;;
e57071a Some code clearings and small fixes
berndl authored
347 (ecb-file-name-nondirectory ecb-create-layout-file)))
2e872ac finishing the new mechanism for creating layouts
berndl authored
348 (insert ecb-create-layout-file-header))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
349
350 (defun ecb-create-layout-save-layout ()
2e872ac finishing the new mechanism for creating layouts
berndl authored
351 "Saves current layout in `ecb-create-layout-file'."
e8c3693 first impl. of interactive creating of new layouts
berndl authored
352 ;; make edit-window the current selected window
353 (ecb-create-layout-select-edit-window)
354 ;; we need the reversed sequence of the generated code
355 (setq ecb-create-layout-generated-lisp
356 (nreverse ecb-create-layout-generated-lisp))
f43971f naming and managing layouts by name instead by number
berndl authored
357 ;; ensure we have load all layouts defined until now
358 (ecb-load-layouts)
e8c3693 first impl. of interactive creating of new layouts
berndl authored
359 ;; now we have the create-code in the right sequence so we can save the new
360 ;; layout in the user-layout file
f43971f naming and managing layouts by name instead by number
berndl authored
361 (let ((layout-name ""))
acd113d fixes for layout creating and using
berndl authored
362 ;; a repeat...until-loop
363 (while (progn
364 ;;the while body
f43971f naming and managing layouts by name instead by number
berndl authored
365 (setq layout-name
0c6cd63 Changed internal structure of ecb-available-layouts.
berndl authored
366 (ecb-choose-layout-name (ecb-available-layouts-of-type nil)
367 nil))
acd113d fixes for layout creating and using
berndl authored
368 ;; the while condition
0c6cd63 Changed internal structure of ecb-available-layouts.
berndl authored
369 (ecb-available-layouts-member-p layout-name)))
acd113d fixes for layout creating and using
berndl authored
370 (with-temp-file (expand-file-name ecb-create-layout-file)
371 (erase-buffer)
372 (if (file-readable-p (expand-file-name ecb-create-layout-file))
373 (insert-file-contents (expand-file-name ecb-create-layout-file))
374 (ecb-create-layout-insert-file-header))
375 (goto-char (point-max))
376 ;; insert header of the layout-define macro
377 (ecb-create-layout-insert-line
f43971f naming and managing layouts by name instead by number
berndl authored
378 (format "(ecb-layout-define \"%s\" %s nil"
379 layout-name
acd113d fixes for layout creating and using
berndl authored
380 (symbol-name ecb-create-layout-type)))
381 ;; insert all the generated layout-code of the new layout
382 (dolist (line ecb-create-layout-generated-lisp)
e8c3693 first impl. of interactive creating of new layouts
berndl authored
383 (ecb-create-layout-insert-line
acd113d fixes for layout creating and using
berndl authored
384 (format " %s" line)))
385 ;; close the new layout-function
f43971f naming and managing layouts by name instead by number
berndl authored
386 (ecb-create-layout-insert-line " )"))
acd113d fixes for layout creating and using
berndl authored
387 ;; now we load the new layout
388 (load-file (expand-file-name ecb-create-layout-file))
389 (message "The new layout is saved in %s, loaded and available!"
390 ecb-create-layout-file)))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
391
392 (defun ecb-create-layout-gen-lisp (lisp-statement)
393 (setq ecb-create-layout-generated-lisp
394 (cons lisp-statement ecb-create-layout-generated-lisp)))
395
396 (defun ecb-create-layout-split-ver (&optional fraction)
397 (let ((factor (or fraction
398 (/ (float (count-lines (window-start) (point)))
c9991d7 Layout-engine rewritten, so now the 2-edit-window restriction has bee…
berndl authored
399 (float (- (ecb-window-full-height) 2))))))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
400 (ecb-split-ver factor t)
401 (ecb-create-layout-gen-lisp `(ecb-split-ver ,factor t))
402 factor))
403
404 (defun ecb-create-layout-split-hor (&optional fraction)
405 (let ((factor (or fraction
a79d98e silencing the byte-compiler
berndl authored
406 (/ (float (- (point) (ecb-line-beginning-pos)))
473b355 finishing the layout creating also for XEmacs
berndl authored
407 (float (- (window-width) 3))))))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
408 (ecb-split-hor factor t)
409 (ecb-create-layout-gen-lisp `(ecb-split-hor ,factor t))
410 (beginning-of-line)
411 factor))
412
413 (defun ecb-create-layout-add-to-buf-types (type)
7b84dad Layouts can be defined interactively with `ecb-create-new-layout' eve…
berndl authored
414 (when (and (stringp type)
415 (member type ecb-create-layout-all-buf-types))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
416 (add-to-list 'ecb-create-layout-buf-types type)
417 (setq ecb-create-layout-buf-types
eb96352 Added ecb-string< and ecb-string= with a ignore-case arg and replaces…
berndl authored
418 (sort ecb-create-layout-buf-types 'ecb-string<))))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
419
420 (defun ecb-create-layout-remove-from-buf-type (type)
421 (when (stringp type)
422 (setq ecb-create-layout-buf-types
eb96352 Added ecb-string< and ecb-string= with a ignore-case arg and replaces…
berndl authored
423 (sort (delete type ecb-create-layout-buf-types) 'ecb-string<))))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
424
425 (defun ecb-create-layout-buffer-type ()
426 (get-text-property (point-min) 'ecb-create-layout-type))
427
428 (defun ecb-create-layout-buffer-factor ()
429 (get-text-property (point-min) 'ecb-create-layout-factor))
430
431 (defun ecb-create-layout-set-buffer-type (type)
432 (let ((buffer-read-only nil))
433 (put-text-property (point-min) (1+ (point-min)) 'ecb-create-layout-type
434 type)))
473b355 finishing the layout creating also for XEmacs
berndl authored
435
e8c3693 first impl. of interactive creating of new layouts
berndl authored
436 (defun ecb-create-layout-set-buffer-factor (factor)
437 (let ((buffer-read-only nil))
438 (put-text-property (point-min) (1+ (point-min)) 'ecb-create-layout-factor
439 factor)))
440
7b84dad Layouts can be defined interactively with `ecb-create-new-layout' eve…
berndl authored
441
442 (defun ecb-create-layout-gen-lisp-for-buffer-type (type)
443 (let ((func-sym (intern (format "ecb-set-%s-buffer" type))))
444 (ecb-create-layout-gen-lisp
445 `(if (fboundp (quote ,func-sym))
446 (,func-sym)
447 (ecb-set-default-ecb-buffer)))))
448
449
e8c3693 first impl. of interactive creating of new layouts
berndl authored
450 (defun ecb-create-layout-set-buffer-to-type (&optional type)
01acd14 Making the docstrings of the customizable options and the interactive…
berndl authored
451 "Give current ECB-buffer a type."
e8c3693 first impl. of interactive creating of new layouts
berndl authored
452 (interactive)
473b355 finishing the layout creating also for XEmacs
berndl authored
453 (when (ecb-create-layout-frame-ok)
454 ;; adding the old buffer type to the available-list
455 (ecb-create-layout-add-to-buf-types (or type
456 (ecb-create-layout-buffer-type)))
457 (let ((new-type (or (and (stringp type) type)
458 (ecb-query-string "Type of current ECB-tree-buffer:"
7b84dad Layouts can be defined interactively with `ecb-create-new-layout' eve…
berndl authored
459 ecb-create-layout-buf-types
460 "Insert the buffer type"))))
473b355 finishing the layout creating also for XEmacs
berndl authored
461 ;; removing the new buffer type from the available-list
462 (ecb-create-layout-remove-from-buf-type new-type)
1834805 small fixes
berndl authored
463 (ecb-mode-line-set (buffer-name (current-buffer))
81c6903 latest changes for ECB 2.24
berndl authored
464 (selected-frame)
e57c16b Rewritten the mode-line stuff in ecb-mode-line.el. Now all special EC…
berndl authored
465 (concat "ECB " new-type) nil t)
473b355 finishing the layout creating also for XEmacs
berndl authored
466 ;; setting the new buffer type in the buffer itself
467 (ecb-create-layout-set-buffer-type new-type)
85e6d2a Introduce compatability layer for interactive-p
Ryan Ware authored
468 (when (ecb-interactive-p)
7b84dad Layouts can be defined interactively with `ecb-create-new-layout' eve…
berndl authored
469 (ecb-create-layout-gen-lisp-for-buffer-type new-type)
473b355 finishing the layout creating also for XEmacs
berndl authored
470 (ecb-create-layout-next-window))
471 new-type)))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
472
2e872ac finishing the new mechanism for creating layouts
berndl authored
473 (defun ecb-create-layout-select-edit-window ()
474 (let ((counter 0))
475 (while (not (equal (selected-window) ecb-create-layout-edit-window))
476 (other-window 1)
477 (setq counter (1+ counter)))
478 (ecb-create-layout-gen-lisp `(dotimes (i ,counter)
479 (other-window 1)
480 (if (equal (selected-window)
481 ecb-compile-window)
482 (other-window 1))))))
483
e8c3693 first impl. of interactive creating of new layouts
berndl authored
484 (defun ecb-create-layout-split ()
01acd14 Making the docstrings of the customizable options and the interactive…
berndl authored
485 "Split current window."
e8c3693 first impl. of interactive creating of new layouts
berndl authored
486 (interactive)
473b355 finishing the layout creating also for XEmacs
berndl authored
487 (when (ecb-create-layout-frame-ok)
488 ;; splitting
489 (let* ((old-buf-type (ecb-create-layout-buffer-type))
490 (split-choices (if (equal ecb-create-layout-type 'top)
491 '("horizontal" "vertical")
492 '("vertical" "horizontal")))
493 (split-type (ecb-query-string "Split type:" split-choices))
494 (split-method
495 (ecb-query-string "Split method:"
496 '("at-point" "half")
497 "Insert a fraction between 0.1 and 0.9"))
eb96352 Added ecb-string< and ecb-string= with a ignore-case arg and replaces…
berndl authored
498 (fraction (cond ((ecb-string= split-method "at-point")
473b355 finishing the layout creating also for XEmacs
berndl authored
499 nil)
eb96352 Added ecb-string< and ecb-string= with a ignore-case arg and replaces…
berndl authored
500 ((ecb-string= split-method "half")
473b355 finishing the layout creating also for XEmacs
berndl authored
501 0.5)
502 ((floatp (string-to-number split-method))
503 (string-to-number split-method))
504 (t 0.5)))
505 (real-split-factor
eb96352 Added ecb-string< and ecb-string= with a ignore-case arg and replaces…
berndl authored
506 (if (ecb-string= split-type "horizontal")
473b355 finishing the layout creating also for XEmacs
berndl authored
507 (ecb-create-layout-split-hor fraction)
508 (ecb-create-layout-split-ver fraction))))
509 ;; creating new fitting buffers
f60f75a fixed a bug in the modeline-display of the layout-creation frame
berndl authored
510 (ecb-create-layout-new-buffer)
511 (save-excursion
512 (save-selected-window
513 (select-window (next-window))
514 (ecb-create-layout-new-buffer)))
473b355 finishing the layout creating also for XEmacs
berndl authored
515 ;; asking for the buffer type
516 (ecb-create-layout-set-buffer-factor real-split-factor)
7b84dad Layouts can be defined interactively with `ecb-create-new-layout' eve…
berndl authored
517 (ecb-create-layout-gen-lisp-for-buffer-type
518 (ecb-create-layout-set-buffer-to-type old-buf-type))
473b355 finishing the layout creating also for XEmacs
berndl authored
519 (ecb-create-layout-next-window))))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
520
521 (defun ecb-create-layout-forward-char ()
01acd14 Making the docstrings of the customizable options and the interactive…
berndl authored
522 "Move one character forward."
e8c3693 first impl. of interactive creating of new layouts
berndl authored
523 (interactive)
473b355 finishing the layout creating also for XEmacs
berndl authored
524 (when (ecb-create-layout-frame-ok)
a79d98e silencing the byte-compiler
berndl authored
525 (unless (> (- (point) (ecb-line-beginning-pos)) (- (window-width)
c3520c1 Interactively creating new layouts now works for Emacs 20.X too.
berndl authored
526 (if ecb-running-xemacs
527 3
528 2)))
473b355 finishing the layout creating also for XEmacs
berndl authored
529 (call-interactively 'forward-char))))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
530
531 (defun ecb-create-layout-next-window ()
01acd14 Making the docstrings of the customizable options and the interactive…
berndl authored
532 "Go to the next window.
533 This command always goes to the next special ECB-window, i.e. it never selects
534 the edit-window."
e8c3693 first impl. of interactive creating of new layouts
berndl authored
535 (interactive)
473b355 finishing the layout creating also for XEmacs
berndl authored
536 (when (ecb-create-layout-frame-ok)
537 (let ((steps (if (equal (next-window) ecb-create-layout-edit-window) 2 1)))
538 (other-window steps)
539 (ecb-create-layout-gen-lisp `(dotimes (i ,steps)
540 (other-window 1)
541 (if (equal (selected-window)
542 ecb-compile-window)
543 (other-window 1)))))))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
544
545 (defun ecb-create-layout-previous-window ()
01acd14 Making the docstrings of the customizable options and the interactive…
berndl authored
546 "Go to the previous window.
547 This command always goes to the ECB-window preceding current window, i.e. it
548 never selects the edit-window."
e8c3693 first impl. of interactive creating of new layouts
berndl authored
549 (interactive)
473b355 finishing the layout creating also for XEmacs
berndl authored
550 (when (ecb-create-layout-frame-ok)
551 (let ((steps (if (equal (previous-window (selected-window) 0)
552 ecb-create-layout-edit-window)
553 -2 -1)))
554 (other-window steps)
555 (ecb-create-layout-gen-lisp `(dotimes (i ,(abs steps))
556 (other-window -1)
557 (if (equal (selected-window)
558 ecb-compile-window)
559 (other-window -1)))))))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
560
561 (defun ecb-create-layout-delete-window ()
01acd14 Making the docstrings of the customizable options and the interactive…
berndl authored
562 "Delete current window."
e8c3693 first impl. of interactive creating of new layouts
berndl authored
563 (interactive)
473b355 finishing the layout creating also for XEmacs
berndl authored
564 (when (ecb-create-layout-frame-ok)
565 (unless (or (equal (selected-window) ecb-create-layout-edit-window)
c3520c1 Interactively creating new layouts now works for Emacs 20.X too.
berndl authored
566 (= (length (ecb-window-list nil 0))
27fc756 Adding a new layout type 'left-right' which allows the ECB-tree-windo…
berndl authored
567 (if (equal ecb-create-layout-type 'left-right) 3 2)))
568 (if (and (member ecb-create-layout-type '(right left-right))
569 (equal (previous-window (selected-window) 0)
570 ecb-create-layout-edit-window)
f43971f naming and managing layouts by name instead by number
berndl authored
571 (> (nth 0 (ecb-window-edges (next-window))) (nth 0 (ecb-window-edges)))
572 (= (nth 3 (ecb-window-edges ecb-create-layout-edit-window))
573 (nth 3 (ecb-window-edges))))
27fc756 Adding a new layout type 'left-right' which allows the ECB-tree-windo…
berndl authored
574 ;; In exactly this window context we can not delete the current
575 ;; window because otherwise the edit-window would enlarge and the
576 ;; wrong window would be deleted!
f43971f naming and managing layouts by name instead by number
berndl authored
577 (ecb-error "This window can not be deleted! Delete another one.")
473b355 finishing the layout creating also for XEmacs
berndl authored
578 ;; add the buffer type of the deleted window to the available-list
579 (ecb-create-layout-add-to-buf-types (ecb-create-layout-buffer-type))
580 (kill-buffer (current-buffer))
581 (delete-window)
582 (ecb-create-layout-gen-lisp '(delete-window))
27fc756 Adding a new layout type 'left-right' which allows the ECB-tree-windo…
berndl authored
583 (if (equal (selected-window) ecb-create-layout-edit-window)
584 (ecb-create-layout-previous-window))
473b355 finishing the layout creating also for XEmacs
berndl authored
585 ;; add the buffer type of the new bigger window to the available-list
586 (ecb-create-layout-add-to-buf-types (ecb-create-layout-buffer-type))
587 (kill-buffer (current-buffer))
588 (ecb-create-layout-new-buffer)))))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
589
590 (defvar ecb-create-layout-mode-map nil
6e1abd0 Fixing a lot of misspellings in strings and comments and in the onlin…
berndl authored
591 "`ecb-create-layout-mode' key-map.")
e8c3693 first impl. of interactive creating of new layouts
berndl authored
592
593 (if ecb-create-layout-mode-map
594 ()
595 (setq ecb-create-layout-mode-map (make-sparse-keymap))
6e1abd0 Fixing a lot of misspellings in strings and comments and in the onlin…
berndl authored
596 ;; (suppress-key-map ecb-create-layout-mode-map t)
e8c3693 first impl. of interactive creating of new layouts
berndl authored
597
598 ;; for minibuffer insertion we need the following
599 (dotimes (i 26)
600 (define-key ecb-create-layout-mode-map
601 (string (+ i 97)) 'self-insert-command))
602
1834805 small fixes
berndl authored
603 (dotimes (i 26)
604 (define-key ecb-create-layout-mode-map
605 (string (+ i 65)) 'self-insert-command))
606
e8c3693 first impl. of interactive creating of new layouts
berndl authored
607 (dotimes (i 10)
608 (define-key ecb-create-layout-mode-map
609 (string (+ i 48)) 'self-insert-command))
610
af41b88 Fixing a bug which prevents from inserting a fraction like 0.75
berndl authored
611 (define-key ecb-create-layout-mode-map "." 'self-insert-command)
27fc756 Adding a new layout type 'left-right' which allows the ECB-tree-windo…
berndl authored
612 (define-key ecb-create-layout-mode-map "-" 'self-insert-command)
af41b88 Fixing a bug which prevents from inserting a fraction like 0.75
berndl authored
613
92b9164 small changes vor layout creation
berndl authored
614 (if ecb-running-xemacs
615 (define-key ecb-create-layout-mode-map (kbd "<BS>")
616 'delete-backward-char)
617 (define-key ecb-create-layout-mode-map (kbd "<DEL>")
618 'backward-delete-char-untabify))
619
e8c3693 first impl. of interactive creating of new layouts
berndl authored
620 (define-key ecb-create-layout-mode-map (kbd "C-q")
2e872ac finishing the new mechanism for creating layouts
berndl authored
621 'ecb-create-layout-save-and-quit)
e8c3693 first impl. of interactive creating of new layouts
berndl authored
622 (define-key ecb-create-layout-mode-map (kbd "C-c")
2e872ac finishing the new mechanism for creating layouts
berndl authored
623 'ecb-create-layout-cancel)
e8c3693 first impl. of interactive creating of new layouts
berndl authored
624 (define-key ecb-create-layout-mode-map (kbd "C-u")
625 'ecb-create-layout-delete-window)
626 (define-key ecb-create-layout-mode-map (kbd "C-s") 'ecb-create-layout-split)
627 (define-key ecb-create-layout-mode-map (kbd "C-t")
628 'ecb-create-layout-set-buffer-to-type)
629 (define-key ecb-create-layout-mode-map (kbd "<left>") 'backward-char)
630 (define-key ecb-create-layout-mode-map (kbd "<right>")
631 'ecb-create-layout-forward-char)
632 (define-key ecb-create-layout-mode-map (kbd "<up>") 'previous-line)
633 (define-key ecb-create-layout-mode-map (kbd "<down>") 'next-line)
2e872ac finishing the new mechanism for creating layouts
berndl authored
634 (define-key ecb-create-layout-mode-map (kbd "C-n")
635 'ecb-create-layout-next-window)
e8c3693 first impl. of interactive creating of new layouts
berndl authored
636 (define-key ecb-create-layout-mode-map (kbd "C-p")
637 'ecb-create-layout-previous-window)
27fc756 Adding a new layout type 'left-right' which allows the ECB-tree-windo…
berndl authored
638 ;; (define-key ecb-create-layout-mode-map (kbd "C-h v")
639 ;; 'describe-variable)
640 ;; (define-key ecb-create-layout-mode-map (kbd "C-h k")
641 ;; 'describe-key)
642 ;; (define-key ecb-create-layout-mode-map (kbd "C-h d")
643 ;; 'ecb-create-layout-debug)
644 ;; (define-key ecb-create-layout-mode-map (kbd "M-<down>")
645 ;; 'scroll-other-window)
e8c3693 first impl. of interactive creating of new layouts
berndl authored
646 (set-keymap-parent ecb-create-layout-mode-map nil))
647
648
2e872ac finishing the new mechanism for creating layouts
berndl authored
649 (defun ecb-create-layout-new-buffer (&optional do-not-fill)
650 (set-window-dedicated-p (selected-window) nil)
e8c3693 first impl. of interactive creating of new layouts
berndl authored
651 (switch-to-buffer (generate-new-buffer ecb-create-layout-buf-prefix))
652 (erase-buffer)
2e872ac finishing the new mechanism for creating layouts
berndl authored
653 (unless do-not-fill
c9991d7 Layout-engine rewritten, so now the 2-edit-window restriction has bee…
berndl authored
654 (dotimes (i (ecb-window-full-height))
236875b Removed all calles to cl-functions at runtime. Now only cl-macros are…
berndl authored
655 (insert
2e872ac finishing the new mechanism for creating layouts
berndl authored
656 (format "%s\n"
657 (make-string (- (window-width)
c3520c1 Interactively creating new layouts now works for Emacs 20.X too.
berndl authored
658 (if ecb-running-xemacs 3 1))
2e872ac finishing the new mechanism for creating layouts
berndl authored
659 ?\ )))))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
660 (goto-char (point-min))
2e872ac finishing the new mechanism for creating layouts
berndl authored
661 (ecb-create-layout-mode)
662 (set-window-dedicated-p (selected-window) t))
663
e8c3693 first impl. of interactive creating of new layouts
berndl authored
664
665
666 (defun ecb-create-layout-mode ()
667 "Major mode for creating new ECB-layouts."
668 (setq major-mode 'ecb-create-layout-mode)
669 (setq mode-name "ECB Create-Layout")
670 (use-local-map ecb-create-layout-mode-map)
3d2bc5c Completely removed support for older semantic 1.4.X
berndl authored
671 (make-local-variable 'buffer-read-only)
81c6903 latest changes for ECB 2.24
berndl authored
672 (ecb-mode-line-set (buffer-name (current-buffer))
673 (selected-frame) "" nil t)
e8c3693 first impl. of interactive creating of new layouts
berndl authored
674 (setq buffer-read-only t))
675
676 (defun ecb-create-layout-init-layout (&optional new)
677 (delete-other-windows)
678 (ecb-create-layout-new-buffer)
679 (when new
680 (setq ecb-create-layout-type (intern (ecb-query-string
681 "Location of the the ECB-tree-windows:"
27fc756 Adding a new layout type 'left-right' which allows the ECB-tree-windo…
berndl authored
682 '("left" "right" "top" "left-right")))))
e13dbd3 replaced many `cond'-form by `case' rsp. `typecase' for better readab…
berndl authored
683 (case ecb-create-layout-type
684 (left
685 (ecb-split-hor ecb-windows-width))
686 (right
687 (ecb-split-hor (- ecb-windows-width) t))
688 (top
689 (ecb-split-ver ecb-windows-height))
690 (otherwise
691 (ecb-split-hor (- (* 0.667 ecb-windows-width)) t)
692 (ecb-split-hor (* 0.667 ecb-windows-width) nil t)))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
693 ;; we set the buffer in the big edit-window
2e872ac finishing the new mechanism for creating layouts
berndl authored
694 (ecb-create-layout-new-buffer t)
695 ;; now we insert the help in the edit-window
696 (let ((buffer-read-only nil))
697 (insert (if (equal ecb-create-layout-type 'top)
698 ecb-create-layout-help-text-top
699 ecb-create-layout-help-text-left-right)))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
700 (setq ecb-create-layout-edit-window (selected-window))
81c6903 latest changes for ECB 2.24
berndl authored
701 (ecb-mode-line-set (buffer-name (current-buffer))
702 (selected-frame) " ECB edit-window" nil t)
2e872ac finishing the new mechanism for creating layouts
berndl authored
703 ;; The edit window must not be dedicated
704 (set-window-dedicated-p (selected-window) nil)
e8c3693 first impl. of interactive creating of new layouts
berndl authored
705 ;; we set the buffer for the (currently unsplitted) ECB-window
27fc756 Adding a new layout type 'left-right' which allows the ECB-tree-windo…
berndl authored
706 (other-window 1)
707 (ecb-create-layout-new-buffer)
708 ;; for the left-right type we have to set the other column too
709 (when (equal ecb-create-layout-type 'left-right)
710 (other-window 1)
711 (ecb-create-layout-new-buffer)))
712
473b355 finishing the layout creating also for XEmacs
berndl authored
713
2e872ac finishing the new mechanism for creating layouts
berndl authored
714 (defun ecb-create-layout-make-frame ()
92b9164 small changes vor layout creation
berndl authored
715 "Create a new frame for the layout creation process and return it."
f88254a - Removed Emacs 20.X support completely
berndl authored
716 (if ecb-running-xemacs
717 (make-frame `((name . ,ecb-create-layout-frame-name)
718 (minibuffer . t)
719 (user-position . t)
720 (width . ,ecb-create-layout-frame-width)
721 (height . ,ecb-create-layout-frame-height)
722 (default-toolbar-visible-p . nil)
723 (left-toolbar-visible-p . nil)
724 (right-toolbar-visible-p . nil)
725 (top-toolbar-visible-p . nil)
726 (bottom-toolbar-visible-p . nil)
727 (default-gutter-visible-p . nil)
728 (left-gutter-visible-p . nil)
729 (right-gutter-visible-p . nil)
730 (top-gutter-visible-p . nil)
731 (bottom-gutter-visible-p . nil)
732 (has-modeline-p . t)
733 (use-left-overflow . nil)
734 (vertical-scrollbar-visible-p . nil)
735 (horizontal-scrollbar-visible-p . nil)
736 (use-right-overflow . nil)
737 (menubar-visible-p . nil)))
738 (make-frame `((name . ,ecb-create-layout-frame-name)
739 (minibuffer . t)
740 (user-position . t)
741 (width . ,ecb-create-layout-frame-width)
742 (height . ,ecb-create-layout-frame-height)
743 (vertical-scroll-bars . nil)
744 (horizontal-scroll-bars . nil)
745 (tool-bar-lines . 0)
746 (menu-bar-lines . 0)))))
e8c3693 first impl. of interactive creating of new layouts
berndl authored
747
81c6903 latest changes for ECB 2.24
berndl authored
748 ;; TODO: Klaus Berndl <klaus.berndl@sdm.de>: Wir müssen ev. ECB vorher
749 ;; deaktivieren, da sonst ein 2. ECB-menu entsteht. Beim C-c oder C-q eben
750 ;; dann wieder aktivieren.
e8c3693 first impl. of interactive creating of new layouts
berndl authored
751 (defun ecb-create-new-layout ()
c3520c1 Interactively creating new layouts now works for Emacs 20.X too.
berndl authored
752 "Start interactively layout creating."
e8c3693 first impl. of interactive creating of new layouts
berndl authored
753 (interactive)
c3520c1 Interactively creating new layouts now works for Emacs 20.X too.
berndl authored
754
81c6903 latest changes for ECB 2.24
berndl authored
755 (ecb-deactivate)
c3520c1 Interactively creating new layouts now works for Emacs 20.X too.
berndl authored
756 (ecb-create-layout-initilize)
757
758 ;; before- and after make frame stuff
759 (when (not ecb-running-xemacs)
760 (setq ecb-create-layout-old-after-frame-h after-make-frame-functions)
761 (setq after-make-frame-functions nil)
762 (setq ecb-create-layout-old-before-frame-h before-make-frame-hook)
763 (setq before-make-frame-hook nil))
a79d98e silencing the byte-compiler
berndl authored
764
c3520c1 Interactively creating new layouts now works for Emacs 20.X too.
berndl authored
765 ;; saving old frame
766 (setq ecb-create-layout-old-frame (selected-frame))
767
768 ;; creating new frame
769 (setq ecb-create-layout-frame (ecb-create-layout-make-frame))
770 (raise-frame ecb-create-layout-frame)
771 (select-frame ecb-create-layout-frame)
772 (ad-enable-advice 'delete-frame 'before 'ecb-create-layout)
5138981 Fixed a bug when canceling the layout
berndl authored
773 (ad-enable-advice 'delete-frame 'after 'ecb-create-layout)
c3520c1 Interactively creating new layouts now works for Emacs 20.X too.
berndl authored
774 (ad-activate 'delete-frame)
775
776 ;; global map
777 (setq ecb-create-layout-old-global-map (current-global-map))
778 (use-global-map ecb-create-layout-mode-map)
779
780 ;; minor-modes map
781 (setq ecb-create-layout-old-minor-mode-map-alist minor-mode-map-alist)
782 (setq minor-mode-map-alist nil)
783
784 ;; horiz. scrolling
f88254a - Removed Emacs 20.X support completely
berndl authored
785 (unless ecb-running-xemacs
cddcf61 @alexott fix compilation warnings & more changes for Emacs 24.1
alexott authored
786 (setq ecb-create-layout-old-hscroll auto-hscroll-mode)
787 (setq auto-hscroll-mode nil))
c3520c1 Interactively creating new layouts now works for Emacs 20.X too.
berndl authored
788
789 ;; for XEmacs modeline- and vertical-divider maps
790 (when ecb-running-xemacs
791 (setq ecb-create-layout-old-vertical-div-map vertical-divider-map)
792 (setq vertical-divider-map nil)
793 (setq ecb-create-layout-old-modeline-map modeline-map)
794 (setq modeline-map nil))
795
796 ;; debug on error
797 (setq ecb-create-layout-old-debug-on-error debug-on-error)
798 (setq debug-on-error nil)
799
800 (ecb-create-layout-init-layout t))
2e872ac finishing the new mechanism for creating layouts
berndl authored
801
f43971f naming and managing layouts by name instead by number
berndl authored
802
803 (defun ecb-delete-new-layout ()
01acd14 Making the docstrings of the customizable options and the interactive…
berndl authored
804 "Select a layout-name and delete this layout.
805 This means the layout-definition is removed from the file
f43971f naming and managing layouts by name instead by number
berndl authored
806 `ecb-create-layout-file' and the layout-function and associated aliases are
807 unbound."
808 (interactive)
809 ;; ensure we have load all layouts defined until now
810 (ecb-load-layouts)
0c6cd63 Changed internal structure of ecb-available-layouts.
berndl authored
811 (let ((new-layout-list
236875b Removed all calles to cl-functions at runtime. Now only cl-macros are…
berndl authored
812 (sort (ecb-set-difference (ecb-available-layouts-of-type nil)
aa7071f Updated Copyright
berndl authored
813 (mapcar (function (lambda (elem)
814 (car elem)))
815 ecb-buildin-layouts)
816 'member)
eb96352 Added ecb-string< and ecb-string= with a ignore-case arg and replaces…
berndl authored
817 'ecb-string<))
f43971f naming and managing layouts by name instead by number
berndl authored
818 (layout-name nil))
819 (if (= (length new-layout-list) 0)
820 (ecb-error "There are no layouts to delete!")
821 (setq layout-name (ecb-choose-layout-name new-layout-list t)))
822 (with-temp-file (expand-file-name ecb-create-layout-file)
823 (erase-buffer)
824 (if (file-readable-p (expand-file-name ecb-create-layout-file))
825 (insert-file-contents (expand-file-name ecb-create-layout-file))
826 (ecb-error "This layout is not defined in %s!" ecb-create-layout-file))
827 (goto-char (point-min))
828 (if (re-search-forward (concat "^(ecb-layout-define +"
829 "\"" layout-name "\".+$")
830 nil t)
831 (progn
832 ;; Deleting the layout definition in the file
833 ;; `ecb-create-layout-file'.
834 (beginning-of-line)
835 (delete-region (match-beginning 0)
836 (progn
837 (forward-sexp)
838 (point)))
839 (kill-line)
840 ;; undefining the function and aliases.
841 (ecb-layout-undefine layout-name))
842 (ecb-error "This layout is not defined in %s!" ecb-create-layout-file)))))
843
473b355 finishing the layout creating also for XEmacs
berndl authored
844 (defun ecb-create-layout-debug ()
01acd14 Making the docstrings of the customizable options and the interactive…
berndl authored
845 "Debugging command for the ECB-developers."
473b355 finishing the layout creating also for XEmacs
berndl authored
846 (interactive)
847 (message "Layout-Debug: Type: %s, Factor: %s"
848 (ecb-create-layout-buffer-type)
849 (ecb-create-layout-buffer-factor)))
850
5138981 Fixed a bug when canceling the layout
berndl authored
851 ;; Klaus Berndl <klaus.berndl@sdm.de>: Cause of the magic autostart stuff of
852 ;; the advice-package we must disable at load-time all these advices!!
853 ;; Otherwise would just loading ecb (not activating!) activate each advice
854 ;; AFTER the FIRST usage of our advices!!
855 (ad-disable-advice 'delete-frame 'after 'ecb-create-layout)
856 (ad-disable-advice 'delete-frame 'before 'ecb-create-layout)
857 (ad-activate 'delete-frame)
858
859
d1db9e5 ecb-bytecomp.el was renamed to silentcomp.el - an ECB independent pac…
berndl authored
860 (silentcomp-provide 'ecb-create-layout)
e8c3693 first impl. of interactive creating of new layouts
berndl authored
861
862 ;; ecb-help.el ends here
Something went wrong with that request. Please try again.