GNU Emacs
Emacs
Dashboard

18.20 Filesets

If you regularly edit a certain group of files, you can define them as a fileset. This lets you perform certain operations, such as visiting, query-replace, and shell commands on all the files at once. To make use of filesets, you must first add the expression (filesets-init) to your init file (see The Emacs Initialization File). This adds a ‘ Filesets’ sub-menu to the menu bar’s ‘ File’ menu.

The simplest way to define a fileset is by adding files to it one at a time. To add a file to fileset name, visit the file and type M-x filesets-add-buffer RET name RET. If there is no fileset name, this creates a new one, which initially contains only the current file. The command M-x filesets-remove-buffer removes the current file from a fileset.

You can also edit the list of filesets directly, with M-x filesets-edit (or by choosing ‘ Edit Filesets’ from the ‘ Filesets’ menu). The editing is performed in a Customize buffer (see Easy Customization Interface). Normally, a fileset is a simple list of files, but you can also define a fileset as a regular expression matching file names. Some examples of these more complicated filesets are shown in the Customize buffer. Remember to select ‘ Save for future sessions’ if you want to use the same filesets in future Emacs sessions.

You can use the command M-x filesets-open to visit all the files in a fileset, and M-x filesets-close to close them. Use M-x filesets-run-cmd to run a shell command on all the files in a fileset. These commands are also available from the ‘ Filesets’ menu, where each existing fileset is represented by a submenu.

See Version Control, for a different concept of filesets: groups of files bundled together for version control operations. Filesets of that type are unnamed, and do not persist across Emacs sessions.