]> git.eshelyaron.com Git - emacs.git/commitdiff
find-file-asynchronously can also be a regexp
authorMichael Albinus <michael.albinus@gmx.de>
Sat, 28 Jul 2018 08:40:37 +0000 (10:40 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Sat, 4 Aug 2018 10:31:58 +0000 (12:31 +0200)
* lisp/files.el (find-file-read-args): Check, whether
find-file-asynchronously matches filename, if the former is a regexp.
(find-file-asynchronously): Allow also regexp.

lisp/files.el

index 10215514b49aa6421a3cd111eea60fc20fdb29c9..88c4752b46385da856d0e933695c03c16f85451f 100644 (file)
@@ -1582,6 +1582,8 @@ If WILDCARDS is non-nil, return the spec (<filename> t <async>)."
   (let ((filename (read-file-name prompt nil default-directory mustmatch))
         (async (and (xor find-file-asynchronously current-prefix-arg)
                     (featurep 'threads))))
+    (when (and async (stringp find-file-asynchronously))
+      (setq async (string-match-p find-file-asynchronously filename)))
     (if wildcards `(,filename t ,async) `(,filename ,async))))
 
 (defmacro find-file-with-threads (filename async &rest body)
@@ -2069,10 +2071,12 @@ suppresses this warning."
 
 (defcustom find-file-asynchronously nil
   "Non-nil means visit file asynchronously when called interactively.
-This behavior is toggled by a prefix argument to the interactive call."
+If it is a regular expression, it must match the file name to be
+visited.  This behavior is toggled by a prefix argument to the
+interactive call."
   :group 'files
   :version "27.1"
-  :type 'boolean)
+  :type '(choice boolean regexp))
 
 (defcustom large-file-warning-threshold 10000000
   "Maximum size of file above which a confirmation is requested.