aboutsummaryrefslogtreecommitdiff
path: root/test/test-lib.el
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2020-04-25 22:18:07 +0200
committerDavid Bremner <david@tethera.net>2020-04-27 07:36:10 -0300
commit11ac932a4503872c19987b843d58513c4b9ef76f (patch)
tree6de8150bae61955b2b25e860390e9e4b3367596b /test/test-lib.el
parent7b756d1e3885b70e81647a85432e0f2d043167c9 (diff)
emacs: Use `cl-lib' instead of deprecated `cl'
Starting with Emacs 27 the old `cl' implementation is finally considered obsolete. Previously its use was strongly discouraged at run-time but one was still allowed to use it at compile-time. For the most part the transition is very simple and boils down to adding the "cl-" prefix to some symbols. A few replacements do not follow that simple pattern; e.g. `first' is replaced with `car', even though the alias `cl-first' exists, because the latter is not idiomatic emacs-lisp. In a few cases we start using `pcase-let' or `pcase-lambda' instead of renaming e.g. `first' to `car'. That way we can remind the reader of the meaning of the various parts of the data that is being deconstructed. An obsolete `lexical-let' and a `lexical-let*' are replaced with their regular variants `let' and `let*' even though we do not at the same time enable `lexical-binding' for that file. That is the right thing to do because it does not actually make a difference in those cases whether lexical bindings are used or not, and because this should be enabled in a separate commit. We need to explicitly depend on the `cl-lib' package because Emacs 24.1 and 24.2 lack that library. When using these releases we end up using the backport from GNU Elpa. We need to explicitly require the `pcase' library because `pcase-dolist' was not autoloaded until Emacs 25.1.
Diffstat (limited to 'test/test-lib.el')
-rw-r--r--test/test-lib.el18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/test-lib.el b/test/test-lib.el
index 9946010b..3ae7a090 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -20,7 +20,7 @@
;;
;; Authors: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
-(require 'cl) ;; This code is generally used uncompiled.
+(require 'cl-lib)
;; `read-file-name' by default uses `completing-read' function to read
;; user input. It does not respect `standard-input' variable which we
@@ -116,10 +116,10 @@ nothing."
(defadvice notmuch-search-process-filter (around pessimal activate disable)
"Feed notmuch-search-process-filter one character at a time."
(let ((string (ad-get-arg 1)))
- (loop for char across string
- do (progn
- (ad-set-arg 1 (char-to-string char))
- ad-do-it))))
+ (cl-loop for char across string
+ do (progn
+ (ad-set-arg 1 (char-to-string char))
+ ad-do-it))))
(defun notmuch-test-mark-links ()
"Enclose links in the current buffer with << and >>."
@@ -162,10 +162,10 @@ nothing."
;; reporting differing elements of OUTPUT and EXPECTED
;; pairwise. This is expected to make analysis of failures
;; simpler.
- (apply #'concat (loop for o in output
- for e in expected
- if (not (equal o e))
- collect (notmuch-test-report-unexpected o e))))
+ (apply #'concat (cl-loop for o in output
+ for e in expected
+ if (not (equal o e))
+ collect (notmuch-test-report-unexpected o e))))
(t
(notmuch-test-report-unexpected output expected)))))