Previous: Window-managers and ECB, Up: Common use-cases


10.16 Something like virtual folders with the ECB-history

For example, there is a large project with a huge number of files, and there are various tasks in this project (e.g. several different bug-fixing tasks). So it could be convenient to group buffers according to various tasks, or with other words: something like virtual folders for the buffers. It can be fulfiled through using indirect buffers.

See the following example:

   task_1-aaa.pl
   task_1-bbb.c
   task_1-ccc.sh
   task_2-aaa.pl
   task_2-eee.c
   task_2-ccc.sh
   task_3-xxx.java
   task_3-ccc.sh

This means create indirect buffers1 with a name-part which can be used for grouping together buffers with same name-part (here e.g. task_1- ... task_3-). In the example above you would create three indirect buffers for the filebuffer ccc.sh because this source is needed in all three tasks, two indirect buffers for aaa.pl because it is needed in the task-1 and task-2 and so on for the rest of the buffers. Make all this indirect buffers with the command clone-indirect-buffer2, which creates real clones means the indirect buffers have the same major-mode etc. as the base-buffer (see the manual of Emas).

Now remember to the option ecb-history-make-buckets which allows a.o. to define a list of regular expressions to bucketize the buffers of the history. Use this to make one bucket for each task. So in our example a value

   ("^task_1-.+" "^task_2-.+" "^task_3-.+")

for ecb-history-make-buckets would satiesfy our needs.

This option allows to define several criterias for building buckets in the history-buffer all the history entries are sorted in (e.g. by major-mode, directory, file-extension or regular expressions).

After that the history-window would display something like the following:

   [-] [^task_1-.+]
    |  task_1-aaa.pl
    |  task_1-bbb.c
    `- task_1-ccc.sh
   [-] [^task_2-.+]
    |  task_2-aaa.pl
    |  task_2-eee.c
    `- task_2-ccc.sh
   [-] [^task_3-.+]
    |  task_3-xxx.java
    `- task_3-ccc.sh

Hopefully this example could give an impression how the combination of usage of indirect buffers and bucketizing the history-window can be used for using one sources for different sake and grouping together what belongs together.


Footnotes

[1] Remember the most important feature of indirect buffers: Changes made in one of them will immediately take effect in all others with the same base-buffer

[2] Currently only available with GNU Emacs