[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 5f12e288a5: Improve find-sibling-file error reporting
From: |
Lars Ingebrigtsen |
Subject: |
master 5f12e288a5: Improve find-sibling-file error reporting |
Date: |
Mon, 6 Jun 2022 08:34:56 -0400 (EDT) |
branch: master
commit 5f12e288a51eb70e7d38a111d610cb09dfe04332
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Improve find-sibling-file error reporting
* lisp/files.el (find-sibling-file): Improve error reporting.
---
lisp/files.el | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/lisp/files.el b/lisp/files.el
index 97e58946bd..07ab2b45a5 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -7303,16 +7303,22 @@ The \"sibling\" file is defined by the
`find-sibling-rules' variable."
(unless buffer-file-name
(user-error "Not visiting a file"))
(list buffer-file-name)))
+ (unless find-sibling-rules
+ (user-error "The `find-sibling-rules' variable has not been configured"))
(let ((siblings (find-sibling-file--search (expand-file-name file))))
- (if (length= siblings 1)
- (find-file (car siblings))
+ (cond
+ ((null siblings)
+ (user-error "Couldn't find any sibling files"))
+ ((length= siblings 1)
+ (find-file (car siblings)))
+ (t
(let ((relatives (mapcar (lambda (sibling)
(file-relative-name
sibling (file-name-directory file)))
siblings)))
(find-file
(completing-read (format-prompt "Find file" (car relatives))
- relatives nil t nil nil (car relatives)))))))
+ relatives nil t nil nil (car relatives))))))))
(defun find-sibling-file--search (file)
(let ((results nil))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 5f12e288a5: Improve find-sibling-file error reporting,
Lars Ingebrigtsen <=