-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecb-file-browser.el
4763 lines (4215 loc) · 223 KB
/
ecb-file-browser.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-file-browser.el --- the file-browser of Emacs
;; Copyright (C) 2000 - 2005 Jesper Nordenberg,
;; Klaus Berndl,
;; Free Software Foundation, Inc.
;; Author: Jesper Nordenberg <[email protected]>
;; Klaus Berndl <[email protected]>
;; Maintainer: Klaus Berndl <[email protected]>
;; 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-file-browser.el,v 1.79 2009/05/16 13:24:19 berndl Exp $
;;; Commentary:
;; This file contains the code of the file-browser of ECB
(require 'ecb-util)
(require 'tree-buffer)
(require 'ecb-mode-line)
(require 'ecb-navigate)
(require 'ecb-face)
(require 'ecb-speedbar)
(require 'ecb-layout)
(require 'ecb-common-browser)
;; various loads
(require 'assoc)
(eval-when-compile
;; to avoid compiler grips
(require 'cl))
(eval-when-compile
(require 'silentcomp))
(silentcomp-defun ecb-speedbar-update-contents)
(silentcomp-defun vc-load-vc-hooks)
;; (silentcomp-defvar vc-svn-admin-directory)
(silentcomp-defun substring-no-properties)
(silentcomp-defun vc-find-root)
(silentcomp-defun vc-file-clearprops)
(silentcomp-defun vc-state)
(silentcomp-defvar dired-directory)
;;====================================================
;; Customization
;;====================================================
(defgroup ecb-directories nil
"Settings for the directories-buffer in the Emacs code browser."
:group 'ecb
:prefix "ecb-")
(defgroup ecb-sources nil
"Settings for the sources-buffers in the Emacs code browser."
:group 'ecb
:prefix "ecb-")
(defgroup ecb-history nil
"Settings for the history-buffer in the Emacs code browser."
:group 'ecb
:prefix "ecb-")
(defgroup ecb-version-control nil
"Settings for the version-control support in the ECB."
:group 'ecb
:prefix "ecb-")
(defcustom ecb-source-path nil
"*Paths where to find code sources.
Each path can have an optional alias that is used as it's display name. If no
alias is set, the path is used as display name.
Lisp-type of this option: The value must be a list L whereas each element of L
is either
- a simple string which has to be the full path of a directory \(this string
is displayed in the directory-browser of ECB) or
- a 2-element list whereas the first element is the full path of a directory
\(string) and the second element is an arbitrary alias \(string) for this
directory which is then displayed instead of the underlying directory."
:group 'ecb-directories
:group 'ecb-most-important
:initialize 'custom-initialize-default
:set (function (lambda (symbol value)
(set symbol value)
(if (and (boundp 'ecb-minor-mode)
ecb-minor-mode
(functionp 'ecb-update-directories-buffer))
(ecb-update-directories-buffer))))
:type '(repeat (choice :tag "Display type"
:menu-tag "Display type"
(directory :tag "Path")
(list :tag "Path with alias"
(directory :tag "Path")
(string :tag "Alias")))))
(defcustom ecb-add-path-for-not-matching-files '(t . nil)
"*Add path of a file to `ecb-source-path' if not already contained.
This is done during the auto. windows synchronization which happens if a file
is opened not via the file/directory-browser of ECB. In such a situation ECB
adds the path of the new file auto. to `ecb-source-path' at least temporally
for the current Emacs session. This option defines two things:
1. Should only the root-part \(which means for Unix-like systems always '/'
and for windows-like systems the drive) of the new file be added as
source-path to `ecb-source-path' or the whole directory-part? For
remote-files \(e.g. tramp, ange-ftp- or efs-files) the root-part is the
complete host-part + the root-dir at that host \(example:
/[email protected]:/ would be the root-part of
/[email protected]:/tmp/test.txt).
2. Should this path be added for future sessions too?
The value of this option is a cons-cell where the car is a boolean for 1. and
the cdr is a boolean for 2.
A value of not nil for the car \(1.) is reasonably if a user often opens files
not via the ECB-browser which are not located in any of the paths of
`ecb-source-path' because then only one path for each drive \(windows) or the
root-path \(unix) is added to the directory buffer of ECB."
:group 'ecb-directories
:type '(cons (boolean :tag "Add only root path")
(boolean :tag "Ask for saving for future sessions")))
(defvar ecb-source-path-functions nil
"List of functions to call for finding sources.
Each time the function `ecb-update-directories-buffer' is called, the
functions in this variable will be evaluated. Such a function must return
either nil or a list of strings where each string is a path.")
(defcustom ecb-display-default-dir-after-start t
"*Automatically display current default-directory after activating ECB.
If a file-buffer is displayed in the edit-window then ECB synchronizes its
tree-buffers to this file-buffer - at least if the option `ecb-basic-buffer-sync' it
not nil. So for this situation `ecb-display-default-dir-after-start' takes no
effect but this option is for the case if no file-buffer is displayed in the
edit-window after startup:
If true then ECB selects autom. the current default-directory after activation
even if no file-buffer is displayed in the edit-window. This is useful if ECB
is autom. activated after startup of Emacs and Emacs is started without a
file-argument. So the directory from which the startup has performed is auto.
selected in the ECB-directories buffer and the ECB-sources buffer displays the
contents of this directory."
:group 'ecb-directories
:type 'boolean)
(defcustom ecb-show-sources-in-directories-buffer '("left7" "left13"
"left14" "left15")
"*Show source files in directories buffer.
The value is either 'always or 'never or a list of layout-names for which
layouts sources should be displayed in the directories window."
:group 'ecb-directories
:initialize 'custom-initialize-default
:set (function (lambda (symbol value)
(set symbol value)
(if (and ecb-minor-mode
(functionp 'ecb-set-selected-directory)
ecb-path-selected-directory)
(ecb-set-selected-directory ecb-path-selected-directory t))))
:type '(radio (const :tag "Always" :value always)
(const :tag "Never" :value never)
(repeat :tag "With these layouts"
(string :tag "Layout name"))))
(defcustom ecb-directories-show-node-info '(if-too-long . path)
"*When to display which node-info in the directories-buffer.
Define which node info should be displayed after moving the mouse
over a node \(or after a shift click onto the node) in the
directories-buffer.
You can define \"when\" a node-info should be displayed:
- always: Node info is displayed by moving with the mouse over a node.
- if-too-long: Node info is only displayed by moving with the mouse over a
node does not fit into the window-width of the tree-buffer window.
In the ECB directories buffer this means also if a node is shortend or if
the node has an alias \(see `ecb-source-path').
- shift-click: Node info is only displayed after a shift click with the
primary mouse button onto the node.
- never: Node info is never displayed.
You can define \"which\" info should be displayed:
- name: Only the full node-name is displayed.
- path: The full-path of the node is displayed.
Do NOT set this option directly via setq but use always customize!"
:group 'ecb-directories
:type '(cons (choice :tag "When"
(const :tag "Always" :value always)
(const :tag "If too long" :value if-too-long)
(const :tag "After shift click" :value shift-click)
(const :tag "Never" :value never))
(choice :tag "What"
(const :tag "Node-name" :value name)
(const :tag "Full path" :value path))))
(defcustom ecb-directories-update-speedbar 'auto
"*Update an integrated speedbar after selecting a directory.
If not nil then an integrated speedbar will be updated after selecting a
directory in the ECB-directories-buffer so the speedbar displays the contents
of that directory.
Of course this option makes only sense if the integrated speedbar is displayed
in addition to the ECB-directories-buffer.
This option can have the following values:
- t: Always update speedbar.
- nil: Never update speedbar.
- auto: Update when senseful \(see scenarios below)
- <function>: A user-defined function. The function is called after a
directory is selected, gets the selected directory as argument and has to
return nil if the the integrated speedbar should NOT be updated.
Two example-scenarios where different values for this option can be senseful:
If `ecb-show-sources-in-directories-buffer' is not nil or you have a layout
where an ECB-sources-buffer is visible then you probably want to use the
ECB-directories-buffer \(and/or the ECB-sources-buffer) for directory- and
file-browsing. If you have in addition an integrated speedbar running then you
probably want to use speedbar instead of the ECB-methods-buffer for
source-content-browsing. In this case you probably want the speedbar not be
updated because you do not need speedbar reflecting the current-directory
contents but only the contents of the currently selected source-file and the
integrated speedbar updates itself autom. for the latter one!
If `ecb-show-sources-in-directories-buffer' is nil and there is also no
ECB-sources-buffer visible in the current layout then you probably want to use
an integrated speedbar for browsing directory-contents \(i.e. the files) and
file-contents \(instead of the ECB-methods-buffer for example). In this case
you probably want the speedbar updated because you need speedbar reflecting
the current-directory contents so you can select files.
The value 'auto \(see above) takes exactly these two scenarios into account."
:group 'ecb-directories
:type '(radio (const :tag "Always" :value t)
(const :tag "Never" :value nil)
(const :tag "Automatic" :value auto)
(function :tag "Custom function")))
(defun ecb-show-sources-in-directories-buffer-p ()
"Return not nil if in current layout sources are shown in the
directories-buffer."
(case ecb-show-sources-in-directories-buffer
(never nil)
(always t)
(otherwise
(and (listp ecb-show-sources-in-directories-buffer)
(member ecb-layout-name
ecb-show-sources-in-directories-buffer)))))
(defcustom ecb-cache-directory-contents '(("^/\\([^:/]*@\\)?\\([^@:/]*\\):.*" . 0)
(".*" . 50))
"*Cache contents of certain directories.
This can be useful if `ecb-source-path' contains directories with many files
and subdirs, especially if these directories are mounted net-drives \(\"many\"
means here something > 1000, dependent of the speed of the net-connection and
the machine). Or if it contains remote-source-paths which means paths in the
sense of tramp, ange-ftp or efs. For these directories actualizing the
sources- and/or directories- buffer of ECB \(if displayed in current layout!)
can slow down dramatically so a caching increases speed a lot.
The value of this option is a list where the each element is a cons-cell and
looks like:
\(<dir-regexp> . <filenumber threshold>)
<dir-regexp>: Regular expression a directory must match to be cached.
<filenumber threshold>: Number of directory contents must exceed this number.
A directory will only be cached if and only if the directory-name matches
one regexp of this option and its content-number exceeds the related
threshold AND the directory-name does not match and regexp of
`ecb-cache-directory-contents-not'!
The cache entry for a certain directory will be refreshed and actualized only
by using the POWER-click \(see `ecb-primary-secondary-mouse-buttons') in the
directories-buffer of ECB.
Default-value: ECB caches the contents of all remote directories regardless of
the size and all other directories if more than 50 entries are contained.
Examples:
An entry \(\"/usr/home/john_smith/bigdir*\" . 1000) means the contents of
every subdirectory of the home-directory of John Smith will be cached if the
directory contains more than 1000 entries and its name begins with \"bigdir\".
An entry \(\".*\" . 1000) caches every directory which has more than 1000
entries.
An entry \(\"^/\\\\\(\[^:/]*@\\\\)?\\\\\(\[^@:/]*\\\\):.*\" . 0) caches every
remote \(in the sense of tramp, ange-ftp or efs) directory regardless of the
number of entries.
Please note: If you want your home-dir being cached then you MUST NOT use
\"~\" because ECB tries always to match full path-names!"
:group 'ecb-directories
:group 'ecb-most-important
:type `(repeat (cons (regexp :tag "Directory-regexp")
(integer :tag "Filenumber threshold" :value 1000))))
(defcustom ecb-cache-directory-contents-not nil
"*Do not cache the contents of certain directories.
The value of this option is a list where the each element is a regular
expression a directory must match if it should not being cached.
If a directory-name matches at least one of the regexps of this option the
directory-contents will never being cached. See `ecb-cache-directory-contents'
to see when a directory will be cached.
This option can be useful when normally all directories with a certain amount
of content \(files and subdirs) should be cached but some special directories
not. This can be achieved by:
- setting `ecb-cache-directory-contents' to \(\".*\" . 500): Caches all
directories with more then 500 entries
- setting `ecb-cache-directory-contents-not' to a value which matches these
directories which should not being cached \(e.g. \(\"/usr/home/john_smith\")
excludes the HOME-directory of John Smith from being cached).
Please note: If you want your home-dir exclude from being cached then you MUST
NOT use \"~\" because ECB tries always to match full path-names!"
:group 'ecb-directories
:type `(repeat (regexp :tag "Directory-regexp")))
(defcustom ecb-ping-program "ping"
"Program to send network test packets to a host.
The set ping-program is used to test if a remote host of a remote
path \(e.g. a tramp-, ange-ftp- or efs-path) is accessible. See
also `ecb-ping-options'."
:group 'ecb-directories
:type 'string)
(defcustom ecb-ping-options
(append (cond ((memq system-type (list 'linux 'gnu/linux 'irix))
(list "-c" "2"))
((eq system-type 'windows-nt)
(list "-n" "2")))
(list "HOST"))
"List of options for the ping program.
These options have to ensure that the program set in `ecb-ping-program' only
emits as few as possible ICMP packets, ideally exactly 1. These options must
ensure the ping-program doesn't emit an endless sequence of packets!
These sequence of options must fit the required argument- and options-list of
the specified ping-program \(see `ecb-ping-program'). Therefore at least on of
these options must be the string HOST \(uppercase) which will be replaced
internally by ECB with that host-name the accessibility of this host
has to be tested. So ensure that this 'HOST'-option is in the right place of
the options-sequence - check the manual of your ping-program!
Default-value of this option is a list with just one element
HOST, which means the ping-program of `ecb-ping-program' will be
called with one argument which will be the host-name which should be
tested.
See also `ecb-ping-program'."
:group 'ecb-directories
:type '(repeat string))
(defcustom ecb-host-accessible-check-valid-time nil
"Time in seconds a cached accessible-state of a remote host is valid.
This option is a list where each element specifies how long for a certain
remote host the cached ping-state \(i.e. if the host is accessible or not)
should be valid. During this time-intervall ECB pings such a remote host only
once, all other checks use the cached value of that real check. But it the
cached value is older than the value of this option ECB will ping again.
Per default ECB discards after 1 minute the cached ping-state of each remote
host. But if you are sure that a certain remote host is always accessible
\(i.e. means in consequence that you are always online when working with ECB
and remote-paths) then add an entry to this option with a high valid-interval.
Examples: An entry \(\".*sourceforge.*\" . 3600) ensures that all remote hosts
machting the string \"sourceforge\" will only once pinged during one hour. Or
\(\".*\" . 300) would ensure that every remote host would be pinged only once
during 5 minutes."
:group 'ecb-directories
:type '(repeat (cons (regexp :tag "Remote host regexp")
(integer :tag "Valid interval"))))
(defcustom ecb-prescan-directories-for-emptyness 'unless-remote
"*Prescan directories for emptyness.
ECB does this so directories are displayed as empty in the directories-buffer
even without user-interaction \(i.e. in previous ECB-versions the emptyness of
a directory has been first checked when the user has clicked onto a
directory). ECB optimizes this check as best as possible but if a directory
contains a lot of subdirectories which contain in turn a lot of entries, then
expanding such a directory or selecting it would take of course more time as
without this check - at least at the first time \(all following selects of a
directory uses the cached information if its subdirectories are empty or not).
Therefore ECB performs this check stealthy \(see `ecb-stealthy-tasks-delay')
so normally there should no performance-decrease or additional waiting-time
for the user. There is one exception: For remote directories \(in the sense of
tramp, ange-ftp, or efs) this check can descrease performance even if
performed stealthy and interruptable. Therefore this option offers three
possible settings:
t: Switch on this feature
'unless-remote: Switch on this feature but not for remote directories. The
term \"remote\" means here directories which are used via tramp, ange-ftp or
efs. So mounted directories are counted not as remote directories here even
if such a directory is maybe hosted on a remote machine. But normally only
directories in a LAN are mounted so there should be no performance-problems
with such mounted directories.
nil: Switch off this feature completely.
The option `ecb-prescan-directories-exclude-regexps' offers are more fine
granularity to exclude certain directories from this prescan."
:group 'ecb-directories
:group 'ecb-most-important
:type '(radio (const :tag "Switch on" :value t)
(const :tag "Switch off for remote directories" :value unless-remote)
(const :tag "Switch off completely" :value nil)))
(defcustom ecb-prescan-directories-exclude-regexps nil
"*Which directories should be excluded from the empty-prescan.
If a directory matches any of the regexps of this option it will not be
prescanned for emptyness - This option takes only effect if
`ecb-prescan-directories-for-emptyness' is not nil."
:group 'ecb-directories
:type '(repeat (regexp :tag "Directory-regexp")))
(defsubst ecb-directory-should-prescanned-p (dir)
"Return not nil if DIR should be prescanned for emptyness.
The check is performed according to the settings in the options
`ecb-prescan-directories-for-emptyness' and
`ecb-prescan-directories-exclude-regexps'."
(and (or (equal t ecb-prescan-directories-for-emptyness)
(and (equal 'unless-remote ecb-prescan-directories-for-emptyness)
(not (ecb-remote-path dir))))
(not (ecb-match-regexp-list dir ecb-prescan-directories-exclude-regexps))))
(defcustom ecb-grep-function (cond ((fboundp 'lgrep)
'lgrep)
((fboundp 'igrep)
'igrep)
(t 'grep))
"*Function used for performing a grep.
The popup-menu of the tree-buffers \"Directories\", \"Sources\" and
\"History\" offer to grep the \"current\" directory:
- Directory-buffer: The grep is performed in the current popup-directory after
clicking the right mouse-button onto a node.
- Sources-buffer: The grep is performed in the current selected directory.
- History-buffer: The grep is performed in the directory of the current
popup-source after clicking the right mouse-button onto a node.
Conditions for such a function:
- The function is called interactively via `call-interactively'
- During the function-call the `default-directory' is temp. set to that
directory mentioned above with \"... is performed in ...\", i.e. the
function can use the value of `default-directory' to determine the directory
to grep.
- The function must read all it's arguments itself.
- The function is completely responsible for performing the grep itself and
displaying the results.
Normally one of the standard-grepping functions like `lgrep',
`grep' or `igrep' \(or some wrappers around it) should be used!"
:group 'ecb-directories
:group 'ecb-sources
:type 'function)
(defcustom ecb-grep-recursive-function (cond ((fboundp 'rgrep)
'rgrep)
((fboundp 'igrep-find)
'igrep-find)
(t 'grep-find))
"*Function used for performing a recursive grep.
For more Details see option `ecb-grep-function' and replace \"grep\" with
\"recursive grep\".
Normally one of the standard-grepping functions like `rgrep',
`grep-find' or `igrep-find' \(or some wrappers around it) should
be used!"
:group 'ecb-directories
:group 'ecb-sources
:type 'function)
(defcustom ecb-after-directory-change-hook nil
"*Hook which run directly after the selected directory has changed.
This means not onyl after a click onto a directory in the directory-window of
ECB but it means this hook runs always when the current directory changes
regardless of the trigger of this change. So for example it runs also when you
just switches from one buffer to another via `switch-to-buffer' or
`switch-to-buffer-other-window' and the directory of these filebuffers is
different but only when auto-synchronizing of the ECB-windows is on (see
`ecb-basic-buffer-sync'). It runs not when switching between buffers and the
associated files reside in the same directory.
Each function added to this hook will be called with two arguments: The
directory which was current _before_ the directory-change-trigger and the
directory which was now the current \(i.e. after the trigger).
Example: If you switch from a filebuffer \"~/.emacs\" to a filebuffer
\"/tmp/test.txt\" then the functions of this hook will be called with the
two arguments \"~\" and \"/tmp\"."
:group 'ecb-directories
:type 'hook)
(defcustom ecb-sources-perform-read-only-check 'unless-remote
"*Check if source-items in the tree-buffers are read-only.
If a sourcefile is read-only then it will be displayed with that face set in
the option `ecb-source-read-only-face'.
Because this check can be take some time if files are used via a mounted
net-drive ECB performs this check stealthy \(see `ecb-stealthy-tasks-delay')
so normally there should no performance-decrease or additional waiting-time
for the user. But to get sure this option offers three choices: t,
'unless-remote and nil. See `ecb-prescan-directories-for-emptyness' for an
explanation for these three choices.
The option `ecb-read-only-check-exclude-regexps' offers are more fine
granularity to exclude the sources of certain directories from the read-only
state-check."
:group 'ecb-sources
:group 'ecb-directories
:group 'ecb-most-important
:type '(radio (const :tag "Switch on" :value t)
(const :tag "Switch off for remote directories" :value unless-remote)
(const :tag "Switch off completely" :value nil)))
(defcustom ecb-read-only-check-exclude-regexps nil
"*Which directories should be excluded from the sources-read-only-check.
If a directory matches any of the regexps of this option their sources will
not be checked if they are writable - This option takes only effect if
`ecb-sources-perform-read-only-check' is not nil."
:group 'ecb-sources
:group 'ecb-directories
:type '(repeat (regexp :tag "Directory-regexp")))
(defsubst ecb-sources-read-only-check-p (dir)
"Return not nil if the sources of DIR should be checked for read-only-state.
The check is performed according to the settings in the options
`ecb-sources-perform-read-only-check' and
`ecb-read-only-check-exclude-regexps'."
(and (or (equal t ecb-sources-perform-read-only-check)
(and (equal 'unless-remote ecb-sources-perform-read-only-check)
(not (ecb-remote-path dir))))
(not (ecb-match-regexp-list dir ecb-read-only-check-exclude-regexps))))
(defcustom ecb-directories-buffer-name " *ECB Directories*"
"*Name of the ECB directory buffer.
Because it is not a normal buffer for editing you should enclose the name with
stars, e.g. \"*ECB Directories*\".
If it is necessary for you you can get emacs-lisp access to the buffer-object of
the ECB-directory-buffer by this name, e.g. by a call of `set-buffer'.
Changes for this option at runtime will take affect only after deactivating and
then activating ECB again!"
:group 'ecb-directories
:type 'string)
(defcustom ecb-excluded-directories-regexps '("^\\(CVS\\|\\.[^xX]*\\)$")
"*Directories that should not be included in the directories list.
The value of this variable should be a list of regular expressions."
:group 'ecb-directories
:type '(repeat (regexp :tag "Directory-regexp")))
(defsubst ecb-check-dir-exclude (dir)
(ecb-match-regexp-list dir ecb-excluded-directories-regexps))
(defcustom ecb-auto-expand-directory-tree 'best
"*Automatically expand the directory tree to the current source file.
There are three options:
- best: Expand the best-matching source-path
- first: Expand the first matching source-path
- nil: Do not automatically expand the directory tree."
:group 'ecb-directories
:type '(radio (const :tag "Best matching"
:value best)
(const :tag "First matching"
:value first)
(const :tag "No auto. expand"
:value nil)))
(defcustom ecb-sources-buffer-name " *ECB Sources*"
"*Name of the ECB sources buffer.
Because it is not a normal buffer for editing you should enclose the name with
stars, e.g. \"*ECB Sources*\".
If it is necessary for you you can get emacs-lisp access to the buffer-object of
the ECB-sources-buffer by this name, e.g. by a call of `set-buffer'.
Changes for this option at runtime will take affect only after deactivating and
then activating ECB again!"
:group 'ecb-sources
:type 'string)
(defcustom ecb-sources-show-node-info '(if-too-long . name)
"*When to display which node-info in the sources-buffer.
Define which node info should be displayed after moving the mouse
over a node \(or after a shift click onto the node) in the
sources-buffer.
You can define \"when\" a node-info should be displayed:
See `ecb-directories-show-node-info' for the possible choices.
You can define \"which\" info should be displayed:
- name: Only the full node-name is displayed.
- file-info: File infos for this file are displayed.
- file-info-full: Fill infos incl. full path for this file are displayed.
Do NOT set this option directly via setq but use always customize!"
:group 'ecb-sources
:type '(cons (choice :tag "When"
(const :tag "Always" :value always)
(const :tag "If too long" :value if-too-long)
(const :tag "After shift click" :value shift-click)
(const :tag "Never" :value never))
(choice :tag "What"
(const :tag "Node-name" :value name)
(const :tag "File info" :value file-info)
(const :tag "File info \(full path)"
:value file-info-full))))
(defcustom ecb-sources-exclude-cvsignore nil
"*Specify if files contained in a .cvsignore should be excluded.
Value is a list of regular expressions or nil. If you want to exclude files
listed in a .cvsignore-file from being displayed in the ecb-sources-buffer
then specify a regexp for such a directory.
If you want to exclude the contents of .cvsignore-files for every directory
then you should add one regexp \".*\" which matches every directory.
If you never want to exclude the contents of .cvsignore-files then set this
option to nil. This is the default."
:group 'ecb-sources
:group 'ecb-directories
:type '(repeat (regexp :tag "Directory-regexp")))
(defcustom ecb-source-file-regexps
'((".*" . (("\\(^\\(\\.\\|#\\)\\|\\(~$\\|\\.\\(elc\\|obj\\|o\\|class\\|lib\\|dll\\|a\\|so\\|cache\\)$\\)\\)")
("^\\.\\(emacs\\|gnus\\)$"))))
"*Specifies which files are shown as source files.
This is done on directory-base, which means for each directory-regexp the
files to display can be specified. If more than one directory-regexp matches
the current selected directory then always the first one \(and its related
file-exclude/include-regexps) is used! If no directory-regexp matches then all
files are displayed for the currently selected directory.
Important note: It is recommended that the *LAST* element of this list should
contain an always matching directory-regexp \(\".*\")!
So the value of this option is a list of cons-cells where the car is a
directory regexp and the cdr is a 2 element list where the first element is a
list of exclude regexps and the second element is a list of include regexps. A
file is displayed in the sources-buffer of ECB iff: The file does not match
any of the exclude regexps OR the file matches at least one of the include
regexps.
But regardless of the value of this option a file F is never displayed in the
sources-buffer if the directory matches `ecb-sources-exclude-cvsignore'
and the directory contains a file .cvsignore which contains F as an entry!
There are three predefined and useful combinations of an exclude and include
regexp:
- All files
- All, but no backup, object, lib or ini-files \(except .emacs and .gnus). This
means all files except those starting with \".\", \"#\" or ending with
\"~\", \".elc\", \".obj\", \".o\", \".lib\", \".dll\", \".a\", \".so\".
(but including .emacs and .gnus)
- Common source file types (.c, .java etc.)
In addition to these predefined values a custom exclude and include
combination can be defined. Here each list must at least contain one regexp -
this can be a least the empty regexp \"\"!
Tips for the directory- and file-regexps: \"$^\" matches no files/directories,
\".*\" matches all files/directories."
:group 'ecb-sources
:group 'ecb-most-important
:type '(repeat (cons :tag "Directory file-spec"
(regexp :tag "Directory regexp")
(choice :tag "Files to display"
:menu-tag "Files to display"
(const :tag "All files"
:value (("") ("")))
(const :tag "All, but no backups, objects, etc..."
:value (("\\(^\\(\\.\\|#\\)\\|\\(~$\\|\\.\\(elc\\|obj\\|o\\|class\\|lib\\|dll\\|a\\|so\\|cache\\)$\\)\\)") ("^\\.\\(x?emacs\\|gnus\\)$")))
(const :tag "Common source file types"
:value (("") ("\\(\\(M\\|m\\)akefile\\|.*\\.\\(java\\|el\\|c\\|cc\\|h\\|hh\\|txt\\|html\\|texi\\|info\\|bnf\\)\\)$")))
(list :tag "Custom"
(repeat (regexp :tag "Exclude regexp"
:value ""))
(repeat (regexp :tag "Include regexp"
:value "")))))))
(defcustom ecb-show-source-file-extension t
"*Show the file extension of source files."
:group 'ecb-sources
:type 'boolean)
(defcustom ecb-sources-sort-method 'name
"*Defines how the source files are sorted.
- 'name: Sorting by name.
- 'extension: Sorting first by extension and then by name.
- nil: No sorting, means source files are displayed in the sequence returned by
`directory-files' \(called without sorting).
See also `ecb-sources-sort-ignore-case'."
:group 'ecb-sources
:type '(radio (const :tag "By name"
:value name)
(const :tag "By extension"
:value extension)
(const :tag "No sorting"
:value nil)))
(defcustom ecb-sources-sort-ignore-case t
"*Ignore case for sorting the source-files of the Sources-buffer.
See also `ecb-sources-sort-method'."
:group 'ecb-sources
:type 'boolean)
(defcustom ecb-history-buffer-name " *ECB History*"
"*Name of the ECB history buffer.
Because it is not a normal buffer for editing you should enclose the name with
stars, e.g. \"*ECB History*\".
If it is necessary for you you can get emacs-lisp access to the buffer-object of
the ECB-history-buffer by this name, e.g. by a call of `set-buffer'.
Changes for this option at runtime will take affect only after deactivating and
then activating ECB again!"
:group 'ecb-history
:type 'string)
(defcustom ecb-history-exclude-file-regexps '("TAGS$" "semantic\\.cache$")
"*List of regexps which exclude source-files from being historized. Be aware
that each always full filenames \(ie. incl. full path) are matched against
these regexps! Therefore be carefore with regexps beginning with ^!"
:group 'ecb-history
:type '(repeat (regexp :tag "Source-regexp")))
(defsubst ecb-check-filename-for-history-exclude (filename)
(ecb-match-regexp-list filename ecb-history-exclude-file-regexps))
(defcustom ecb-history-show-node-info '(always . name-path)
"*When to display which node-info in the history-buffer.
Define which node info should be displayed after moving the mouse
over a node \(or after a shift click onto the node) in the
history-buffer.
You can define \"when\" a node-info should be displayed:
See `ecb-directories-show-node-info' for the possible choices.
You can define \"which\" info should be displayed:
- name: Only the full node-name is displayed.
- path: The full-path of the node is displayed.
- name-path: The full node-name and the full-path is displayed.
Do NOT set this option directly via setq but use always customize!"
:group 'ecb-history
:type '(cons (choice :tag "When"
(const :tag "Always" :value always)
(const :tag "If too long" :value if-too-long)
(const :tag "After shift click" :value shift-click)
(const :tag "Never" :value never))
(choice :tag "What"
(const :tag "Node-name" :value name)
(const :tag "Full path" :value path)
(const :tag "Node-name \(Full path)" :value name-path))))
(defcustom ecb-history-make-buckets 'directory
"*Bucketize the entries of the history-buffer.
There are several options how the bucketizing should be done:
- 'never: No bucketizing at all, ie. all entries of the history-buffer we be
displayed flat.
- 'directory: All entries with related filesources residing in the same
directory will be contained in a bucket named with that directory.
- 'mode: All entries with related buffers have the same
major-mode will be contained in a bucket named with that major-mode
- 'extension: All entries with related filesources having the
same extension will be contained in a bucket named with that extension
If the value is a list of regular expressions then all entries where the
buffername matches the same regular expression will be contained in one
bucket. If the value is nil then this is interpreted as an empty list of
regular expressions!
The default value is 'directory."
:group 'ecb-history
:initialize 'custom-initialize-default
:set (function (lambda (symbol value)
(set symbol value)
(when (and (boundp 'ecb-minor-mode)
ecb-minor-mode)
(ecb-exec-in-window ecb-history-buffer-name
(ecb-add-buffers-to-history-new)))))
:type '(radio (const :tag "Never" :value never)
(const :tag "By directory" :value directory)
(const :tag "By major-mode" :value mode)
(const :tag "By file-extension" :value extension)
(repeat :tag "By regexps"
(regexp :tag "A bucket regexp"))))
(defcustom ecb-history-stick-indirect-buffers-to-basebuffer t
"*Stick all indirect-buffers as subnodes to their base-buffer.
If nil then indirect-buffers are treated as non-indirect-buffers
and sorted into the history-buffer-sequence according to the
setting of `ecb-history-sort-method'.
If not nil then indirect-buffers are always sticked to their base-buffer, ie.
the base-buffer is displayed as expandable node with all its indirect-buffers
as children-nodes, so the history looks like:
\[-] <base-buffer BB>
| <indirect-buffer 1 of BB>
`- <indirect-buffer 2 of BB>"
:group 'ecb-history
:initialize 'custom-initialize-default
:set (function (lambda (symbol value)
(set symbol value)
(when (and (boundp 'ecb-minor-mode)
ecb-minor-mode)
(ecb-exec-in-window ecb-history-buffer-name
(ecb-add-buffers-to-history-new)))))
:type 'boolean)
(defcustom ecb-history-sort-method 'name
"*Defines how the entries in the history-buffer are sorted.
- 'name: Sorting by name.
- 'extension: Sorting first by extension and then by name.
- nil: No sorting, means the most recently used buffers are on the top of the
history and the seldom used buffers at the bottom.
See also `ecb-history-sort-ignore-case'.
If the history is bucketized \(see `ecb-history-make-buckets') then this
sorting applies to the sorting within each bucket."
:group 'ecb-history
:initialize 'custom-initialize-default
:set (function (lambda (symbol value)
(set symbol value)
(when (and (boundp 'ecb-minor-mode)
ecb-minor-mode)
(ecb-exec-in-window ecb-history-buffer-name
(ecb-add-buffers-to-history-new)))))
:type '(radio (const :tag "By name"
:value name)
(const :tag "By extension"
:value extension)
(const :tag "No sorting"
:value nil)))
(defcustom ecb-history-sort-ignore-case t
"*Ignore case for sorting the history-entries.
See also `ecb-history-sort-method'."
:group 'ecb-history
:initialize 'custom-initialize-default
:set (function (lambda (symbol value)
(set symbol value)
(when (and (boundp 'ecb-minor-mode)
ecb-minor-mode)
(ecb-exec-in-window ecb-history-buffer-name
(ecb-add-buffers-to-history-new)))))
:type 'boolean)
(defcustom ecb-kill-buffer-clears-history nil
"*Define if `kill-buffer' should also clear the history.
There are three options:
- auto: Removes automatically the corresponding history-entry after the buffer
has been killed.
- ask: Asks, if the history-entry should be removed after the kill.
- nil: `kill-buffer' does not affect the history \(this is the default)."
:group 'ecb-history
:type '(radio (const :tag "Remove history entry automatically"
:value auto)
(const :tag "Ask if history entry should be removed"
:value ask)
(const :tag "Do not clear the history"
:value nil)))
(defcustom ecb-directories-menu-user-extension
'(("Version Control"
(ecb-dir-popup-cvs-status "CVS Status" )
(ecb-dir-popup-cvs-examine "CVS Examine")
(ecb-dir-popup-cvs-update "CVS Update")))
"*Static user extensions for the popup-menu of the directories buffer.
Value is a list of elements of the following type: Each element defines a new
menu-entry and is either:
a) Menu-command: A list containing two sub-elements, whereas the first is the
function \(a function symbol) being called if the menu-entry is selected
and the second is the name of the menu-entry.
b) Separator: A one-element-list and the element is the string \"---\": Then a
non-selectable menu-separator is displayed.
c) Submenu: A list where the first element is the title of the submenu
displayed in the main-menu and all other elements are either menu-commands
\(see a) or separators \(see b) or another submenu \(see c). This allows
deep nested menu-submenu-structures. Currently a level of 4 is allowed but
in general there could be an infinite depth of nesting but it makes no
sense - if possible at all - to define infinite nested defcustom-types. So
there is a limit of 4 levels but tis is not a hard limit: Just increase the
value of the `ecb-max-submenu-depth' *BEFORE* first loading ECB!
The function of a menu-command must follow the following guidelines: Such a
function must be defined with the macro `tree-buffer-defpopup-command! This
macro defines a new popup-command whereas the newly defined command gets one
argument NODE. See the docstring of `tree-buffer-defpopup-command' for further
details.
Example for the definition of such a popupmenu-command:
\(tree-buffer-defpopup-command ecb-my-special-dir-popup-function
\"Prints the name of the directory of the node under point.\"
\(let \(\(node-data=dir \(tree-node->data node)))
\(message \"Dir under node: %s\" node-data=dir)))
Per default the static user-extensions are added at the beginning of the
built-in menu-entries of `ecb-directories-menu' but the whole menu can be
re-arranged with `ecb-directories-menu-sorter'.
These menu-extensions are static. A dynamic menu-extension can be achieved via
`ecb-directories-menu-user-extension-function'."
:group 'ecb-directories
:type (ecb-create-menu-user-ext-type 1 ecb-max-submenu-depth))
(defcustom ecb-directories-menu-user-extension-function 'ignore
"*Dynamic user extensions for the popup-menu of the directories buffer.
A function which has to return a list in the same format like the option
`ecb-directories-menu-user-extension'. This function is called when the user
opens the popup-menu for the directories buffer.
If no dynamically evaluated menu-extensions should be added to the
directories-buffer the function has to return nil. Therefore the default-value
of this option is `ignore'.
Per default the dynamic user-extensions are added in front of the static
extensions of `ecb-directories-menu-user-extension' but the whole menu can be
re-arranged with `ecb-directories-menu-sorter'."
:group 'ecb-directories
:type 'function)
(defcustom ecb-sources-menu-user-extension
'(("Version control"
(ecb-file-popup-ediff-revision "Ediff against revision")
("---")
(ecb-file-popup-vc-next-action "Check In/Out")
(ecb-file-popup-vc-log "Revision history")
(ecb-file-popup-vc-annotate "Annotate")
(ecb-file-popup-vc-diff "Diff against last version")
("---")
(ecb-file-popup-vc-refresh-file "Recompute state for file")
(ecb-file-popup-vc-refresh-dir "Recompute state for whole dir")))
"*Static user extensions for the popup-menu of the sources buffer.
For further explanations see `ecb-directories-menu-user-extension'.
The node-argument of a menu-function contains as data the source
for which the popup-menu has been opened. Use always
`ecb-source-get-*' to extract whatever you need from the
node-data. E.g. use `ecb-source-get-filename' to get the full
filename of the source of the node.
Per default the static user-extensions are added at the beginning of the
built-in menu-entries of `ecb-sources-menu' but the whole menu can be
re-arranged with `ecb-sources-menu-sorter'."
:group 'ecb-sources
:type (ecb-create-menu-user-ext-type 1 ecb-max-submenu-depth))
(defcustom ecb-sources-menu-user-extension-function 'ignore
"*Dynamic user extensions for the popup-menu of the sources buffer.
A function which has to return a list in the same format like the option
`ecb-sources-menu-user-extension'. This function is called when the user
opens the popup-menu for the sources buffer.
If no dynamically evaluated menu-extensions should be added to the
sources-buffer the function has to return nil. Therefore the default-value
of this option is `ignore'.
Per default the dynamic user-extensions are added in front of the static
extensions of `ecb-sources-menu-user-extension' but the whole menu can be
re-arranged with `ecb-sources-menu-sorter'."
:group 'ecb-sources
:type 'function)
(defcustom ecb-history-menu-user-extension
'(("Version control"