From: Nicholas Drozd <nicholasdrozd@gmail.com>
To: 42237@debbugs.gnu.org
Subject: bug#42237: [PATCH] Clean up Tramp version check
Date: Mon, 6 Jul 2020 17:19:48 -0500 [thread overview]
Message-ID: <CABAiW0qiAY=Vbr5Ubort73vRPyG9Xs9OoAucYq5BRbHebBD20Q@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 152 bytes --]
I actually saw the "not fit for" error message in the wild. The source
looked a little strange, so I cleaned it up. This shouldn't change any
behavior.
[-- Attachment #2: 0001-Clean-up-Tramp-version-check.patch --]
[-- Type: text/x-patch, Size: 2411 bytes --]
From 37169e549094ea426d6429f088515e5fc416785c Mon Sep 17 00:00:00 2001
From: Nick Drozd <nicholasdrozd@gmail.com>
Date: Sat, 4 Jul 2020 11:42:49 -0500
Subject: [PATCH] Clean up Tramp version check
* lisp/net/trampver.el
(tramp-minimum-emacs-version, tramp-check-version): New constant, new function
* test/lisp/net/tramp-tests.el
(tramp-test46-version): New test
---
lisp/net/trampver.el | 16 ++++++++++------
test/lisp/net/tramp-tests.el | 8 ++++++++
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 8d21133b3b..42d984dae3 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -69,12 +69,16 @@ tramp-repository-version
(emacs-repository-get-version dir))))
"The repository revision of the Tramp sources.")
-;; Check for Emacs version.
-(let ((x (if (not (string-lessp emacs-version "25.1"))
- "ok"
- (format "Tramp 2.5.0-pre is not fit for %s"
- (replace-regexp-in-string "\n" "" (emacs-version))))))
- (unless (string-equal "ok" x) (error "%s" x)))
+(defconst tramp-minimum-emacs-version "25.1"
+ "The minimum Emacs version required by Tramp.")
+
+(defun tramp-check-version ()
+ "Error if `emacs-version' is less than `tramp-minimum-emacs-version'."
+ (when (string-lessp emacs-version tramp-minimum-emacs-version)
+ (error "Tramp 2.5.0-pre is not fit for %s"
+ (replace-regexp-in-string "\n" "" (emacs-version)))))
+
+(tramp-check-version)
;; Tramp versions integrated into Emacs. If a user option declares a
;; `:package-version' which doesn't belong to an integrated Tramp
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 1f24ba2786..ff112e9c82 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -6557,6 +6557,14 @@ tramp-test45-unload
(ignore-errors (all-completions "tramp" (symbol-value x)))
(ert-fail (format "Hook `%s' still contains Tramp function" x))))))
+(ert-deftest tramp-test46-version ()
+ "Check that the version check checks out."
+ (tramp-check-version)
+ (let ((emacs-version "24.3"))
+ (should-error (tramp-check-version)))
+ (let ((tramp-minimum-emacs-version "30.1"))
+ (should-error (tramp-check-version))))
+
(defun tramp-test-all (&optional interactive)
"Run all tests for \\[tramp].
If INTERACTIVE is non-nil, the tests are run interactively."
--
2.17.1
next reply other threads:[~2020-07-06 22:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-06 22:19 Nicholas Drozd [this message]
2020-07-07 7:19 ` bug#42237: [PATCH] Clean up Tramp version check Michael Albinus
[not found] <CABAiW0oLzyf3hQVFLbML-vpy8B-k+iS4bEj6z__z65tRkVPYZg@mail.gmail.com>
2020-07-12 13:48 ` Michael Albinus
[not found] ` <87tuyczvwn.fsf@gmx.de>
2020-07-12 19:54 ` Nicholas Drozd
[not found] ` <CABAiW0rCjbjQUXR6+PDn34R7Rs264xMeJS=wZ6stp=0iRs4mRA@mail.gmail.com>
2020-07-13 13:06 ` Michael Albinus
[not found] ` <87lfjnzhrk.fsf@gmx.de>
2020-07-13 13:55 ` Michael Albinus
[not found] ` <87ft9vzfhi.fsf@gmx.de>
2020-10-18 15:13 ` Michael Albinus
2020-10-19 17:07 ` Nicholas Drozd
[not found] ` <CABAiW0pOjeMSFicn2=qnmVz830UbvvDBXTb3r51b+DDf9WWfTA@mail.gmail.com>
2020-10-20 9:31 ` Michael Albinus
2020-08-14 9:17 ` Stefan Kangas
2020-08-15 13:40 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CABAiW0qiAY=Vbr5Ubort73vRPyG9Xs9OoAucYq5BRbHebBD20Q@mail.gmail.com' \
--to=nicholasdrozd@gmail.com \
--cc=42237@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.