emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 980009e84c: Make find-sibling-file-search non-private


From: Lars Ingebrigtsen
Subject: master 980009e84c: Make find-sibling-file-search non-private
Date: Sun, 12 Jun 2022 06:08:46 -0400 (EDT)

branch: master
commit 980009e84c817b9a5357dfe4d735cb5c10b974bb
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make find-sibling-file-search non-private
    
    * lisp/files.el (find-sibling-file-search): Rename to be non-private.
    (find-sibling-file): Adjust call.
---
 lisp/files.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lisp/files.el b/lisp/files.el
index 945b7ef737..eb1b90fc29 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -7321,7 +7321,8 @@ The \"sibling\" file is defined by the 
`find-sibling-rules' variable."
                  (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))))
+  (let ((siblings (find-sibling-file-search (expand-file-name file)
+                                            find-sibling-rules)))
     (cond
      ((null siblings)
       (user-error "Couldn't find any sibling files"))
@@ -7336,16 +7337,19 @@ The \"sibling\" file is defined by the 
`find-sibling-rules' variable."
          (completing-read (format-prompt "Find file" (car relatives))
                           relatives nil t nil nil (car relatives))))))))
 
-(defun find-sibling-file--search (file)
+(defun find-sibling-file-search (file &optional rules)
+  "Return a list of FILE's \"siblings\"
+RULES should be a list on the form defined by `find-sibling-rules' (which
+see), and if nil, defaults to `find-sibling-rules'."
   (let ((results nil))
-    (pcase-dolist (`(,match . ,expansions) find-sibling-rules)
+    (pcase-dolist (`(,match . ,expansions) (or rules find-sibling-rules))
       ;; Go through the list and find matches.
       (when (string-match match file)
         (let ((match-data (match-data)))
           (dolist (expansion expansions)
             (let ((start 0))
               ;; Expand \\1 forms in the expansions.
-              (while (string-match "\\\\\\([0-9]+\\)" expansion start)
+              (while (string-match "\\\\\\([&0-9]+\\)" expansion start)
                 (let ((index (string-to-number (match-string 1 expansion))))
                   (setq start (match-end 0)
                         expansion



reply via email to

[Prev in Thread] Current Thread [Next in Thread]