-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecb-layout.el
6078 lines (5467 loc) · 298 KB
/
ecb-layout.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; ecb-layout.el --- layout for ECB
;; Copyright (C) 2000 - 2005 Jesper Nordenberg,
;; Klaus Berndl,
;; Kevin A. Burton,
;; Free Software Foundation, Inc.
;; Author: Jesper Nordenberg <mayhem@home.se>
;; Klaus Berndl <klaus.berndl@sdm.de>
;; Kevin A. Burton <burton@openprivacy.org>
;; Maintainer: Klaus Berndl <klaus.berndl@sdm.de>
;; Keywords: browser, code, programming, tools
;; Created: 2000
;; This program is free software; you can redistribute it and/or modify it under
;; the terms of the GNU General Public License as published by the Free Software
;; Foundation; either version 2, or (at your option) any later version.
;; This program is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
;; details.
;; You should have received a copy of the GNU General Public License along with
;; GNU Emacs; see the file COPYING. If not, write to the Free Software
;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;; $Id: ecb-layout.el,v 1.290 2010/03/02 12:02:28 berndl Exp $
;;; Commentary:
;;
;; Contains functions for settings the ECB layout.
;;
;; This file is part of the ECB package which can be found at:
;; http://ecb.sourceforge.net
;; This file has been re-implemented by Klaus Berndl <klaus.berndl@sdm.de>.
;; What has been done:
;; Completely rewritten the layout mechanism for better customizing, adding
;; new layouts, better redrawing and more straightforward code.
;; 1. Now all user-layouting is done by customizing the new option
;; `ecb-layout-name' or by the command `ecb-change-layout'. The function
;; `ecb-redraw-layout' (formally known as 'ecb-set-layout) can still be
;; called interactively. But it just redraws the layout specified in
;; `ecb-layout-name'. All changes to the layout must be made by customizing
;; this new option. Please read the very detailed comment of
;; `ecb-layout-name'!
;; 2. Adding new layouts is now much easier and more straightforward: We have
;; now a main core-layout function (`ecb-redraw-layout-full') which is the
;; "environment" for the specific "layout-functions". The core function
;; does first some layout independent actions, then calls the
;; "layout-function" for the name which has been set in `ecb-layout-name'
;; and after that it does some layout independent actions again (see the
;; comments in this function). See the macro `ecb-layout-define' and the
;; command `ecb-create-new-layout'!
;;
;; Background-info: For each layout-type (ecb-windows left, right, top and
;; left-right) there is one function:
;; 'ecb-delete-window-ecb-windows-[left|right|top|leftright]'.
;; These functions follow these guide-lines:
;; - Preconditions for these functions:
;; + the edit-area is splitted - at least in two edit-windows
;; + The function gets two arguments: The window to delete (if nil then the
;; current window has to be deleted) and the list of all current
;; edit-windows.
;; + These functions are always(!) called with deactivated advices of
;; `delete-window' function.
;; + These functions can only use `delete-window' of the set of maybe
;; adviced window functions, because of a bug in advice.el only one
;; function´s advice can be deactivated within a advice itself!
;; - What must they do: Doing the appropriate action (e.g.
;; `ecb-delete-window-ecb-windows-left' must delete the window. This action
;; must be done appropriate for the current ECB-layout type (see
;; postconditions)
;; - Postcondition of these functions:
;; + The named edit-window must be deleted and all ecb-windows in the
;; ecb-frame must have the layout like before the delete.
;; + If the current window has been deleted then point must reside after
;; deletion in the next edit-window in a circular meaning (i.e. if the
;; last edit-window has been deleted, point must stay afterwards in the
;; first edit-window). If a window unequal the current window has been
;; deleted point must stay in the window before deletion at the same
;; place.
;;
;; New adviced intelligent window-functions as replacement for these originals:
;; - `other-window'
;; - `delete-window'
;; - `delete-other-windows'
;; - `delete-windows-on'
;; - `split-window-horizontally'
;; - `split-window-vertically'
;; - `split-window'
;; - `display-buffer'
;; - `switch-to-buffer'
;; - `switch-to-buffer-other-window'
;; - `other-window-for-scrolling'
;; - `balance-windows'
;; The behavior of the adviced functions is:
;; - All these function behaves exactly like their corresponding original
;; functions but they always act as if the edit-window(s) of ECB would be the
;; only window(s) of the ECB-frame. So the edit-window(s) of ECB seems to be
;; a normal Emacs-frame to the user.
;; - If a persistent compile-window is used all buffers for which
;; `ecb-compilation-buffer-p' returns not nil are handled in the
;; compile-window!
;;
;;; History
;;
;; For the ChangeLog of this file see the CVS-repository. For a complete
;; history of the ECB-package see the file NEWS.
;;; Code:
(eval-when-compile
(require 'silentcomp))
(require 'ecb-util)
(require 'ecb-common-browser)
;;(require 'ecb-speedbar)
(require 'ecb-compilation)
(require 'ecb-create-layout)
(require 'ecb-navigate)
;; XEmacs
(silentcomp-defvar scrollbars-visible-p)
(silentcomp-defun window-displayed-height)
(silentcomp-defvar pre-display-buffer-function)
(silentcomp-defvar split-width-threshold)
(silentcomp-defvar split-width-threshold)
(silentcomp-defun popup-menu-and-execute-in-window)
(silentcomp-defvar modeline-map)
(silentcomp-defun modeline-menu)
;; for the display-buffer stuff of XEmacs
(silentcomp-defun last-nonminibuf-frame)
(silentcomp-defun check-argument-type)
(silentcomp-defun buffer-dedicated-frame)
(silentcomp-defun display-buffer-1)
(silentcomp-defun frame-property)
(silentcomp-defun window-leftmost-p)
(silentcomp-defun window-rightmost-p)
(silentcomp-defun window-parent)
(silentcomp-defun window-previous-child)
(silentcomp-defun window-next-child)
(silentcomp-defun window-pixel-edges)
(silentcomp-defun window-pixel-height)
(silentcomp-defun record-buffer)
(silentcomp-defun push-window-configuration)
(silentcomp-defun set-frame-property)
(silentcomp-defvar temp-buffer-shrink-to-fit)
;; Emacs
(silentcomp-defvar scroll-bar-mode)
;; only Emacs 21 has this
(silentcomp-defvar window-size-fixed)
;;(silentcomp-defun fit-window-to-buffer)
(silentcomp-defvar temp-buffer-resize-mode)
(silentcomp-defun temp-buffer-resize-mode)
(silentcomp-defun modify-frame-parameters)
;; Emacs 21
(silentcomp-defvar grep-window-height)
(eval-when-compile
;; to avoid compiler grips
(require 'cl))
(defvar ecb-layouts-reload-needed t)
(defun ecb-load-layouts ()
"Load all defined layouts"
(when ecb-layouts-reload-needed
(require 'ecb-layout-defs)
(if (file-readable-p ecb-create-layout-file)
(load-file ecb-create-layout-file))
(setq ecb-layouts-reload-needed nil)))
(defgroup ecb-layout nil
"Settings for the screen-layout of the Emacs code browser."
:group 'ecb
:prefix "ecb-")
(defgroup ecb-compilation nil
"Settings for the compile window of ECB."
:group 'ecb-layout
:prefix "ecb-")
(defconst ecb-layout-option-set-function
(function (lambda (symbol value)
(set symbol value)
;; we must check this because otherwise the layout would be drawn
;; if we have changed the initial value regardless if ECB is
;; activated or not.
(when (and (boundp 'ecb-minor-mode)
ecb-minor-mode
(frame-live-p ecb-frame))
(let ((curr-frame (selected-frame)))
(unwind-protect
(progn
(select-frame ecb-frame)
(ecb-redraw-layout-full))
(select-frame curr-frame)))))))
(defcustom ecb-select-edit-window-on-redraw nil
"*Select the first edit window on `ecb-redraw-layout'."
:group 'ecb-layout
:type 'boolean)
(defcustom ecb-new-ecb-frame nil
"*Create a new frame at activation time of ECB."
:group 'ecb-layout
:group 'ecb-most-important
:type 'boolean)
(defcustom ecb-activate-before-new-frame-created-hook nil
"*Hook run before the new ECB-frame is created.
This has only an effect if `ecb-new-ecb-frame' is not nil \(otherwise this
hook is not evaluated)."
:group 'ecb-layout
:type 'hook)
(defvar ecb-last-selected-layout nil
"Name of that layout which was current direct before switching to another
layout.")
;; TODO: Klaus Berndl <klaus.berndl@sdm.de>: UPDATE the layout-list in the docstring...
(defcustom ecb-layout-name "left8"
"*Select a window layout of ECB.
Value is any arbitrary string. There are four different types of layouts:
left, right, top and left-right, which means the location of the
ECB-tree-windows in the ECB-frame. Currently there are 20 predefined layouts;
names see below. You can savely try out any of them by changing this value and
saving it only for the current session. If you are sure which layout you want
you can save it for future sessions. To get a picture of the layout for name
<name> call `ecb-show-layout-help'.
Currently available layouts:
+ Left layouts:
left1 left2 left3 left4 left5 left6 left7 left8 left9 left10 left11 left12
left13 left14 left15
+ Right layouts:
right1
+ Top layouts:
top1 top2
+ Left-right layouts:
leftright1 leftright2 leftright3
Regardless of the settings you define here: If you have destroyed or
changed the ECB-screen-layout by any action you can always go back to this
layout with `ecb-redraw-layout'"
:group 'ecb-layout
:group 'ecb-most-important
:initialize 'custom-initialize-default
:set (function (lambda (symbol value)
(ecb-load-layouts)
(if (fboundp (intern (format "ecb-layout-function-%s"
value)))
(progn
(setq ecb-last-selected-layout ecb-layout-name)
(funcall ecb-layout-option-set-function
symbol value))
(ecb-error "There is no layout with name %s available!"
value))))
:type 'string)
(defun ecb-enable-temp-buffer-shrink-to-fit (arg)
"Enables `temp-buffer-resize-mode' \(GNU Emacs) rsp.
`temp-buffer-shrink-to-fit' \(XEmacs) when a comile-window is used. When the
compile-window is disabled or when ECB is deactivated then the old state of
these modes/variables is restored."
(if arg
(progn
;; store old value if not already done
(or (get 'ecb-enable-temp-buffer-shrink-to-fit
'ecb-old-temp-buffer-shrink-to-fit)
(put 'ecb-enable-temp-buffer-shrink-to-fit
'ecb-old-temp-buffer-shrink-to-fit
(cons 'stored
(if ecb-running-xemacs
temp-buffer-shrink-to-fit
temp-buffer-resize-mode))))
;; now we activate temp-buffer-shrinking
(if ecb-running-xemacs
(setq temp-buffer-shrink-to-fit t)
(temp-buffer-resize-mode 1))
)
;; reset to the original value
(and (get 'ecb-enable-temp-buffer-shrink-to-fit
'ecb-old-temp-buffer-shrink-to-fit)
(if ecb-running-xemacs
(setq temp-buffer-shrink-to-fit
(cdr (get 'ecb-enable-temp-buffer-shrink-to-fit
'ecb-old-temp-buffer-shrink-to-fit)))
(temp-buffer-resize-mode
(if (cdr (get 'ecb-enable-temp-buffer-shrink-to-fit
'ecb-old-temp-buffer-shrink-to-fit))
1
-1))))
(put 'ecb-enable-temp-buffer-shrink-to-fit
'ecb-old-temp-buffer-shrink-to-fit
nil)))
(defcustom ecb-compile-window-height nil
"*Height of the persistent compilation-window of ECB.
If you want a compilation window shown at the bottom of the ECB-layout
then set here the height of it \(Default is a height of 5). If you redraw the
current layout with `ecb-redraw-layout' then the compilation window (if any)
has the height you set here. If the number is less than 1.0 the height is a
fraction of the frame height.
If you do not set a persistent compilation window then doing a compilation or
displaying temp-buffers \(e.g. *Help*-buffers) splits temporally the edit
window vertically if the edit window is not splitted already or uses another
edit window temporally for compilation output if the edit window is already
splitted. This is the recommended value for this option because this is the
standard-behavior of Emacs.
Beware: If you set a persistent compilation window then ECB displays all buffers
for which `ecb-compilation-buffer-p' returns not nil in that persistent
compilation window. If a buffer which should being displayed there is not
displayed there then try to modify the options `ecb-compilation-buffer-names',
`ecb-compilation-major-modes' or `ecb-compilation-predicates' \(in this
sequence).
See also the options `ecb-compile-window-temporally-enlarge' and
`ecb-enlarged-compilation-window-max-height' and also the command
`ecb-toggle-compile-window-height'!
ECB offers the functionality of such a persistent compile-window regardless if
the special ECB-windows are visible or not \(see the command
`ecb-toggle-ecb-windows').
Regardless of the settings you define here: If you have destroyed or
changed the ECB-screen-layout by any action you can always go back to this
layout with `ecb-redraw-layout'"
:group 'ecb-compilation
:group 'ecb-most-important
:initialize 'custom-initialize-default
;; we can not use here `ecb-layout-option-set-function' because here we
;; must call `ecb-redraw-layout-full' with NO-ECB-WINDOWS depending on the
;; value of `ecb-windows-hidden-state'! Same for `ecb-compile-window-width'. If
;; this is necessary for other options too then we should
;; `ecb-layout-option-set-function' to a function with an additional
;; parameter which decides if ecb-window-hidden should be used for
;; NO-ECB-WINDOWS or not.
:set (function (lambda (symbol value)
;; Emacs < 22 has some bugs concerning `windows-size-fixed'
;; so we must disable window-fixing.
(and (not ecb-running-gnu-emacs-version-22) (ecb-set-window-size-fixed nil))
(set symbol value)
;; we must check this because otherwise the layout would be
;; drawn if we have changed the initial value regardless if
;; ECB is activated or not.
(when (and (boundp 'ecb-minor-mode)
ecb-minor-mode
(frame-live-p ecb-frame))
(ecb-enable-temp-buffer-shrink-to-fit value)
(let ((curr-frame (selected-frame)))
(unwind-protect
(progn
(select-frame ecb-frame)
(ecb-redraw-layout-full nil nil nil
ecb-windows-hidden-state))
(select-frame curr-frame))))))
:type '(radio (const :tag "No compilation window" nil)
(number :tag "Window height" :value 6)))
(defcustom ecb-compile-window-width 'frame
"*Width of the compile-window.
Possible values are 'frame and 'edit-window.
With 'frame the compile-window looks like:
-------------------------------------------------------
| | |
| Directories | |
| | |
|--------------| edit-window(s) |
| | |
| Methods | |
| | |
-------------------------------------------------------
| |
| Compilation |
| |
-------------------------------------------------------
With 'edit-window the compile-window looks like:
-------------------------------------------------------
| | |
| Directories | |
| | |
|--------------| edit-window(s) |
| | |
| Methods | |
| | |
| |---------------------------------------
| | |
| | Compilation |
| | |
-------------------------------------------------------
This option takes only effect if `ecb-compile-window-height' is not nil!"
:group 'ecb-compilation
:group 'ecb-most-important
:initialize 'custom-initialize-default
:set (function (lambda (symbol value)
;; Emacs < 22 has some bugs concerning `windows-size-fixed'
;; so we must disable window-fixing.
(and (not ecb-running-gnu-emacs-version-22) (ecb-set-window-size-fixed nil))
(set symbol value)
;; we must check this because otherwise the layout would be
;; drawn if we have changed the initial value regardless if
;; ECB is activated or not.
(when (and (boundp 'ecb-minor-mode)
ecb-minor-mode
(frame-live-p ecb-frame))
(let ((curr-frame (selected-frame)))
(unwind-protect
(progn
(select-frame ecb-frame)
(ecb-redraw-layout-full nil nil nil
ecb-windows-hidden-state))
(select-frame curr-frame))))))
:type '(radio (const :tag "Width of ECB-frame" :value frame)
(const :tag "Width of edit-window" :value edit-window)))
(defcustom ecb-change-layout-preserves-compwin-state t
"*Changing the layout preserves the state of the compile-window.
This is for example useful if the user toggles between several layouts \(see
`ecb-toggle-layout') and wants to preserve the hidden-state of the
compile-window."
:group 'ecb-compilation
:type 'boolean)
(defcustom ecb-compile-window-temporally-enlarge 'after-display
"*Let Emacs temporally enlarge the compile-window of the ECB-layout.
This option has only an effect if `ecb-compile-window-height' is not nil!
The following values are possible:
- 'after-display: After displaying a \"compilation-buffer\" \(in the sense of
`ecb-compilation-buffer-p'!) in the compile-window of ECB. For the max.
height of the enlarged compile-window see the option
`ecb-enlarged-compilation-window-max-height'.
- 'after-selection: selecting the `ecb-compile-window' auto. enlarges it and
de-selecting \(means leaving `ecb-compile-window') auto. shrinks it.
Enlarging and shrinking the `ecb-compile-window' is done with
`ecb-toggle-compile-window-height'. See also the documentation of this
function!
- 'both: The combination of 'after-display and 'after-selection.
- nil: ECB fixes always the height of the `ecb-compile-window' at the value of
`ecb-compile-window-height'.
To restore the ECB-layout after such a buffer-enlarge just call
`ecb-toggle-compile-window-height' or `ecb-redraw-layout'."
:group 'ecb-compilation
:type '(radio (const :tag "After displaying a buffer in the compile-window"
:value after-display)
(const :tag "After selecting the compile window"
:value after-selection)
(const :tag "Both of them" :value both)
(const :tag "Never" :value nil)))
(defcustom ecb-maximize-ecb-window-after-selection nil
"*If not nil maximize current tree-window after selection.
When selecting another not-tree-window after such an automatic maximizing all
tree-windows of current layout are displayed again. But a tree-window is not
maximized if either a node has been selected via primary- oder secondarc
mouse-button or the popup-menu of that tree-buffer has been opened."
:group 'ecb-layout
:type 'boolean)
(defcustom ecb-maximize-next-after-maximized-select nil
"*Maximizes the next logical tree-window after a maximized node-selection.
Selecting a node in a maximized tree-window is handled very smart by ECB:
If a tree-buffer-name is not contained in this option then selecting a node in
this maximized tree-buffer automatically \"minimizes\" that tree-window \(i.e.
displays all windows of the current layout) so the user can perform the next
logical step \(e.g. the next logical step after selecting a directory in the
directories-buffer is to select a source-file - therefore the sources-buffer
of current layout has to be displayed - if the current layout contains one;
the next logical step of selecting a source-file is probably to jump to a
certain tag via the methods-buffer).
If a tree-buffer-name is contained in this option then selecting a node in
this tree-buffer automatically maximizes the next logical tree-window \(e.g.
directories --> sources, sources/history --> methods). But if the current
maximized tree-buffer is also contained in the option
`ecb-tree-do-not-leave-window-after-select' \(see also the tree-buffer-command
`ecb-toggle-do-not-leave-window-after-select' which is bound to `C-t' in each
tree-buffer) then ECB does *not* maximize the next logical tree-window but
point stays in the currently maximized tree-buffer so for example the user can
select more than one node \(e.g. more than one source-file from the
sources-buffer.
The tree-buffer-name can either be defined as plain string or with a symbol
which contains the buffer-name as value. The latter one is recommended for the
builtin ECB-tree-buffers because then simply the related option-symbol can be
used \(e.g. `ecb-directories-buffer-name', `ecb-sources-buffer-name' or
`ecb-history-buffer-name').
In future versions this option will probably also allow to define the next
logical tree-buffer for a tree-buffer - currently this is hard-coded as
follows:
- directories --next-logical--> sources
- sources --next-logical--> methods
- history --next-logical--> methods."
:group 'ecb-layout
:type '(repeat (choice :menu-tag "Buffer-name"
(string :tag "Buffer-name as string")
(symbol :tag "Symbol holding buffer-name"))))
;; A value of never makes no sense because it is not much effort to prevent
;; all interactive shrinking commands (incl. mouse-commands) from shrinking it
;; below ecb-compile-window-height and it is also not worth. IMHO preventing
;; in non-interactive calls and allowing interactively is the best choice.
;; Allowing always is also possible and easy to implement.
(defcustom ecb-compile-window-prevent-shrink-below-height t
"*Allow the compile-window to be shrunken below its height.
A non nil value means ECB prevents the compile-window from being shrunken
below the threshold of `ecb-compile-window-height' by displaying temp-buffers
\(e.g. *Help* etc.) or after running compilations or greps. But interactively
it is always allowed to shrink it to every height!
If nil then ECB does nothing to prevent being shrunken below the value of
`ecb-compile-window-height'.
Default is t."
:group 'ecb-compilation
:type 'boolean)
(defcustom ecb-enlarged-compilation-window-max-height 'best
"*The max height of the compile-window after enlarging it.
The max height of the compilation window after enlarged by
`ecb-toggle-compile-window-height'. The following values are allowed:
'best:
ECB fits the height of the compile-window exactly to the size of its current
contents but never shrinks below the value of `ecb-compile-window-height' or
enlarges over the half of the frame-height of the ECB-frame. The values of the
options `compilation-window-height' and `temp-buffer-max-height' are taken
into account dependent of the current `major-mode' of the buffer in the
compile-window: If `compilation-mode' then `compilation-window-height' is used
otherwise `temp-buffer-max-height'.
'half:
1/2 the frame-height of the ECB-frame
Any number:
Max height in lines. If the number is less than 1.0 the height is a fraction
of the frame height \(e.g. 0.33 results in a max-height of 1/3 the
frame-height)."
:group 'ecb-compilation
:type '(radio (const :tag "Compute best height"
:value best)
(const :tag "1/2 the frame height)"
:value half)
(number :tag "Height" :value 0.3)))
(defcustom ecb-scroll-other-window-scrolls-compile-window nil
"*`scroll-other-window' scrolls always the compile-window.
For all details about the scroll-behavior of `scroll-other-window' see the
advice documentation of `other-window-for-scrolling'."
:group 'ecb-compilation
:type 'boolean)
(defcustom ecb-ignore-special-display 'compile-window
"*Ignore special-display-handling.
This means, that all values of `display-buffer-alist',
`display-buffer-alist' and `display-buffer-alist' are ignored
- only when persistent compile window is used - i.e. if
`ecb-compile-window-height' is not nil - this is the default value.
- always when ECB is active - that means no special-display-handling of
buffers when ECB is active
- never, i.e. special-dislay-handling depends on the values of the options
`display-buffer-alist', `display-buffer-alist' and
`display-buffer-alist'."
:group 'ecb-layout
:type '(radio (const :tag "When a persistent compile-window is used"
:value compile-window)
(const :tag "Always" :value always)
(const :tag "Never" nil)))
(defsubst ecb-ignore-special-display ()
(or (equal ecb-ignore-special-display 'always)
(and (equal ecb-ignore-special-display 'compile-window)
ecb-compile-window-height)))
(defcustom ecb-ignore-pop-up-frames 'compile-window
"*Ignore setting of option `pop-up-frames'.
This means, that a value of not nil for `pop-up-frames' is ignored
- only when persistent compile window is used - i.e. if
`ecb-compile-window-height' is not nil - this is the default value.
- always when ECB is active - that means no pop-up-frames when ECB is active
- never, i.e. pop-up-frames is fully active when set."
:group 'ecb-layout
:type '(radio (const :tag "When a persistent compile-window is used"
:value compile-window)
(const :tag "Always" :value always)
(const :tag "Never" nil)))
(defsubst ecb-ignore-pop-up-frames ()
(or (equal ecb-ignore-pop-up-frames 'always)
(and (equal ecb-ignore-pop-up-frames 'compile-window)
ecb-compile-window-height)))
(defcustom ecb-ignore-display-buffer-function 'always
"*Adviced `display-buffer' ignores `display-buffer-alist'.
This means, that the adviced version of `display-buffer' ignores the value of
`display-buffer-alist' when called for the `ecb-frame'. If this variable
should not be ignored then the function of `display-buffer-alist' is
completely responsible which window is used for the buffer to display - no
smart ECB-logic will help to deal best with the ECB-window-layout! You can
define if and when `display-buffer-alist' should be ignored:
- only when persistent compile window is used - i.e. if
`ecb-compile-window-height' is not nil
- always when ECB is active - that means ignore when ECB is active otherwise
not - this is the default value
- never, the adviced version of `display-buffer' always uses the value of
`display-buffer-alist' if the value is a function."
:group 'ecb-layout
:type '(radio (const :tag "When a persistent compile-window is used"
:value compile-window)
(const :tag "Always" :value always)
(const :tag "Never" nil)))
(defsubst ecb-ignore-display-buffer-function ()
(or (equal ecb-ignore-display-buffer-function 'always)
(and (equal ecb-ignore-display-buffer-function 'compile-window)
ecb-compile-window-height)))
(defcustom ecb-split-edit-window-after-start 'before-deactivation
"*Sets how and if the edit window should be splitted after ECB-start.
But be aware: This option determines only if and how the edit-window should be
splitted at start-time of ECB. There are five different values allowed for
this option:
- nil: Do not split the edit-area of ECB after activation, i.e. there will be
only one edit-window after starting ECB.
- 'horizontal: Split the edit-area in 2 edit-windows side by side.
- 'vertical: Split the edit-area in 2 edit-windows, one above the other.
- 'before-activation: Split the edit-area as before the ECB-start, i.e. the
edit-area will have after start a window-layout as the whole frame had
before the start of ECB.
- 'before-deactivation: Split the edit-area into a window-layout ECB had in
its edit-area direct before the ECB-deactivation. This value preserves the
full state between activations of ECB, i.e. the visibility of the
ECB-windows, the visibility of a compile-window and also the full
split-state of the edit-area. But this can only be done if important
layout-options have not been changed in the meanwhile. These are the options
`ecb-layout-name', `ecb-compile-window-height', `ecb-compile-window-width',
`ecb-windows-width' and `ecb-windows-height'.
Default value is 'before-deactivation.
Some remarks to the value 'before-activation: If this value has been set then
ECB needs four permanent adivces even when ECB is deactivated: `split-window',
`delete-window', `delete-other-windows' and `set-window-configuration'. But
these advices do not change any behavior of these functions but only storing
in an internal ECB-variable the facts that a window has been splitted or
deleted etc. In addition to this these advices are 100% error-save, means the
functionality of the original functions will be performed in every\(!) case
even if within the advice an error occurs \(but normally there can no errors
occur in these advices because they are very simple). Conclusion: If you want
really all ECB-advices being disabled after deactivating ECB then you have to
set this option to other values then 'before-activation. But setting this
variable to this value is really completely save."
:group 'ecb-layout
:type '(radio (const :tag "Split as before ECB-start"
:value before-activation)
(const :tag "Split as before last ECB-deactivation"
:value before-deactivation)
(const :tag "Split horizontally"
:value horizontal)
(const :tag "Split vertically"
:value vertical)
(const :tag "Do not split"
:value nil)))
(defcustom ecb-windows-width 0.33
"*The width of the ECB windows in columns for left- and right layouts.
If the number is less than 1.0 the width is a fraction of the frame width."
:group 'ecb-layout
:initialize 'custom-initialize-default
:set ecb-layout-option-set-function
:type 'number)
(defcustom ecb-windows-height 0.33
"*The height of the ECB windows in lines for top layouts.
If the number is less than 1.0 the width is a fraction of the frame height."
:group 'ecb-layout
:initialize 'custom-initialize-default
:set ecb-layout-option-set-function
:type 'number)
(defcustom ecb-fix-window-size nil
"*Fix size of the ECB-windows/buffers even after frame-resizing.
The fix type \(valid values are nil, t, width and height) can either be set on
a layout-basis \(means a different value for each layout) or one value can be
set for all layouts. For the latter case there is an additional value 'auto
which choose autom. the senseful fix-type depending on the current
layout-type: For top-layouts the fix-type 'height and for all other
layout-types the fix-type 'width.
For a detailed description of the valid values see documentation of
`window-size-fixed' which is newly introduced in GNU Emacs 21 and is only
available there. Therefore this option takes only effect with GNU Emacs >= 21.
This option has no effect with XEmacs because it does not support the feature
`window-size-fixed'.
Note1: Manually resizing the ECB-windows via `enlarge-window',
`shrink-window', `mouse-drag-vertical-line' and `mouse-drag-mode-line' is
still possible even if the window-sizes are fixed for frame-resizing!
Note2: The description of `window-size-fixed' in the elisp-info-manual is more
detailed than the description offered by \[C-h v]!
Note3: With Emacs < 22 there seems to be no distinction between 'width,
'height and t. Therefore this option takes no effect \(means all ecb-windows
have always unfixed sizes) with Emacs < 22 if `ecb-compile-window-height' is
not nil.
Per default no window-size fixing has been done."
:group 'ecb-directories
:initialize 'custom-initialize-default
:set (function (lambda (sym value)
(set sym value)
(ecb-set-window-size-fixed
(ecb-get-window-fix-type ecb-layout-name))))
:type '(radio (choice :tag "Fix type for all layouts"
:menu-tag "Fix type for all layouts"
(const :tag "Automatic" :value auto)
(const :tag "Fix only width" :value width)
(const :tag "Fix only height" :value height)
(const :tag "Fix both" :value t)
(const :tag "No fixing" :value nil))
(repeat :tag "With these layouts"
(cons (string :tag "Layout name")
(choice :tag "Fix type"
:menu-tag "Fix type for all layouts"
(const :tag "Fix only width" :value width)
(const :tag "Fix only height" :value height)
(const :tag "Fix both" :value t)
(const :tag "No fixing" :value nil))))))
(defun ecb-get-window-fix-type (layout-name)
"Determine which value of `window-size-fixed' we must set in all ecb-buffers
of layout LAYOUT-NAME."
(if (symbolp ecb-fix-window-size)
(if (equal ecb-fix-window-size 'auto)
(if (equal (ecb-get-layout-type ecb-layout-name) 'top)
'height
'width)
ecb-fix-window-size)
(cdr (assoc layout-name ecb-fix-window-size))))
(defun ecb-set-window-size-fixed (fix)
"Set the buffer-local value of `window-size-fixed' in each visible
ecb-window to FIX. For Emacs < 22: If `ecb-compile-window-height' is not nil
then set always nil!"
(unless ecb-running-xemacs
(let ((l (ecb-canonical-ecb-windows-list)))
(dolist (w l)
(with-current-buffer (window-buffer w)
(setq window-size-fixed (if (and (not ecb-running-gnu-emacs-version-22)
ecb-compile-window-height)
nil
fix)))))))
(defmacro ecb-do-with-unfixed-ecb-buffers (&rest body)
"Evaluate BODY with unfixed size of all current-visible ecb-buffers and
ensure that at the end \(either after finishing of BODY or after an error
occurs during BODY) all now current visible ecb-buffers get the value of their
buffer-local `window-size-fixed' from the setting in `ecb-fix-window-size'."
`(unwind-protect
(progn
(ecb-set-window-size-fixed nil)
,@body)
(ecb-set-window-size-fixed (ecb-get-window-fix-type ecb-layout-name))))
(defmacro ecb-do-with-fixed-ecb-buffers (&rest body)
"Evaluate BODY with fixed size of all current-visible ecb-buffers and
ensure that at the end \(either after finishing of BODY or after an error
occurs during BODY) all now current visible ecb-buffers get the value of their
buffer-local `window-size-fixed' from the setting in `ecb-fix-window-size'."
`(unwind-protect
(progn
(ecb-set-window-size-fixed t)
,@body)
(ecb-set-window-size-fixed (ecb-get-window-fix-type ecb-layout-name))))
(defcustom ecb-other-window-behavior 'smart
"*The behavior of ECB concerning getting an \"other window\".
The following settings are possible:
'all:
ECB will cycle through all windows of the ECB-frame or scroll simply
the next window in the ECB-frame, means it behaves like the original
`other-window' rsp. the original `other-window-for-scrolling'.
'only-edit:
ECB will only cycle through the edit-windows of ECB or only
scroll another edit-window. If the selected window is not an edit-window
then it behaves like with value 'all.
'edit-and-compile:
Like 'only-edit plus the compile window if any. If the
selected window is neither an edit-window nor the compile-window then it
behaves like with value 'all.
'smart:
With this setting ECB tries to choose the `other-window'-destination or the
\"other window\" to scroll in a smart and intuitive way: If point is in one of
the edit-windows and if the edit-area is splitted then always the \"next\"
edit-window is choosen \(whereas the next edit-window of the last edit-window
is the first edit-window)- if the edit-area is unsplitted then the
compile-window is used if there is one. In the context of an
`other-window'-call the ARG of `other-window' will be taken into account.
If one of the special ecb-windows is selected then always the \"next\"
ecb-window is choosen \(whereas the next ecb-window of the last ecb-window is
the first ecb-window). In the context of an `other-window'-call the ARG of
`other-window' will be taken into account. If there is only one ecb-window
then ECB considers also the edit-windows!
If the compile-window is selected then always the last selected edit-window
will be used unless `other-window' has been called with a prefix-argument
unequal 1.
If there is an active minibuffer:
Regardless of the allowed values above ECB handles the situation of an active
minibuffer during a call to `other-window' or `scroll-other-window' like
follows:
If the minibuffer-window is selected then ECB always chooses the window
`minibuffer-scroll-window' points to \(when this variable is set, otherwise
the compile-window or the last selected edit-window is choosen) when the
called command is called to choose the 1. next window \(always true for
scrolling another window or true when `other-window' called without prefix-arg
or with prefix-arg equal 1). Otherwise the window ARG steps away is choosen
\(in case of `other-window).
If there is an active minibuffer but the minibuffer-window is not selected
then `other-window' and `scroll-other-window' behave like the original
version.
In addition to the allowed values above the value of this option can also be a
function:
This function gets seven arguments:
1. A canonical list of all currently visible windows of the `ecb-frame'
2. A canonical list of all currently visible edit-windows
3. A canonical list of all currently visible ecb-windows
4. The window-object of the compile-window if there is any.
5. The minibuffer-window of the ECB-frame if there is an active minibuffer.
5. The result of the function `ecb-where-is-point' - see the documentation
of this function for details.
6. An integer which indicates how many steps away from the current selected
window the \"other-window\ is. Is nil when this function is called in
another context then for `other-window'.
The function has to return a window-object which is then used as \"other
window\" for the command `other-window' or for scrolling another window
\(e.g. with `scroll-other-window').
This function has to handle all properly situations for itself.
`ecb-get-other-window-smart' is an example for such a function."
:group 'ecb-layout
:group 'ecb-most-important
:type '(radio (const :tag "Smart" :value smart)
(const :tag "All windows" all)
(const :tag "Only edit windows" only-edit)
(const :tag "Edit + compile window" edit-and-compile)
(function :tag "User defined" :value ignore)))
(defcustom ecb-advice-window-functions-signal-error nil
"*Signal an error if an adviced function can not do its job.
If not nil then an error is signaled if one of the adviced functions can not
do its job. So for example if the user tries to split the compile-window or an
ecb-tree-window or if one tries to switch to another buffer in one of the
ecb-tree-windows. For details see the documentation of each of the adviced
functions to get info when an error is signaled.
If this option is nil then no error is signaled but the called adviced
function does simply nothing.
Default is nil but it can also be useful to signal errors - so you see when
call a function in a situation which is not supported by this function."
:group 'ecb-layout
:type 'boolean)
(defcustom ecb-layout-always-operate-in-edit-window
'(switch-to-buffer)
"*Adviced window functions work always in the edit-window.
If we are in an ECB special buffer (methods, directories, etc), and any of the
adviced windowing functions is called interactively, we will select first an
edit-window according to the value of `ecb-mouse-click-destination'. This is
useful if you have any functions that use such functions and you don't want
them to fail with an error complaining that the current buffer can not be
split, or something similar.
Because this may not be desirable in all situations and for all adviced
functions this can be enabled separately for function where it is senseful. If
the symbol of an adviced function is contained in the value of this option,
then the edit-window is first selected otherwise either an error is reported
or some other special reaction (depends on
`ecb-advice-window-functions-signal-error'); see the documentation of the
adviced functions for this.
Per default this is only enabled for `switch-to-buffer'."
:group 'ecb-layout
:type '(set (const :tag "delete-window"
:value delete-window)
(const :tag "delete-other-windows"
:value delete-other-windows)
(const :tag "split-window-horizontally"
:value split-window-horizontally)
(const :tag "split-window-vertically"
:value split-window-vertically)
(const :tag "split-window"
:value split-window)
(const :tag "display-buffer"
:value display-buffer)
(const :tag "switch-to-buffer"
:value switch-to-buffer)))
(defcustom ecb-layout-window-sizes nil
"*Specifies the sizes of the ECB windows for each layout.
The easiest way \(and also the very strongly recommended way) to set this
option is to change the window sizes by dragging the window borders using
the mouse and then store the window sizes by calling the command
`ecb-store-window-sizes'. Next time the layout is redrawn the values stored in
this option will be used.
If `ecb-store-window-sizes' is used then the windows sizes are stored per
default as fractions of current frame-width and -height of the ecb-frame, so
the stored values will \"work\" for other frame sizes too. But if you call
`ecb-store-window-sizes' with a prefix-argument then the fixed values of
current width and height are stored!
If this option is set \"by hand\" \(i.e. not by `ecb-store-window-sizes') then
the following is important:
- Use always `customize-option', never `setq'!
- It is recommended to use fractions of frame-width and -height!.
- It is also recommended to use buffer-name-symbols instead of plain
buffer-names \(e.g. ecb-history-buffer-name instead of \" *ECB History*\")
- There must be an entry for each special ecb-buffer of that layout for which
the sizes are stored.
- The order of the sequence of the inserted window sizes doesn't matter
because each size-pair is assigned to a buffer-name the sizes belong to."
:group 'ecb-layout
:initialize 'custom-initialize-default
:set ecb-layout-option-set-function
:type '(repeat (cons :tag "Window layout"
(string :tag "Layout name")
(repeat :tag "Window sizes"
(cons (choice :tag "Buffer-name" :menu-tag "Buffer-name"
(string :tag "Buffer-name as string")
(symbol :tag "Symbol containing buffer-name"))
(cons (choice :tag "Width"
:menu-tag "Width"
(const :tag "Default value"
:value nil)
(number :tag "Custom size"))
(choice :tag "Height"
:menu-tag "Height"
(const :tag "Default value"
:value nil)
(number :tag "Custom size"))))))))
(defcustom ecb-redraw-layout-quickly nil
"If non-nil, we will attempt to redraw the layout quickly.
Please read also carefully the documentation of `ecb-redraw-layout'."
:type 'boolean
:group 'ecb-layout)