aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2023-01-21 18:38:45 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2023-01-21 19:07:58 +0100
commit74250577e643779a3afc2fe7be2465833c7fa134 (patch)
tree9a626f080d4b2b1e3e277f8e415ec958591b5cfe
parent7d61400bc9df955d269b06ae613f52d04c96dc55 (diff)
Fix file-name-quoted-p and file-name-quote
-rw-r--r--compat-tests.el36
-rw-r--r--compat.texi72
2 files changed, 56 insertions, 52 deletions
diff --git a/compat-tests.el b/compat-tests.el
index 4e8a0d6..17b59f8 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -1564,28 +1564,30 @@
(should-equal ":/bar/foo" (file-local-name "/ssh:::/bar/foo")))
(ert-deftest file-name-quoted-p ()
- (should-not (compat-call file-name-quoted-p ""))
- (should (compat-call file-name-quoted-p "/:"))
- (should-not (compat-call file-name-quoted-p "//:"))
- (should (compat-call file-name-quoted-p "/::"))
- (should-not (compat-call file-name-quoted-p "/ssh::"))
- (should-not (compat-call file-name-quoted-p "/ssh::a"))
- (should (compat-call file-name-quoted-p "/ssh::/:a"))
+ ;; TODO test TOP argument
+ (should-not (file-name-quoted-p ""))
+ (should (file-name-quoted-p "/:"))
+ (should-not (file-name-quoted-p "//:"))
+ (should (file-name-quoted-p "/::"))
+ (should-not (file-name-quoted-p "/ssh::"))
+ (should-not (file-name-quoted-p "/ssh::a"))
+ (should (file-name-quoted-p "/ssh::/:a"))
;; NOTE: These tests fails prior to Emacs 26, because /ssh:foo was a valid
;; TRAMP path back then.
(when (>= emacs-major-version 26)
- (should-not (compat-call file-name-quoted-p "/ssh:/:a"))))
+ (should-not (file-name-quoted-p "/ssh:/:a"))))
(ert-deftest file-name-quote ()
- (should-equal "/:" (compat-call file-name-quote ""))
- (should-equal "/::"(compat-call file-name-quote ":"))
- (should-equal "/:/" (compat-call file-name-quote "/"))
- (should-equal "/:" (compat-call file-name-quote "/:"))
- (should-equal "/:a" (compat-call file-name-quote "a"))
- (should-equal "/::a" (compat-call file-name-quote ":a"))
- (should-equal "/:/a" (compat-call file-name-quote "/a"))
- (should-equal "/:a" (compat-call file-name-quote "/:a"))
- (should-equal (concat "/ssh:" (system-name) ":/:a") (compat-call file-name-quote "/ssh::a")))
+ ;; TODO test TOP argument
+ (should-equal "/:" (file-name-quote ""))
+ (should-equal "/::"(file-name-quote ":"))
+ (should-equal "/:/" (file-name-quote "/"))
+ (should-equal "/:" (file-name-quote "/:"))
+ (should-equal "/:a" (file-name-quote "a"))
+ (should-equal "/::a" (file-name-quote ":a"))
+ (should-equal "/:/a" (file-name-quote "/a"))
+ (should-equal "/:a" (file-name-quote "/:a"))
+ (should-equal (concat "/ssh:" (system-name) ":/:a") (file-name-quote "/ssh::a")))
(ert-deftest file-name-concat ()
(should-equal (file-name-concat "foo" "bar") "foo/bar")
diff --git a/compat.texi b/compat.texi
index 1d5a4ff..37e9d52 100644
--- a/compat.texi
+++ b/compat.texi
@@ -653,6 +653,41 @@ It should be somewhat more efficient on larger buffers than
@end defun
@c copied from lispref/files.texi
+@defun file-name-quoted-p name
+This macro returns non-@code{nil}, when @var{name} is quoted with the
+prefix @samp{/:}. If @var{name} is a remote file name, the local part
+of @var{name} is checked.
+
+@xref{File Name Expansion,,,elisp}.
+@end defun
+
+@c copied from lispref/files.texi
+@defun file-name-quote name
+This macro adds the quotation prefix @samp{/:} to the file @var{name}.
+For a local file @var{name}, it prefixes @var{name} with @samp{/:}. If
+@var{name} is a remote file name, the local part of @var{name}
+(@pxref{Magic File Names,,,elisp}) is quoted. If @var{name} is already
+a quoted file name, @var{name} is returned unchanged.
+
+@example
+@group
+(substitute-in-file-name (compat-call file-name-quote "bar/~/foo")) @result{}
+ "/:bar/~/foo"
+@end group
+
+@group
+(substitute-in-file-name (compat-call file-name-quote "/ssh:host:bar/~/foo"))
+ @result{} "/ssh:host:/:bar/~/foo"
+@end group
+@end example
+
+The macro cannot be used to suppress file name handlers from magic file
+names (@pxref{Magic File Names,,,elisp}).
+
+@xref{File Name Expansion,,,elisp}.
+@end defun
+
+@c copied from lispref/files.texi
@defun make-nearby-temp-file prefix &optional dir-flag suffix
This function is similar to @code{make-temp-file}, but it creates a
temporary file as close as possible to @code{default-directory}. If
@@ -922,47 +957,14 @@ The compatibility version handles the optional arguments @var{trim-left}
and @var{trim-right}.
@end defun
-@c copied from lispref/files.texi
-@defun compat-call@ file-name-quoted-p name
-This macro returns non-@code{nil}, when @var{name} is quoted with the
-prefix @samp{/:}. If @var{name} is a remote file name, the local part
-of @var{name} is checked.
-
-@xref{File Name Expansion,,,elisp}.
-@end defun
-
-@c copied from lispref/files.texi
-@defun compat-call@ file-name-quote name
-This macro adds the quotation prefix @samp{/:} to the file @var{name}.
-For a local file @var{name}, it prefixes @var{name} with @samp{/:}. If
-@var{name} is a remote file name, the local part of @var{name}
-(@pxref{Magic File Names,,,elisp}) is quoted. If @var{name} is already
-a quoted file name, @var{name} is returned unchanged.
-
-@example
-@group
-(substitute-in-file-name (compat-call file-name-quote "bar/~/foo")) @result{}
- "/:bar/~/foo"
-@end group
-
-@group
-(substitute-in-file-name (compat-call file-name-quote "/ssh:host:bar/~/foo"))
- @result{} "/ssh:host:/:bar/~/foo"
-@end group
-@end example
-
-The macro cannot be used to suppress file name handlers from magic file
-names (@pxref{Magic File Names,,,elisp}).
-
-@xref{File Name Expansion,,,elisp}.
-@end defun
-
@subsection Missing Definitions
Compat does not provide support for the following Lisp features
implemented in 26.1:
@itemize
@item
+The function @code{file-name-unquote}.
+@item
The function @code{func-arity}.
@item
The function @code{secure-hash-algorithms}.