diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2018-05-21 19:48:15 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2018-05-21 19:48:15 +0200 |
commit | ab37ceb9eecdd20b913d1b2b00d81e8f83e1caf7 (patch) | |
tree | 9ad1f74753a4985f55ba9f1ad60b246ec2a7ff84 /lisp/net/tramp.el | |
parent | 4010631fe915503e5376458d8a8b482d37360f87 (diff) | |
download | emacs-ab37ceb9eecdd20b913d1b2b00d81e8f83e1caf7.tar.gz emacs-ab37ceb9eecdd20b913d1b2b00d81e8f83e1caf7.tar.bz2 emacs-ab37ceb9eecdd20b913d1b2b00d81e8f83e1caf7.zip |
Fix Bug#31489
* doc/misc/tramp.texi (Frequently Asked Questions):
Mention `tramp-ignored-file-name-regexp'. Improve index.
; * etc/NEWS: Mention `tramp-ignored-file-name-regexp'.
* lisp/net/tramp.el (tramp-ignored-file-name-regexp): New defcustom.
(tramp-tramp-file-p): Use it. Check also for `tramp-mode'.
(tramp-file-name-handler): Don't check for `tramp-mode'. (Bug#31489)
* test/lisp/net/tramp-tests.el (tramp-test01-file-name-syntax):
Extend test.
Diffstat (limited to 'lisp/net/tramp.el')
-rw-r--r-- | lisp/net/tramp.el | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index e14a515b8bb..499fcadffff 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -991,6 +991,14 @@ This regexp should match Tramp file names but no other file names. When calling `tramp-register-file-name-handlers', the initial value is overwritten by the car of `tramp-file-name-structure'.") +;;;###autoload +(defcustom tramp-ignored-file-name-regexp nil + "Regular expression matching file names that are not under Tramp’s control." + :version "27.1" + :group 'tramp + :type '(choice (const nil) string) + :require 'tramp) + (defconst tramp-completion-file-name-regexp-default (concat "\\`/\\(" @@ -1279,12 +1287,15 @@ entry does not exist, return nil." ;;;###tramp-autoload (defun tramp-tramp-file-p (name) "Return t if NAME is a string with Tramp file name syntax." - (and (stringp name) + (and tramp-mode (stringp name) ;; No "/:" and "/c:". This is not covered by `tramp-file-name-regexp'. (not (string-match-p (if (memq system-type '(cygwin windows-nt)) "^/[[:alpha:]]?:" "^/:") name)) + ;; Excluded file names. + (or (null tramp-ignored-file-name-regexp) + (not (string-match-p tramp-ignored-file-name-regexp name))) (string-match-p tramp-file-name-regexp name) t)) @@ -2254,7 +2265,7 @@ preventing reentrant calls of Tramp.") "Invoke Tramp file name handler. Falls back to normal file name handler if no Tramp file name handler exists." (let ((filename (apply 'tramp-file-name-for-operation operation args))) - (if (and tramp-mode (tramp-tramp-file-p filename)) + (if (tramp-tramp-file-p filename) (save-match-data (setq filename (tramp-replace-environment-variables filename)) (with-parsed-tramp-file-name filename nil |