From: Michael Albinus Date: Sat, 28 Jul 2018 08:40:37 +0000 (+0200) Subject: find-file-asynchronously can also be a regexp X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=917a542d72e4cfb2f6abe67b574fd705dfd73933;p=emacs.git find-file-asynchronously can also be a regexp * 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. --- diff --git a/lisp/files.el b/lisp/files.el index 10215514b49..88c4752b463 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1582,6 +1582,8 @@ If WILDCARDS is non-nil, return the spec ( t )." (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.