[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat fe20be9ef2 2/7: Add file-name-quoted-p
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat fe20be9ef2 2/7: Add file-name-quoted-p |
Date: |
Mon, 11 Apr 2022 18:57:23 -0400 (EDT) |
branch: externals/compat
commit fe20be9ef269e81866c4e40a7d61cffe18080904
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Add file-name-quoted-p
---
MANUAL | 1 +
compat-26.el | 8 ++++++++
compat-tests.el | 10 ++++++++++
3 files changed, 19 insertions(+)
diff --git a/MANUAL b/MANUAL
index 471e882181..307311ecd1 100644
--- a/MANUAL
+++ b/MANUAL
@@ -230,6 +230,7 @@ provided by Compat by default:
- Function: temporary-file-directory :: See [[info:elisp#Unique File
Names][(elisp) Unique File Names]].
- Macro: and-let* :: Defined in ~subr-x.el~.
- Function: file-local-name :: See [[info:elisp#Magic File Names][(elisp)
Magic File Names]].
+- Function: file-name-quoted-p :: See [[info:elisp#File Name
Expansion][(elisp) File Name Expansion]].
These functions are prefixed with ~compat~ prefix, and are only loaded
when ~compat-26~ is required:
diff --git a/compat-26.el b/compat-26.el
index bf8e1ceef6..e8c8ca8d7c 100644
--- a/compat-26.el
+++ b/compat-26.el
@@ -352,8 +352,16 @@ and the method of accessing the host, leaving only the
part that
identifies FILE locally on the remote system.
The returned file name can be used directly as argument of
`process-file', `start-file-process', or `shell-command'."
+ :realname compat--file-local-name
(or (file-remote-p file 'localname) file))
+(compat-defun file-name-quoted-p (name &optional top)
+ "Whether NAME is quoted with prefix \"/:\".
+If NAME is a remote file name and TOP is nil, check the local part of NAME."
+ :realname compat--file-name-quoted-p
+ (let ((file-name-handler-alist (unless top file-name-handler-alist)))
+ (string-prefix-p "/:" (compat--file-local-name name))))
+
;;* UNTESTED
(compat-defun temporary-file-directory ()
"The directory for writing temporary files.
diff --git a/compat-tests.el b/compat-tests.el
index 5e0ece15bc..1ae907a644 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -1578,5 +1578,15 @@ being compared against."
(ought ":foo" "/ssh:::foo")
(ought ":/bar/foo" "/ssh:::/bar/foo"))
+(compat-deftest file-name-quoted-p
+ (ought nil "")
+ (ought t "/:")
+ (ought nil "//:")
+ (ought t "/::")
+ (ought nil "/ssh::")
+ (ought nil "/ssh::a")
+ (ought t "/ssh::/:a")
+ (ought nil "/ssh:/:a"))
+
(provide 'compat-tests)
;;; compat-tests.el ends here
- [elpa] externals/compat updated (a09c6c260c -> 91f25b356e), ELPA Syncer, 2022/04/11
- [elpa] externals/compat c4bde3f108 4/7: Add generalised variable handling for compat-alist-get, ELPA Syncer, 2022/04/11
- [elpa] externals/compat e83e9a67fe 5/7: Add compat-executable-find, ELPA Syncer, 2022/04/11
- [elpa] externals/compat ced0446916 1/7: Add missing function file-local-name, ELPA Syncer, 2022/04/11
- [elpa] externals/compat 933cf6b365 3/7: Add file-name-quote, ELPA Syncer, 2022/04/11
- [elpa] externals/compat ed62b776b8 6/7: Add image-property, ELPA Syncer, 2022/04/11
- [elpa] externals/compat fe20be9ef2 2/7: Add file-name-quoted-p,
ELPA Syncer <=
- [elpa] externals/compat 91f25b356e 7/7: Add compat-dired-get-marked-files, ELPA Syncer, 2022/04/11