Emacs and Filesets
Emacs has a concept of
filesets. It actually has two
kinds of fileset
concepts.
One is the much more recognizable vc
interface for interacting with
version control repositories. The other one is not used often, but still
has some interesting characteristics.
First, you define what is in a file set. The GUI gives you a menu to add items to a named set, but you can also define them manually in code or through the Customize mechanism. I actually had to think about this for a bit, because it didn’t seem to make sense why I would have items that were related, but not also somehow in a version control system. Turns out I do: Booklists, health documents, bash/profile preferences, and more.
See, I could actually put all of those documents into a repository, but often I don’t need to do that, especially since I back them up in more traditional ways anyway. Lets take a look at defining a set.
(setq filesets-data '(("Books"
(:ingroup "~/Documents/Books"))))
This defines a ‘Books’ set that will simply show you the contents of the directory, similar to an Emacs bookmark. Not very helpful, but still neat.
(setq filesets-data '(("Config files"
(:files "~/.profile"
"~/.bashrc"))))
This one will open all the listed files defined in that set. One other cool feature is that you can operate on the fileset with commands and when done with them you can close them all at once. Filesets can even just be a regular expression of files in a directory, letting you cherry-pick items from the folder that you want to see.
I can understand why folks probably don’t use this too often. Sometimes it’s less mental overhead to just open files as needed, instead of invoking a new mechanism that might be too much or too little for your needs at the time. Also, the fileset program hasn’t really been updated in ages. Even the original author’s site is now only accessible via the Wayback machine. Regardless, I think that there are some really good uses that could come out of filesets, as with most Emacs archeology, you only get more features and a deeper understanding of the arcana that makes Emacs run.
But Wait… There’s More!
Well, not much more. I also realized, that projects.el
represents a
sort of fileset, too. While it automatically works for folders that have
some sort of detectable VC system, it can be manually defined, too.