summaryrefslogtreecommitdiff
path: root/lisp/find-file.el
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2022-09-01 06:17:37 +0200
committerStefan Kangas <stefankangas@gmail.com>2022-09-01 06:17:37 +0200
commit0bd860cc2e94e3f5178000e929af93863b9ae458 (patch)
treeb5fca009a2b76625bf021ac69438fc3943cd47de /lisp/find-file.el
parente8085b1596b07543caadee1e4fa4f9061fbf3d8b (diff)
parent8807a4f53204674a796cb2db73716e09736b548e (diff)
downloademacs-0bd860cc2e94e3f5178000e929af93863b9ae458.tar.gz
emacs-0bd860cc2e94e3f5178000e929af93863b9ae458.tar.bz2
emacs-0bd860cc2e94e3f5178000e929af93863b9ae458.zip
Merge from origin/emacs-28
8807a4f532 Enable 256 colors in fbterm. bbc23ca8ab One more fix for find-file.el 0cbcaf5119 ; Yet another doc fix for 'ff-other-file-alist' (bug#57325) 2d9a391727 Recommend using fbterm in the Linux console. a5a92e577c ; * src/window.c (syms_of_window) <window-point-insertion-... 4d52fe6b96 * lisp/find-file.el (ff-other-file-alist): Doc fix. (Bug#... d111b5b651 * lisp/info.el (Info-mode): Support the Linux console better. cc945ec0ed ; Fix doc strings in latin1-disp.el 195fcc932e Improve the documentation of glyphless-character display 72ae02377e ; * lisp/jit-lock.el (jit-lock-chunk-size): Doc fix. 3fb69fad49 Fix documentation of 'glyphless-char-display' # Conflicts: # lisp/international/characters.el # src/xdisp.c
Diffstat (limited to 'lisp/find-file.el')
-rw-r--r--lisp/find-file.el36
1 files changed, 25 insertions, 11 deletions
diff --git a/lisp/find-file.el b/lisp/find-file.el
index 614ff420f25..646779fc919 100644
--- a/lisp/find-file.el
+++ b/lisp/find-file.el
@@ -193,18 +193,32 @@ The value could be an alist or a symbol whose value is an alist.
Each element of the alist has the form
(REGEXP (EXTENSION...))
-or
- (REGEXP FUNCTION)
where REGEXP is the regular expression matching a file's extension,
-EXTENSIONs is the list of literal file-name extensions to search for,
-and FUNCTION is a function of one argument, the current file's name,
-that returns the list of extensions to search for.
-The list of extensions should contain the most used extensions before the
-others, since the search algorithm searches sequentially through each
-directory specified in `ff-search-directories'. If a file is not found,
-a new one is created with the first matching extension (`.cc' yields `.hh').
-This alist should be set by the major mode."
+and EXTENSIONs is the list of literal file-name extensions to search
+for. The list of extensions should contain the most used extensions
+before the others, since the search algorithm searches sequentially
+through each directory specified in `ff-search-directories'.
+
+Alist elements can also be of the form
+
+ (REGEXP FUNCTION)
+
+where FUNCTION is a function of one argument, the current file's name,
+that returns the list of possible names of the corresponding files, with
+or without leading directories. Note the difference: FUNCTION returns
+the list of file names, not their extensions. This is for the case when
+REGEXP is not enough to determine the file name of the other file.
+
+If a file is not found, a new one is created with the first
+matching extension or name (e.g., `.cc' yields `.hh').
+
+This alist should be set by the major mode.
+
+Note: if an element of the alist names a FUNCTION as its cdr, that
+function must return a non-nil list of file-names. It cannot
+return nil, nor can it signal in any way a failure to find a suitable
+list of file names."
:type '(choice (repeat (list regexp (choice (repeat string) function)))
symbol))
@@ -615,7 +629,7 @@ name of the first file found."
(while (and suffixes (not found))
(setq filename (concat fname-stub this-suffix))
- (setq file (concat dir "/" filename))
+ (setq file (expand-file-name filename dir))
(if (not ff-quiet-mode)
(message "Finding %s..." file))