2

I'm working on the current branch of a game composed of several files. I have created a fileset so I can open all those files at once. The GNU Emacs manual says:

Normally, a fileset is a simple list of files, but you can also define a fileset as a regular expression matching file names.

However, no way to enter a regular expression to add files to a fileset is provided in the manual (filesets-add-buffer only allows you to add the file you are currently visiting).

1
  • The manual says explicitly: "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 (*note Easy Customization::). Normally, a fileset is a simple list of files, but you can also define a fileset as a regular expression matching file names." In the Customize buffer for option filesets-data, click the Value Menu for a given entry and choose Pattern. – Drew May 21 '17 at 23:32
2

After calling the function filesets-init, either interactively via M-: (filesets-init) RET or in your user-init-file as (filesets-init), you can invoke the command M-x filesets-edit RET to edit the user option filesets-data using the Customize interface.

This is the only interactive means of customising filesets I can see in the source. Alternatively, you could manually set/edit filesets-data in your user-init-file.

As per Drew's suggestion, here is the docstring for filesets-data, the main customisation entry-point for filesets:

Fileset definitions.

A fileset is either a list of files, a file pattern, a base directory
and a search pattern (for files), or a base file.  Changes to this
variable will take effect after rebuilding the menu.

Caveat: Fileset names have to be unique.

Example definition:
 '(("My Wiki"
    (:ingroup "~/Etc/My-Wiki/WikiContents"))
   ("My Homepage"
    (:pattern "~/public_html/" "^.+\\\\.html$")
    (:open filesets-find-file))
   ("User Configuration"
    (:files "~/.xinitrc"
            "~/.bashrc"
            "~/.bash_profile"))
   ("HOME"
    (:tree "~" "^[^.].*[^~]$")
    (:filter-dirs-flag t)))

`filesets-data' is a list of (NAME-AS-STRING . DEFINITION), DEFINITION
being an association list with the fields:

:files FILE-1 .. FILE-N ... a list of files belonging to a fileset

:ingroup FILE-NAME ... an inclusion group's base file.

:tree ROOT-DIR PATTERN ... a base directory and a file pattern

:pattern DIR PATTERN ... a base directory and a regexp matching
                         files in that directory.  Usually,
                         PATTERN has the form `^REGEXP$'.  Unlike
                         :tree, this form does not descend
                         recursively into subdirectories.

:filter-dirs-flag BOOLEAN ... is only used in conjunction with :tree.

:tree-max-level INTEGER ... recurse into directories this many levels
(see `filesets-tree-max-level' for a full explanation)

:dormant-flag BOOLEAN ... non-nil means don't show this item in the
menu; dormant filesets can still be manipulated via commands available
from the minibuffer -- e.g. `filesets-open', `filesets-close', or
`filesets-run-cmd'

:dormant-p FUNCTION ... a function returning :dormant-flag

:open FUNCTION ... the function used to open file belonging to this
fileset.  The function takes a file name as argument

:save FUNCTION ... the function used to save file belonging to this
fileset; it takes no arguments, but works on the current buffer.

Either :files, :pattern, :tree, or :ingroup must be supplied.  :files
overrules :tree, :tree overrules :pattern, :pattern overrules :ingroup,
i.e. these tags are mutually exclusive.  The fields :open and :save are
optional.

In conjunction with the :tree tag, :save is void.  :open refers to the
function used for opening files in a directory, not for opening the
directory.  For browsing directories, `filesets-browse-dir-function' is used.

Before using :ingroup, make sure that the file type is already
defined in `filesets-ingroup-patterns'.
1
  • +1. In sum, customize option filesets-data. And start by reading its doc string: C-h v filesets-data. (You might want to post that doc here.) – Drew May 21 '17 at 23:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.