Variable: find-sibling-rules
find-sibling-rules is a customizable variable defined in files.el.gz.
Value
nil
Documentation
Rules for finding "sibling" files.
This is used by the find-sibling-file command.
This variable is a list of (MATCH EXPANSION...) elements.
MATCH is a regular expression that should match a file name that has a sibling. It can contain sub-expressions that will be used in EXPANSIONS.
EXPANSION is a string that matches file names. For instance, to define ".h" files as siblings of any ".c", you could say:
("\\\\([^/]+\\\\)\\\\.c\\\\\\='" "\\\\1.h")
MATCH and EXPANSION can also be fuller paths. For instance, if you want to define other versions of a project as being sibling files, you could say something like:
("src/emacs/[^/]+/\\\\(.*\\\\)\\\\\\='" "src/emacs/.*/\\\\1\\\\\\='")
In this example, if you're in "src/emacs/emacs-27/lisp/abbrev.el", and a "src/emacs/emacs-28/lisp/abbrev.el" file exists, it's now defined as a sibling.
This variable was added, or its default value changed, in Emacs 29.1.
Probably introduced at or before Emacs version 29.1.
Source Code
;; Defined in /usr/src/emacs/lisp/files.el.gz
(defcustom find-sibling-rules nil
"Rules for finding \"sibling\" files.
This is used by the `find-sibling-file' command.
This variable is a list of (MATCH EXPANSION...) elements.
MATCH is a regular expression that should match a file name that
has a sibling. It can contain sub-expressions that will be used
in EXPANSIONS.
EXPANSION is a string that matches file names. For instance, to
define \".h\" files as siblings of any \".c\", you could say:
(\"\\\\([^/]+\\\\)\\\\.c\\\\\\='\" \"\\\\1.h\")
MATCH and EXPANSION can also be fuller paths. For instance, if
you want to define other versions of a project as being sibling
files, you could say something like:
(\"src/emacs/[^/]+/\\\\(.*\\\\)\\\\\\='\" \"src/emacs/.*/\\\\1\\\\\\='\")
In this example, if you're in \"src/emacs/emacs-27/lisp/abbrev.el\",
and a \"src/emacs/emacs-28/lisp/abbrev.el\" file exists, it's now
defined as a sibling."
:type '(alist :key-type (regexp :tag "Match")
:value-type (repeat (string :tag "Expansion")))
:version "29.1")