[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp a6cc16d 4/4: Merge remote-tracking branch 'savahnna/
From: |
Andrea Corallo |
Subject: |
feature/native-comp a6cc16d 4/4: Merge remote-tracking branch 'savahnna/master' into HEAD |
Date: |
Thu, 11 Jun 2020 13:33:50 -0400 (EDT) |
branch: feature/native-comp
commit a6cc16d04ca98bcf38c7ebf4d0c5bf68b6b37369
Merge: ab78ed8 d8a6d2e
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
Merge remote-tracking branch 'savahnna/master' into HEAD
---
doc/misc/tramp.texi | 118 +++++++++++++++++++++++++-
etc/NEWS | 2 +-
lisp/calendar/lunar.el | 17 ++--
lisp/emacs-lisp/cl-macs.el | 8 +-
lisp/facemenu.el | 11 ++-
lisp/faces.el | 40 ++++++---
lisp/net/tramp-crypt.el | 142 ++++++++++++++++++++++----------
lisp/progmodes/cc-fonts.el | 18 ++--
lisp/progmodes/project.el | 21 ++---
lisp/simple.el | 23 +++++-
lisp/textmodes/css-mode.el | 14 +---
src/nsterm.m | 21 +++--
test/lisp/calendar/lunar-tests.el | 70 ++++++++++++++++
test/lisp/emacs-lisp/cl-macs-tests.el | 9 ++
test/lisp/emacs-lisp/generator-tests.el | 7 +-
test/lisp/net/tramp-tests.el | 59 +++++++------
16 files changed, 427 insertions(+), 153 deletions(-)
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index d1688de..176d3a5 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -141,6 +141,7 @@ Configuring @value{tramp} for use
* Remote shell setup:: Remote shell setup hints.
* Android shell setup:: Android shell setup hints.
* Auto-save and Backup:: Auto-save and Backup.
+* Keeping files encrypted:: Protect remote files by encryption.
* Windows setup hints:: Issues with Cygwin ssh.
Using @value{tramp}
@@ -667,6 +668,7 @@ might be used in your init file:
* Remote shell setup:: Remote shell setup hints.
* Android shell setup:: Android shell setup hints.
* Auto-save and Backup:: Auto-save and Backup.
+* Keeping files encrypted:: Protect remote files by encryption.
* Windows setup hints:: Issues with Cygwin ssh.
@end menu
@@ -2648,6 +2650,114 @@ auto-saved files to the same directory as the original
file.
Alternatively, set the user option @code{tramp-auto-save-directory}
to direct all auto saves to that location.
+
+@node Keeping files encrypted
+@section Protect remote files by encryption
+@cindex Encrypt remote directories
+
+Sometimes, it is desirable to protect files located on remote
+directories, like cloud storages. In order to do this, you might
+instruct @value{tramp} to encrypt all files copied to a given remote
+directory, and to decrypt such files when accessing. This includes
+both file contents and file names.
+
+@value{tramp} does this transparently. Although both files and file
+names are encrypted on the remote side, they are accessible inside
+Emacs as they wouldn't be transformed as such.
+
+@cindex @command{encfs}
+@cindex @command{encfsctl}
+Internally, @value{tramp} uses the @command{encfs} package.
+Therefore, this feature is available only if this package is installed
+on the local host. @value{tramp} does not keep and @samp{encfs
+mountpoint} permanently. Instead, it encrypts / decrypts files and
+file names on the fly, using @command{encfsctl}.
+
+@deffn Command tramp-crypt-add-directory name
+This command marks the existing remote directory @var{name} for
+encryption. Files in that directory and all subdirectories will be
+encrypted before copying to, and decrypted after copying from that
+directory. File and directory names will be also encrypted.
+@end deffn
+
+@defopt tramp-crypt-encfs-option
+If a remote directory is marked for encryption, it is initialized via
+@command{encfs} the very first time a file in this directory is
+accessed. This user option controls, which default @command{encfs}
+configuration option will be selected, it can be @t{"--standard"}
+or @t{"--paranoia"}. See the @samp{encfs(1)} man page for details.
+
+However, @value{tramp} must adapt these configuration sets. The
+@code{chainedNameIV} configuration option must be disabled; otherwise
+@value{tramp} couldn't handle file name encryption transparently.
+@end defopt
+
+A password protected @option{encfs} configuration file is created the
+very first time you access an encrypted remote directory. It is kept
+in your @code{user-emacs-directory} with the url-encoded directory
+name as part of the basename, and @file{encfs6.xml} as suffix. If
+you, for example, mark the remote directory
+@file{@trampfn{nextcloud,user@@host,/path/to/dir}} for encryption, the
+configuration file is saved as
+@file{tramp-%2Fnextcloud%3Auser%40host%3A%2Fpath%2Fto%2Fdir%2F.encfs6.xml}
+in @code{user-emacs-directory}. Do not loose this file and the
+corresponding password; otherwise there is no way to decrypt your
+encrypted files.
+
+@defopt tramp-crypt-save-encfs-config-remote
+If this user option is non-nil (the default), the @option{encfs}
+configuration file @file{.encfs6.xml} is also kept in the encrypted
+remote directory. It depends on you, whether you regard the password
+protection of this file as sufficient. The advantage would be, that
+such a remote directory could be accessed by different Emacs sessions,
+different users, without presharing the configuration file between the
+users.
+@end defopt
+
+The command @command{encfsctl}, the workhorse for encryption /
+decryption, needs the configuration file password every call.
+Therefore, it is recommend to cache this password in Emacs. This can
+be done using @code{auth-sources}, @ref{Using an authentication file}.
+An entry needs the url-encoded directory name as machine, your local
+user name as user, and the password. The port is optional, if given
+it must be the string @t{"crypt"}. The example above would require
+the following entry in the authentication file (@t{"yourname"} is the
+result of @code{(user-login-name)}):
+
+@example
+machine %2Fnextcloud%3Auser%40host%3A%2Fpath%2Fto%2Fdir%2F \
+ login yourname port crypt password geheim
+@end example
+
+If you use a remote file name with a quoted localname part, this
+localname and the corresponding file will not be encrypted /
+decrypted. If you have an encrypted remote directory
+@file{@trampfn{nextcloud,user@@host,/path/to/dir}}, the command
+
+@example
+@kbd{C-x d @trampfn{nextcloud,user@@host,/path/to/dir}}
+@end example
+
+@noindent
+will show the directory listing with the plain file names, and the
+command
+
+@example
+@kbd{C-x d @trampfn{nextcloud,user@@host,/:/path/to/dir}}
+@end example
+
+@noindent
+will show the directory listing with the encrypted file names, and
+visiting a file will show its encrypted contents. However, it is
+highly discouraged to mix encrypted and not encrypted files in the
+same directory.
+
+@deffn Command tramp-crypt-add-directory name
+If a remote directory shall not include encrypted files anymore, it
+must be indicated by this command.
+@end deffn
+
+
@node Windows setup hints
@section Issues with Cygwin ssh
@cindex cygwin, issues
@@ -2681,10 +2791,10 @@ Wiki} it is explained how to use the helper program
@cindex @option{scpx} method with cygwin
When using the @option{scpx} access method, Emacs may call
-@command{scp} with MS Windows file naming, such as @code{c:/foo}. But
+@command{scp} with MS Windows file naming, such as @file{c:/foo}. But
the version of @command{scp} that is installed with Cygwin does not
know about MS Windows file naming, which causes it to incorrectly look
-for a host named @code{c}.
+for a host named @samp{c}.
A workaround: write a wrapper script for @option{scp} to convert
Windows file names to Cygwin file names.
@@ -4158,8 +4268,8 @@ Host *
@end group
@end example
-Check @command{man ssh_config} whether these options are supported on
-your proxy host.
+Check the @samp{ssh_config(5)} man page whether these options are
+supported on your proxy host.
@item
diff --git a/etc/NEWS b/etc/NEWS
index 6e94d4a..b0c5236 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -333,7 +333,7 @@ prefix on the Subject line in various languages.
These new navigation commands are bound to 'n' and 'p' in
'apropos-mode'.
-** CC mode
+** CC Mode
*** Added support for Doxygen documentation style.
'doxygen' is now a valid 'c-doc-comment-style' which recognises all
diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el
index 3d5a0a2..1c0f4da 100644
--- a/lisp/calendar/lunar.el
+++ b/lisp/calendar/lunar.el
@@ -1,4 +1,4 @@
-;;; lunar.el --- calendar functions for phases of the moon
+;;; lunar.el --- calendar functions for phases of the moon -*-
lexical-binding:t -*-
;; Copyright (C) 1992-1993, 1995, 1997, 2001-2020 Free Software
;; Foundation, Inc.
@@ -255,6 +255,8 @@ use instead of point."
If called with an optional prefix argument ARG, prompts for month and year.
This function is suitable for execution in an init file."
(interactive "P")
+ (with-suppressed-warnings ((lexical date))
+ (defvar date))
(save-excursion
(let* ((date (if arg (calendar-read-date t)
(calendar-current-date)))
@@ -262,18 +264,17 @@ This function is suitable for execution in an init file."
(displayed-year (calendar-extract-year date)))
(calendar-lunar-phases))))
-;; The function below is designed to be used in sexp diary entries,
-;; and may be present in users' diary files, so suppress the warning
-;; about this prefix-less dynamic variable. It's called from
-;; `diary-list-sexp-entries', which binds the variable.
-(with-suppressed-warnings ((lexical date))
- (defvar date))
-
;;;###diary-autoload
(defun diary-lunar-phases (&optional mark)
"Moon phases diary entry.
An optional parameter MARK specifies a face or single-character string to
use when highlighting the day in the calendar."
+ ;; This function is designed to be used in sexp diary entries, and
+ ;; may be present in users' diary files, so suppress the warning
+ ;; about this prefix-less dynamic variable. It's called from
+ ;; `diary-list-sexp-entries', which binds the variable.
+ (with-suppressed-warnings ((lexical date))
+ (defvar date))
(let* ((index (lunar-index date))
(phase (lunar-phase index)))
(while (calendar-date-compare phase (list date))
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 3317c58..a3e72c4 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -199,7 +199,7 @@ The name is made by appending a number to PREFIX, default
\"T\"."
[&optional ["&key" [cl-&key-arg &rest cl-&key-arg]
&optional "&allow-other-keys"]]
[&optional ["&aux" &rest
- &or (symbolp &optional def-form) symbolp]]
+ &or (cl-lambda-arg &optional def-form) arg]]
. [&or arg nil])))
(def-edebug-spec cl-&optional-arg
@@ -219,7 +219,7 @@ The name is made by appending a number to PREFIX, default
\"T\"."
[&optional ["&key" cl-&key-arg &rest cl-&key-arg
&optional "&allow-other-keys"]]
[&optional ["&aux" &rest
- &or (symbolp &optional def-form) symbolp]]
+ &or (cl-lambda-arg &optional def-form) arg]]
. [&or arg nil])))
(def-edebug-spec cl-type-spec sexp)
@@ -402,7 +402,7 @@ and BODY is implicitly surrounded by (cl-block NAME ...).
arg]]
&optional "&allow-other-keys"]]
[&optional ["&aux" &rest
- &or (symbolp &optional def-form) symbolp]]
+ &or (cl-macro-arg &optional def-form) arg]]
[&optional "&environment" arg]
)))
@@ -421,7 +421,7 @@ and BODY is implicitly surrounded by (cl-block NAME ...).
arg]]
&optional "&allow-other-keys"]]
[&optional ["&aux" &rest
- &or (symbolp &optional def-form) symbolp]]
+ &or (cl-macro-arg &optional def-form) arg]]
. [&or arg nil])))
;;;###autoload
diff --git a/lisp/facemenu.el b/lisp/facemenu.el
index b10d874..419b761 100644
--- a/lisp/facemenu.el
+++ b/lisp/facemenu.el
@@ -621,12 +621,11 @@ color. The function should accept a single argument, the
color name."
(downcase b))))))
(setq color (list color)))
(let* ((opoint (point))
- (color-values (color-values (car color)))
- (light-p (>= (apply 'max color-values)
- (* (car (color-values "white")) .5))))
+ (fg (readable-foreground-color (car color))))
(insert (car color))
(indent-to 22)
- (put-text-property opoint (point) 'face `(:background ,(car color)))
+ (put-text-property opoint (point) 'face `(:background ,(car color)
+ :foreground ,fg))
(put-text-property
(prog1 (point)
(insert " ")
@@ -639,7 +638,7 @@ color. The function should accept a single argument, the
color name."
(insert (propertize
(apply 'format "#%02x%02x%02x"
(mapcar (lambda (c) (ash c -8))
- color-values))
+ (color-values (car color))))
'mouse-face 'highlight
'help-echo
(let ((hsv (apply 'color-rgb-to-hsv
@@ -651,7 +650,7 @@ color. The function should accept a single argument, the
color name."
opoint (point)
'follow-link t
'mouse-face (list :background (car color)
- :foreground (if light-p "black" "white"))
+ :foreground fg)
'color-name (car color)
'action callback-fn)))
(insert "\n"))
diff --git a/lisp/faces.el b/lisp/faces.el
index f4a9ded..8c3e464 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1785,16 +1785,36 @@ with the color they represent as background color."
(defined-colors frame)))
(defun readable-foreground-color (color)
- "Return a readable foreground color for background COLOR."
- (let* ((rgb (color-values color))
- (max (apply #'max rgb))
- (black (car (color-values "black")))
- (white (car (color-values "white"))))
- ;; Select black or white depending on which one is less similar to
- ;; the brightest component.
- (if (> (abs (- max black)) (abs (- max white)))
- "black"
- "white")))
+ "Return a readable foreground color for background COLOR.
+The returned value is a string representing black or white, depending
+on which one provides better contrast with COLOR."
+ ;; We use #ffffff instead of "white", because the latter is sometimes
+ ;; less than white. That way, we get the best contrast possible.
+ (if (color-dark-p (mapcar (lambda (c) (/ c 65535.0))
+ (color-values color)))
+ "#ffffff" "black"))
+
+(defun color-dark-p (rgb)
+ "Whether RGB is more readable against white than black.
+RGB is a 3-element list (R G B), each component in the range [0,1].
+This predicate can be used both for determining a suitable (black or white)
+contrast colour with RGB as background and as foreground."
+ (unless (<= 0 (apply #'min rgb) (apply #'max rgb) 1)
+ (error "RGB components %S not in [0,1]" rgb))
+ ;; Compute the relative luminance after gamma-correcting (assuming sRGB),
+ ;; and compare to a cut-off value determined experimentally.
+ ;; See https://en.wikipedia.org/wiki/Relative_luminance for details.
+ (let* ((sr (nth 0 rgb))
+ (sg (nth 1 rgb))
+ (sb (nth 2 rgb))
+ ;; Gamma-correct the RGB components to linear values.
+ ;; Use the power 2.2 as an approximation to sRGB gamma;
+ ;; it should be good enough for the purpose of this function.
+ (r (expt sr 2.2))
+ (g (expt sg 2.2))
+ (b (expt sb 2.2))
+ (y (+ (* r 0.2126) (* g 0.7152) (* b 0.0722))))
+ (< y (eval-when-compile (expt 0.6 2.2)))))
(declare-function xw-color-defined-p "xfns.c" (color &optional frame))
diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el
index 1df38c3..664f441 100644
--- a/lisp/net/tramp-crypt.el
+++ b/lisp/net/tramp-crypt.el
@@ -44,11 +44,11 @@
;; If the user option `tramp-crypt-save-encfs-config-remote' is
;; non-nil (the default), the encfs configuration file ".encfs6.xml"
-;; is also be kept in the crypted remote directory. It depends,
+;; is also kept in the crypted remote directory. It depends on you,
;; whether you regard the password protection of this file as
;; sufficient.
-;; If you apply an operation with a quoted localname part, this
+;; If you use a remote file name with a quoted localname part, this
;; localname and the corresponding file will not be encrypted/
;; decrypted. For example, if you have a crypted remote directory
;; "/nextcloud:user@host:/crypted_dir", the command
@@ -67,8 +67,6 @@
;; If a remote directory shall not include crypted files anymore, it
;; must be indicated by the command `tramp-crypt-remove-directory'.
-;; Existing crypted files will be transformed into their unencrypted
-;; file names and contents.
;;; Code:
@@ -114,6 +112,7 @@ initializing a new crypted remote directory."
"Non-nil when encryption support is available.")
(setq tramp-crypt-enabled (executable-find tramp-crypt-encfs-program))
+;;;###tramp-autoload
(defconst tramp-crypt-encfs-config ".encfs6.xml"
"Encfs configuration file name.")
@@ -123,6 +122,25 @@ initializing a new crypted remote directory."
:version "28.1"
:type 'booleanp)
+;;;###tramp-autoload
+(defvar tramp-crypt-directories nil
+ "List of crypted remote directories.")
+
+;; It must be a `defsubst' in order to push the whole code into
+;; tramp-loaddefs.el. Otherwise, there would be recursive autoloading.
+;;;###tramp-autoload
+(defsubst tramp-crypt-file-name-p (name)
+ "Return the crypted remote directory NAME belongs to.
+If NAME doesn't belong to a crypted remote directory, retun nil."
+ (catch 'crypt-file-name-p
+ (and tramp-crypt-enabled (stringp name)
+ (not (tramp-compat-file-name-quoted-p name))
+ (not (string-suffix-p tramp-crypt-encfs-config name))
+ (dolist (dir tramp-crypt-directories)
+ (and (string-prefix-p
+ dir (file-name-as-directory (expand-file-name name)))
+ (throw 'crypt-file-name-p dir))))))
+
;; New handlers should be added here.
;;;###tramp-autoload
@@ -140,7 +158,7 @@ initializing a new crypted remote directory."
(directory-files-and-attributes
. tramp-handle-directory-files-and-attributes)
(dired-compress-file . ignore)
- ;; (dired-uncache . tramp-crypt-handle-dired-uncache)
+ (dired-uncache . tramp-handle-dired-uncache)
(exec-path . ignore)
;; `expand-file-name' performed by default handler.
(file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
@@ -153,10 +171,10 @@ initializing a new crypted remote directory."
(file-in-directory-p . tramp-handle-file-in-directory-p)
(file-local-copy . tramp-handle-file-local-copy)
(file-modes . tramp-handle-file-modes)
- ;; (file-name-all-completions .
tramp-crypt-handle-file-name-all-completions)
+ (file-name-all-completions . tramp-crypt-handle-file-name-all-completions)
;; `file-name-as-directory' performed by default handler.
- ;; (file-name-case-insensitive-p . ignore)
- ;; (file-name-completion . tramp-handle-file-name-completion)
+ (file-name-case-insensitive-p . ignore)
+ (file-name-completion . tramp-handle-file-name-completion)
;; `file-name-directory' performed by default handler.
;; `file-name-nondirectory' performed by default handler.
;; `file-name-sans-versions' performed by default handler.
@@ -173,11 +191,11 @@ initializing a new crypted remote directory."
(file-system-info . tramp-crypt-handle-file-system-info)
;; (file-truename . tramp-crypt-handle-file-truename)
;; (file-writable-p . ignore)
- (find-backup-file-name . ignore)
+ (find-backup-file-name . tramp-handle-find-backup-file-name)
;; `get-file-buffer' performed by default handler.
(insert-directory . tramp-crypt-handle-insert-directory)
;; `insert-file-contents' performed by default handler.
- ;; (load . tramp-crypt-handle-load)
+ (load . tramp-handle-load)
(make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
(make-directory . tramp-crypt-handle-make-directory)
;; (make-directory-internal . tramp-crypt-handle-not-implemented)
@@ -189,16 +207,16 @@ initializing a new crypted remote directory."
(set-file-acl . ignore)
(set-file-modes . tramp-crypt-handle-set-file-modes)
(set-file-selinux-context . ignore)
- ;; (set-file-times . tramp-crypt-handle-not-implemented)
- ;; (set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
+ (set-file-times . tramp-crypt-handle-set-file-times)
+ (set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
(shell-command . ignore)
(start-file-process . ignore)
;; `substitute-in-file-name' performed by default handler.
;; (temporary-file-directory . tramp-crypt-handle-temporary-file-directory)
- ;; `tramp-set-file-uid-gid' performed by default handler.
+ (tramp-set-file-uid-gid . tramp-crypt-handle-set-file-uid-gid)
;; (unhandled-file-name-directory . ignore)
(vc-registered . ignore)
- ;; (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
+ (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
(write-region . tramp-handle-write-region))
"Alist of handler functions for crypt method.
Operations not mentioned here will be handled by the default Emacs
primitives.")
@@ -249,22 +267,6 @@ arguments to pass to the OPERATION."
;; File name conversions.
-;;;###tramp-autoload
-(defvar tramp-crypt-directories nil
- "List of crypted remote directories.")
-
-(defun tramp-crypt-file-name-p (name)
- "Return the crypted remote directory NAME belongs to.
-If NAME doesn't belong to a crypted remote directory, retun nil."
- (catch 'crypt-file-name-p
- (and tramp-crypt-enabled (stringp name)
- (not (tramp-compat-file-name-quoted-p name))
- (not (string-suffix-p tramp-crypt-encfs-config name))
- (dolist (dir tramp-crypt-directories)
- (and (string-prefix-p
- dir (file-name-as-directory (expand-file-name name)))
- (throw 'crypt-file-name-p dir))))))
-
(defun tramp-crypt-config-file-name (vec)
"Return the encfs config file name for VEC."
(expand-file-name
@@ -332,7 +334,6 @@ connection if a previous connection has died for some
reason."
(with-temp-file local-config
(insert-file-contents
(expand-file-name tramp-crypt-encfs-config tmpdir1))
- (goto-char (point-min))
(when (search-forward
"<chainedNameIV>1</chainedNameIV>" nil 'noerror)
(replace-match "<chainedNameIV>0</chainedNameIV>")))
@@ -425,12 +426,13 @@ If OP ist `decrypt', the basename of INFILE must be an
encrypted file name."
(dir (tramp-crypt-file-name-p root))
(crypt-vec (tramp-crypt-dissect-file-name dir)))
(let ((coding-system-for-read
- (if (eq op 'decrypt) 'raw-text coding-system-for-read))
+ (if (eq op 'decrypt) 'binary coding-system-for-read))
(coding-system-for-write
- (if (eq op 'encrypt) 'raw-text coding-system-for-write)))
+ (if (eq op 'encrypt) 'binary coding-system-for-write)))
(tramp-crypt-send-command
crypt-vec "cat" (and (eq op 'encrypt) "--reverse")
- (file-name-directory infile) (file-name-nondirectory infile))
+ (file-name-directory infile)
+ (concat "/" (file-name-nondirectory infile)))
(with-current-buffer (tramp-get-connection-buffer crypt-vec)
(write-region nil nil outfile)))))
@@ -448,18 +450,35 @@ See `tramp-crypt-do-encrypt-or-decrypt-file'."
(defun tramp-crypt-add-directory (name)
"Mark remote directory NAME for encryption.
Files in that directory and all subdirectories will be encrypted
-bofore copying to, and decrypted after copying from that
+before copying to, and decrypted after copying from that
directory. File names will be also encrypted."
(interactive "DRemote directory name: ")
(unless tramp-crypt-enabled
(tramp-user-error nil "Feature is not enabled."))
(unless (and (tramp-tramp-file-p name) (file-directory-p name))
(tramp-user-error nil "%s must be an existing remote directory." name))
- (setq name (file-name-as-directory name))
+ (setq name (file-name-as-directory (expand-file-name name)))
(unless (member name tramp-crypt-directories)
- (setq tramp-crypt-directories `(,name . ,tramp-crypt-directories)))
+ (setq tramp-crypt-directories (cons name tramp-crypt-directories)))
(tramp-register-file-name-handlers))
+(defun tramp-crypt-remove-directory (name)
+ "Unmark remote directory NAME for encryption.
+Existing files in that directory and its subdirectories will be
+kept in their encrypted form."
+ (interactive "DRemote directory name: ")
+ (unless tramp-crypt-enabled
+ (tramp-user-error nil "Feature is not enabled."))
+ (setq name (file-name-as-directory (expand-file-name name)))
+ (when (and (member name tramp-crypt-directories)
+ (delete
+ tramp-crypt-encfs-config
+ (directory-files name nil directory-files-no-dot-files-regexp))
+ (yes-or-no-p
+ "There exist encrypted files, do you want to continue? "))
+ (setq tramp-crypt-directories (delete name tramp-crypt-directories))
+ (tramp-register-file-name-handlers)))
+
;; `auth-source' requires a user.
(defun tramp-crypt-dissect-file-name (name)
"Return a `tramp-file-name' structure for NAME.
@@ -643,18 +662,35 @@ absolute file names."
(defun tramp-crypt-handle-file-executable-p (filename)
"Like `file-executable-p' for Tramp files."
- (tramp-crypt-run-real-handler
- #'file-executable-p (list (tramp-crypt-encrypt-file-name filename))))
+ (let (tramp-crypt-enabled)
+ (file-executable-p (tramp-crypt-encrypt-file-name filename))))
+
+(defun tramp-crypt-handle-file-name-all-completions (filename directory)
+ "Like `file-name-all-completions' for Tramp files."
+ (all-completions
+ filename
+ (let* (completion-regexp-list
+ tramp-crypt-enabled
+ (directory (file-name-as-directory directory))
+ (enc-dir (tramp-crypt-encrypt-file-name directory)))
+ (mapcar
+ (lambda (x)
+ (substring
+ (tramp-crypt-decrypt-file-name (concat enc-dir x))
+ (length directory)))
+ (file-name-all-completions "" enc-dir)))))
(defun tramp-crypt-handle-file-readable-p (filename)
"Like `file-readable-p' for Tramp files."
- (tramp-crypt-run-real-handler
- #'file-readable-p (list (tramp-crypt-encrypt-file-name filename))))
+ (let (tramp-crypt-enabled)
+ (file-readable-p (tramp-crypt-encrypt-file-name filename))))
(defun tramp-crypt-handle-file-system-info (filename)
"Like `file-system-info' for Tramp files."
(tramp-crypt-run-real-handler
- #'file-system-info (list (tramp-crypt-encrypt-file-name filename))))
+ ;; `file-system-info' exists since Emacs 27.1. Then, we can use
+ ;; #'file-system-info.
+ 'file-system-info (list (tramp-crypt-encrypt-file-name filename))))
(defun tramp-crypt-handle-insert-directory
(filename switches &optional wildcard full-directory-p)
@@ -710,9 +746,25 @@ absolute file names."
"Like `set-file-modes' for Tramp files."
(with-parsed-tramp-file-name filename nil
(tramp-flush-file-properties v localname)
- (tramp-crypt-run-real-handler
- #'set-file-modes
- (list (tramp-crypt-encrypt-file-name filename) mode flag))))
+ (let (tramp-crypt-enabled)
+ (tramp-compat-set-file-modes
+ (tramp-crypt-encrypt-file-name filename) mode flag))))
+
+(defun tramp-crypt-handle-set-file-times (filename &optional time flag)
+ "Like `set-file-times' for Tramp files."
+ (with-parsed-tramp-file-name filename nil
+ (tramp-flush-file-properties v localname)
+ (let (tramp-crypt-enabled)
+ (tramp-compat-set-file-times
+ (tramp-crypt-encrypt-file-name filename) time flag))))
+
+(defun tramp-crypt-handle-set-file-uid-gid (filename &optional uid gid)
+ "Like `tramp-set-file-uid-gid' for Tramp files."
+ (with-parsed-tramp-file-name filename nil
+ (tramp-flush-file-properties v localname)
+ (let (tramp-crypt-enabled)
+ (tramp-set-file-uid-gid
+ (tramp-crypt-encrypt-file-name filename) uid gid))))
(add-hook 'tramp-unload-hook
(lambda ()
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 9ea08a4..386cc2f 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -3024,18 +3024,18 @@ need for `pike-font-lock-extra-types'.")
;; needed to do that efficiently.
`((,(concat
;; Make sure that the special character has not been escaped. E.g. in
- ;; ‘\@foo’ only ‘\@’ is a command (similarly for other characters like
- ;; ‘\\foo’, ‘\<foo’ and ‘\&foo’). The downside now is that we don’t
+ ;; `\@foo' only `\@' is a command (similarly for other characters like
+ ;; `\\foo', `\<foo' and `\&foo'). The downside now is that we don't
;; match command started just after an escaped character, e.g. in
- ;; ‘\@\foo’ we should match ‘\@’ as well as ‘\foo’ but only the former
+ ;; `\@\foo' we should match `\@' as well as `\foo' but only the former
;; is matched.
"\\(?:^\\|[^\\@]\\)\\("
;; Doxygen commands start with backslash or an at sign. Note that for
- ;; brevity in the comments only ‘\’ will be mentioned.
+ ;; brevity in the comments only `\' will be mentioned.
"[\\@]\\(?:"
- ;; Doxygen commands except those starting with ‘f’
+ ;; Doxygen commands except those starting with `f'
"[a-eg-z][a-z]*"
- ;; Doxygen command starting with ‘f’:
+ ;; Doxygen command starting with `f':
"\\|f\\(?:"
"[][$}]" ; \f$ \f} \f[ \f]
"\\|{\\(?:[a-zA-Z]+\\*?}{?\\)?" ; \f{ \f{env} \f{env}{
@@ -3062,8 +3062,8 @@ need for `pike-font-lock-extra-types'.")
;; Autolinking. Doxygen auto-links anything that is a class name but we
have
;; no hope of matching those. We are, however, able to match functions and
;; members using explicit scoped syntax. For functions, we can also find
- ;; them by noticing argument-list. Note that Doxygen accepts ‘::’ as well
- ;; as ‘#’ as scope operators.
+ ;; them by noticing argument-list. Note that Doxygen accepts `::' as well
+ ;; as `#' as scope operators.
(,(let* ((ref "[\\@]ref\\s-+")
(ref-opt (concat "\\(?:" ref "\\)?"))
(id "[a-zA-Z_][a-zA-Z_0-9]*")
@@ -3079,7 +3079,7 @@ need for `pike-font-lock-extra-types'.")
"\\)"))
1 font-lock-function-name-face prepend nil)
;; Match URLs and emails. This has two purposes. First of all, Doxygen
- ;; autolinks URLs. Second of all, ‘@bar’ in ‘foo@bar.baz’ has been matched
+ ;; autolinks URLs. Second of all, `@bar' in `foo@bar.baz' has been matched
;; above as a command; try and overwrite it.
(,(let* ((host "[A-Za-z0-9]\\(?:[A-Za-z0-9-]\\{0,61\\}[A-Za-z0-9]\\)")
(fqdn (concat "\\(?:" host "\\.\\)+" host))
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 4d57fb2..f3df44f 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -763,13 +763,7 @@ Arguments the same as in `compile'."
(when (file-exists-p filename)
(with-temp-buffer
(insert-file-contents filename)
- (let ((dirs (split-string (buffer-string) "\n" t))
- (project-list '()))
- (dolist (dir dirs)
- (cl-pushnew (file-name-as-directory dir)
- project-list
- :test #'equal))
- (reverse project-list)))))))
+ (read (current-buffer)))))))
(defun project--ensure-read-project-list ()
"Initialize `project--list' if it hasn't already been."
@@ -780,7 +774,8 @@ Arguments the same as in `compile'."
"Persist `project--list' to the project list file."
(let ((filename project-list-file))
(with-temp-buffer
- (insert (string-join project--list "\n"))
+ (insert ";;; -*- lisp-data -*-\n")
+ (pp project--list (current-buffer))
(write-region nil nil filename nil 'silent))))
(defun project--add-to-project-list-front (pr)
@@ -788,9 +783,9 @@ Arguments the same as in `compile'."
Save the result to disk if the project list was changed."
(project--ensure-read-project-list)
(let ((dir (project-root pr)))
- (unless (equal (car project--list) dir)
- (setq project--list (delete dir project--list))
- (push dir project--list)
+ (unless (equal (caar project--list) dir)
+ (setq project--list (assoc-delete-all dir project--list))
+ (push (list dir) project--list)
(project--write-project-list))))
(defun project--remove-from-project-list (pr-dir)
@@ -798,8 +793,8 @@ Save the result to disk if the project list was changed."
If the directory was in the list before the removal, save the
result to disk."
(project--ensure-read-project-list)
- (when (member pr-dir project--list)
- (setq project--list (delete pr-dir project--list))
+ (when (assoc pr-dir project--list)
+ (setq project--list (assoc-delete-all pr-dir project--list))
(message "Project `%s' not found; removed from list" pr-dir)
(project--write-project-list)))
diff --git a/lisp/simple.el b/lisp/simple.el
index 247769e..0fe8a10 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3978,7 +3978,7 @@ interactively, this is t."
exit-status)
;; Unless a single contiguous chunk is selected, operate on multiple
chunks.
(if region-noncontiguous-p
- (let ((input (concat (funcall region-extract-function 'delete) "\n"))
+ (let ((input (concat (funcall region-extract-function (when replace
'delete)) "\n"))
output)
(with-temp-buffer
(insert input)
@@ -3986,9 +3986,24 @@ interactively, this is t."
shell-file-name t t
nil shell-command-switch
command)
- (setq output (split-string (buffer-string) "\n")))
- (goto-char start)
- (funcall region-insert-function output))
+ (setq output (split-string (buffer-substring
+ (point-min)
+ ;; Trim the trailing newline.
+ (if (eq (char-before (point-max)) ?\n)
+ (1- (point-max))
+ (point-max)))
+ "\n")))
+ (cond
+ (replace
+ (goto-char start)
+ (funcall region-insert-function output))
+ (t
+ (let ((buffer (get-buffer-create
+ (or output-buffer "*Shell Command Output*"))))
+ (with-current-buffer buffer
+ (erase-buffer)
+ (funcall region-insert-function output))
+ (display-message-or-buffer buffer)))))
(if (or replace
(and output-buffer
(not (or (bufferp output-buffer) (stringp output-buffer)))))
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 0035c5e..2cd9978 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -1149,17 +1149,6 @@ returns, point will be at the end of the recognized
color."
;; Evaluate to the color if the name is found.
((css--named-color start-point match))))
-(defun css--contrasty-color (name)
- "Return a color that contrasts with NAME.
-NAME is of any form accepted by `color-distance'.
-The returned color will be usable by Emacs and will contrast
-with NAME; in particular so that if NAME is used as a background
-color, the returned color can be used as the foreground and still
-be readable."
- ;; See bug#25525 for a discussion of this.
- (if (> (color-distance name "black") 292485)
- "black" "white"))
-
(defcustom css-fontify-colors t
"Whether CSS colors should be fontified using the color as the background.
When non-`nil', a text representing CSS color will be fontified
@@ -1199,7 +1188,8 @@ START and END are buffer positions."
(add-text-properties
start (point)
(list 'face (list :background color
- :foreground (css--contrasty-color color)
+ :foreground (readable-foreground-color
+ color)
:box '(:line-width -1))))))))))))
extended-region))
diff --git a/src/nsterm.m b/src/nsterm.m
index 1953138..3dc7e1d 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2399,20 +2399,23 @@ ns_get_color (const char *name, NSColor **col)
scaling = (snprintf (hex, sizeof hex, "%s", name + 4) - 2) / 3;
else if (name[0] == '#') /* An old X11 format; convert to newer */
{
- int len = (strlen(name) - 1);
- int start = (len % 3 == 0) ? 1 : len / 4 + 1;
- int i;
- scaling = strlen(name+start) / 3;
- for (i = 0; i < 3; i++)
- sprintf (hex + i * (scaling + 1), "%.*s/", scaling,
- name + start + i * scaling);
- hex[3 * (scaling + 1) - 1] = '\0';
+ int len = 0;
+ while (isxdigit (name[len + 1]))
+ len++;
+ if (name[len + 1] == '\0' && len >= 1 && len <= 12 && len % 3 == 0)
+ {
+ scaling = len / 3;
+ for (int i = 0; i < 3; i++)
+ sprintf (hex + i * (scaling + 1), "%.*s/", scaling,
+ name + 1 + i * scaling);
+ hex[3 * (scaling + 1) - 1] = '\0';
+ }
}
if (hex[0])
{
unsigned int rr, gg, bb;
- float fscale = scaling == 4 ? 65535.0 : (scaling == 2 ? 255.0 : 15.0);
+ float fscale = (1 << (scaling * 4)) - 1;
if (sscanf (hex, "%x/%x/%x", &rr, &gg, &bb))
{
r = rr / fscale;
diff --git a/test/lisp/calendar/lunar-tests.el
b/test/lisp/calendar/lunar-tests.el
new file mode 100644
index 0000000..8d8a988
--- /dev/null
+++ b/test/lisp/calendar/lunar-tests.el
@@ -0,0 +1,70 @@
+;;; lunar-tests.el --- tests for calendar/lunar.el -*- lexical-binding:t -*-
+
+;; Copyright (C) 2020 Free Software Foundation, Inc.
+
+;; Author: Stefan Kangas <stefankangas@gmail.com>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'ert)
+(require 'lunar)
+
+(defmacro with-lunar-test (&rest body)
+ `(let ((calendar-latitude 40.1)
+ (calendar-longitude -88.2)
+ (calendar-location-name "Urbana, IL")
+ (calendar-time-zone -360)
+ (calendar-standard-time-zone-name "CST")
+ (calendar-time-display-form '(12-hours ":" minutes am-pm)))
+ ,@body))
+
+(ert-deftest lunar-test-phase ()
+ (with-lunar-test
+ (should (equal (lunar-phase 1)
+ '((1 7 1900) "11:40pm" 1 "")))))
+
+(ert-deftest lunar-test-eclipse-check ()
+ (with-lunar-test
+ (should (equal (eclipse-check 1 1) "** Eclipse **"))))
+
+(ert-deftest lunar-test-phase-list ()
+ (with-lunar-test
+ (should (equal (lunar-phase-list 3 1871)
+ '(((3 20 1871) "11:03pm" 0 "")
+ ((3 29 1871) "1:46am" 1 "** Eclipse **")
+ ((4 5 1871) "9:20am" 2 "")
+ ((4 12 1871) "12:57am" 3 "** Eclipse possible **")
+ ((4 19 1871) "2:06pm" 0 "")
+ ((4 27 1871) "6:49pm" 1 "")
+ ((5 4 1871) "5:57pm" 2 "")
+ ((5 11 1871) "9:29am" 3 "")
+ ((5 19 1871) "5:46am" 0 "")
+ ((5 27 1871) "8:02am" 1 ""))))))
+
+(ert-deftest lunar-test-new-moon-time ()
+ (with-lunar-test
+ (should (= (round (lunar-new-moon-time 1))
+ 2451580))))
+
+(ert-deftest lunar-test-new-moon-on-or-after ()
+ (with-lunar-test
+ (should (= (round (lunar-new-moon-on-or-after
(calendar-absolute-from-gregorian '(5 5 1818))))
+ 664525))))
+
+(provide 'lunar-tests)
+;;; lunar-tests.el ends here
diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el
b/test/lisp/emacs-lisp/cl-macs-tests.el
index 24bbad0..29ae95e 100644
--- a/test/lisp/emacs-lisp/cl-macs-tests.el
+++ b/test/lisp/emacs-lisp/cl-macs-tests.el
@@ -601,4 +601,13 @@ collection clause."
collect y into result1
finally return (equal (nreverse result) result1))))
+(ert-deftest cl-macs-aux-edebug ()
+ "Check that Bug#40431 is fixed."
+ (with-temp-buffer
+ (prin1 '(cl-defun cl-macs-aux-edebug-test-fun (&aux ((a . b) '(1 . 2)))
+ (list a b))
+ (current-buffer))
+ ;; Just make sure the function can be instrumented.
+ (edebug-defun)))
+
;;; cl-macs-tests.el ends here
diff --git a/test/lisp/emacs-lisp/generator-tests.el
b/test/lisp/emacs-lisp/generator-tests.el
index 0d325f1..bcfab20 100644
--- a/test/lisp/emacs-lisp/generator-tests.el
+++ b/test/lisp/emacs-lisp/generator-tests.el
@@ -26,6 +26,8 @@
(require 'ert)
(require 'cl-lib)
+;;; Code:
+
(defun generator-list-subrs ()
(cl-loop for x being the symbols
when (and (fboundp x)
@@ -38,8 +40,7 @@
`cps-testcase' defines an ERT testcase called NAME that evaluates
BODY twice: once using ordinary `eval' and once using
lambda-generators. The test ensures that the two forms produce
-identical output.
-"
+identical output."
`(progn
(ert-deftest ,name ()
(should
@@ -302,3 +303,5 @@ identical output.
(lambda (it) (- it))
(1+ it)))))))
-2)))
+
+;;; generator-tests.el ends here
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 25faf4e..578da41 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2294,16 +2294,25 @@ This checks also `file-name-as-directory',
`file-name-directory',
(unwind-protect
(with-temp-buffer
(write-region "foo" nil tmp-name)
- (insert-file-contents tmp-name)
- (should (string-equal (buffer-string) "foo"))
- (insert-file-contents tmp-name)
- (should (string-equal (buffer-string) "foofoo"))
+ (let ((point (point)))
+ (insert-file-contents tmp-name)
+ (should (string-equal (buffer-string) "foo"))
+ (should (= point (point))))
+ (goto-char (1+ (point)))
+ (let ((point (point)))
+ (insert-file-contents tmp-name)
+ (should (string-equal (buffer-string) "ffoooo"))
+ (should (= point (point))))
;; Insert partly.
- (insert-file-contents tmp-name nil 1 3)
- (should (string-equal (buffer-string) "oofoofoo"))
+ (let ((point (point)))
+ (insert-file-contents tmp-name nil 1 3)
+ (should (string-equal (buffer-string) "foofoooo"))
+ (should (= point (point))))
;; Replace.
- (insert-file-contents tmp-name nil nil nil 'replace)
- (should (string-equal (buffer-string) "foo"))
+ (let ((point (point)))
+ (insert-file-contents tmp-name nil nil nil 'replace)
+ (should (string-equal (buffer-string) "foo"))
+ (should (= point (point))))
;; Error case.
(delete-file tmp-name)
(should-error
@@ -3815,7 +3824,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
"Check that `file-acl' and `set-file-acl' work proper."
(skip-unless (tramp--test-enabled))
(skip-unless (file-acl tramp-test-temporary-file-directory))
- (skip-unless (null (tramp--test-crypt-p)))
+ (skip-unless (not (tramp--test-crypt-p)))
;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
(dolist (quoted (if (and (tramp--test-expensive-test)
(tramp--test-emacs27-p))
@@ -3894,7 +3903,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
(skip-unless
(not (equal (file-selinux-context tramp-test-temporary-file-directory)
'(nil nil nil nil))))
- (skip-unless (null (tramp--test-crypt-p)))
+ (skip-unless (not (tramp--test-crypt-p)))
;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
(dolist (quoted (if (and (tramp--test-expensive-test)
(tramp--test-emacs27-p))
@@ -4198,7 +4207,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
(skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p)))
- (skip-unless (null (tramp--test-crypt-p)))
+ (skip-unless (not (tramp--test-crypt-p)))
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
(let* ((tmp-name (tramp--test-make-temp-name nil quoted))
@@ -4277,7 +4286,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
(skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p)))
- (skip-unless (null (tramp--test-crypt-p)))
+ (skip-unless (not (tramp--test-crypt-p)))
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
(let ((default-directory tramp-test-temporary-file-directory)
@@ -4351,7 +4360,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
(skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p)))
- (skip-unless (null (tramp--test-crypt-p)))
+ (skip-unless (not (tramp--test-crypt-p)))
;; `make-process' supports file name handlers since Emacs 27.
(skip-unless (tramp--test-emacs27-p))
@@ -4522,7 +4531,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
(skip-unless (tramp--test-sh-p))
- (skip-unless (null (tramp--test-crypt-p)))
+ (skip-unless (not (tramp--test-crypt-p)))
;; Since Emacs 26.1.
(skip-unless (boundp 'interrupt-process-functions))
@@ -4583,7 +4592,7 @@ INPUT, if non-nil, is a string sent to the process."
;; remote processes in Emacs. That doesn't work for tramp-adb.el.
(skip-unless (or (and (tramp--test-adb-p) (tramp--test-emacs27-p))
(tramp--test-sh-p)))
- (skip-unless (null (tramp--test-crypt-p)))
+ (skip-unless (not (tramp--test-crypt-p)))
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
(let ((tmp-name (tramp--test-make-temp-name nil quoted))
@@ -4675,7 +4684,7 @@ INPUT, if non-nil, is a string sent to the process."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
(skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p)))
- (skip-unless (null (tramp--test-crypt-p)))
+ (skip-unless (not (tramp--test-crypt-p)))
;; Prior Emacs 27, `shell-command-dont-erase-buffer' wasn't working properly.
(skip-unless (tramp--test-emacs27-p))
@@ -4888,7 +4897,7 @@ INPUT, if non-nil, is a string sent to the process."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
(skip-unless (tramp--test-sh-p))
- (skip-unless (null (tramp--test-crypt-p)))
+ (skip-unless (not (tramp--test-crypt-p)))
(dolist (this-shell-command-to-string
'(;; Synchronously.
@@ -4975,7 +4984,7 @@ INPUT, if non-nil, is a string sent to the process."
;; We test it only for the mock-up connection; otherwise there might
;; be problems with the used ports.
(skip-unless (and (eq tramp-syntax 'default) (tramp--test-mock-p)))
- (skip-unless (null (tramp--test-crypt-p)))
+ (skip-unless (not (tramp--test-crypt-p)))
;; We force a reconnect, in order to have a clean environment.
(dolist (dir `(,tramp-test-temporary-file-directory
@@ -5080,7 +5089,7 @@ INPUT, if non-nil, is a string sent to the process."
;; remote processes in Emacs. That doesn't work for tramp-adb.el.
(skip-unless (or (and (tramp--test-adb-p) (tramp--test-emacs27-p))
(tramp--test-sh-p)))
- (skip-unless (null (tramp--test-crypt-p)))
+ (skip-unless (not (tramp--test-crypt-p)))
;; Since Emacs 26.1.
(skip-unless (and (fboundp 'connection-local-set-profile-variables)
(fboundp 'connection-local-set-profiles)))
@@ -5137,7 +5146,7 @@ INPUT, if non-nil, is a string sent to the process."
"Check `exec-path' and `executable-find'."
(skip-unless (tramp--test-enabled))
(skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p)))
- (skip-unless (null (tramp--test-crypt-p)))
+ (skip-unless (not (tramp--test-crypt-p)))
;; Since Emacs 27.1.
(skip-unless (fboundp 'exec-path))
@@ -5181,7 +5190,7 @@ INPUT, if non-nil, is a string sent to the process."
"Check loooong `tramp-remote-path'."
(skip-unless (tramp--test-enabled))
(skip-unless (tramp--test-sh-p))
- (skip-unless (null (tramp--test-crypt-p)))
+ (skip-unless (not (tramp--test-crypt-p)))
;; Since Emacs 27.1.
(skip-unless (fboundp 'exec-path))
@@ -5246,7 +5255,7 @@ INPUT, if non-nil, is a string sent to the process."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
(skip-unless (tramp--test-sh-p))
- (skip-unless (null (tramp--test-crypt-p)))
+ (skip-unless (not (tramp--test-crypt-p)))
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
;; We must use `file-truename' for the temporary directory, in
@@ -5595,8 +5604,6 @@ This does not support some special file names."
(string-equal
"docker" (file-remote-p tramp-test-temporary-file-directory 'method)))
-(require 'tramp-crypt)
-
(defun tramp--test-crypt-p ()
"Check, whether the remote directory is crypted"
(tramp-crypt-file-name-p tramp-test-temporary-file-directory))
@@ -5837,7 +5844,7 @@ This requires restrictions of file name syntax."
;; We do not run on macOS due to encoding problems. See
;; Bug#36940.
(when (and (tramp--test-expensive-test) (tramp--test-sh-p)
- (null (tramp--test-crypt-p))
+ (not (tramp--test-crypt-p))
(not (eq system-type 'darwin)))
(dolist (elt files)
(let ((envvar (concat "VAR_" (upcase (md5 elt))))
@@ -6170,7 +6177,7 @@ process sentinels. They shall not disturb each other."
;; remote processes in Emacs. That doesn't work for tramp-adb.el.
(skip-unless (or (and (tramp--test-adb-p) (tramp--test-emacs27-p))
(tramp--test-sh-p)))
- (skip-unless (null (tramp--test-crypt-p)))
+ (skip-unless (not (tramp--test-crypt-p)))
(with-timeout
(tramp--test-asynchronous-requests-timeout (tramp--test-timeout-handler))