branch: externals/easy-kill
commit f9b450a87c41e5ef616df565ed158cb236aa5189
Author: Leo Liu <sdl....@gmail.com>
Commit: Leo Liu <sdl....@gmail.com>

    Remove deprecated format for easy-kill-alist
    
    Include `uuid' in easy-kill-try-things and easy-mark-try-things.
---
 README.rst   |  5 ++++-
 easy-kill.el | 38 ++++++++++++++------------------------
 test.el      | 28 +++++-----------------------
 3 files changed, 23 insertions(+), 48 deletions(-)

diff --git a/README.rst b/README.rst
index b43cb3b5d9..1934cd7c57 100644
--- a/README.rst
+++ b/README.rst
@@ -100,7 +100,10 @@ NEWS
 0.9.5
 +++++
 
-#. [BREAKING] Emacs >= 25 required
+#. [BREAKING] Emacs >= 25 required.
+#. [BREAKING] Remove deprecated format for ``easy-kill-alist``.
+#. Include ``uuid`` in ``easy-kill-try-things`` and
+   ``easy-mark-try-things``.
 
 0.9.4
 +++++
diff --git a/easy-kill.el b/easy-kill.el
index 0eb9ce48a9..d68b4dd4c1 100644
--- a/easy-kill.el
+++ b/easy-kill.el
@@ -54,10 +54,7 @@
   "A list of (CHAR THING APPEND).
 CHAR is used immediately following `easy-kill' to select THING.
 APPEND is optional and if non-nil specifies the separator (a
-string) for appending current selection to previous kill.
-
-Note: each element can also be (CHAR . THING) but this is
-deprecated."
+string) for appending current selection to previous kill."
   :type '(repeat (list character symbol
                        (choice string (const :tag "None" nil))))
   :group 'killing)
@@ -72,12 +69,12 @@ deprecated."
   :type '(choice (const :tag "None" nil) key-sequence)
   :group 'killing)
 
-(defcustom easy-kill-try-things '(url email line)
+(defcustom easy-kill-try-things '(url email uuid line)
   "A list of things for `easy-kill' to try."
   :type '(repeat symbol)
   :group 'killing)
 
-(defcustom easy-mark-try-things '(url email sexp)
+(defcustom easy-mark-try-things '(url email uuid sexp)
   "A list of things for `easy-mark' to try."
   :type '(repeat symbol)
   :group 'killing)
@@ -199,11 +196,8 @@ The value is the function's symbol if non-nil."
     (princ "\n")
     (princ (easy-kill--fmt "---" "-----" "---------"))
     (princ "\n\n")
-    (princ (mapconcat (lambda (x) (pcase x
-                                    (`(,c ,thing ,sep)
-                                     (easy-kill--fmt c thing sep))
-                                    ((or `(,c ,thing) `(,c . ,thing))
-                                     (easy-kill--fmt c thing))))
+    (princ (mapconcat (pcase-lambda (`(,c ,thing ,sep))
+                        (easy-kill--fmt c thing sep))
                       easy-kill-alist "\n"))
     (princ "\n\n")
     (princ (substitute-command-keys "\\{easy-kill-base-map}"))))
@@ -369,16 +363,14 @@ A thing is opted out of cycling if in 
`easy-kill-cycle-ignored'."
       (easy-kill-cycle next))))
 
 (defun easy-kill-cycle-next (thing depth)
-  (cl-flet ((thing-name (thing)
-              (if (symbolp (cdr thing)) (cdr thing) (cl-second thing))))
-    (let ((next (thing-name
-                 (car (or (cl-loop for (head . tail) on easy-kill-alist
-                                   when (eq thing (thing-name head))
-                                   return tail)
-                          easy-kill-alist)))))
-      (cond ((not (memq next easy-kill-cycle-ignored)) next)
-            ((> depth 0) (easy-kill-cycle-next next (1- depth)))
-            (t (user-error "Nothing to cycle"))))))
+  (let ((next (cl-second
+               (car (or (cl-loop for (head . tail) on easy-kill-alist
+                                 when (eq thing (cl-second head))
+                                 return tail)
+                        easy-kill-alist)))))
+    (cond ((not (memq next easy-kill-cycle-ignored)) next)
+          ((> depth 0) (easy-kill-cycle-next next (1- depth)))
+          (t (user-error "Nothing to cycle")))))
 
 (defun easy-kill-digit-argument (n)
   "Expand selection by N number of things.
@@ -465,9 +457,7 @@ checked."
 (defun easy-kill-thing (&optional thing n inhibit-handler)
   ;; N can be -, + and digits
   (interactive
-   (list (pcase (assq last-command-event easy-kill-alist)
-           (`(,_ ,th . ,_) th)
-           (`(,_ . ,th) th))
+   (list (cl-second (assq last-command-event easy-kill-alist))
          (prefix-numeric-value current-prefix-arg)))
   (let* ((thing (or thing (easy-kill-get thing)))
          (n (or n 1))
diff --git a/test.el b/test.el
index c4c297f856..cd1c49f0a0 100644
--- a/test.el
+++ b/test.el
@@ -94,32 +94,14 @@
     (should (string= (buffer-substring-no-properties (point-min) (point)) "abc 
"))
     (should (string= (buffer-substring-no-properties (point) (point-max)) " 
ghi"))))
 
-;;; Make sure the old format of easy-kill-alist is still supported.
-(ert-deftest test-old-easy-kill-alist ()
-  (let ((easy-kill-alist '((?w . word)
-                           (?s . sexp)
-                           (?l . list)
-                           (?f . filename)
-                           (?d . defun)
-                           (?e . line)
-                           (?b . buffer-file-name)))
-        (text "(first line\nsecond line\nthird line)"))
-    (with-temp-buffer
-      (insert text)
-      (goto-char (point-min))
-      (easy-kill)
-      (let ((last-command-event ?d))
-        (call-interactively #'easy-kill-thing))
-      (should (string= text (easy-kill-candidate))))))
-
 (ert-deftest test-easy-kill-help ()
-  (let ((easy-kill-alist '((?w . word)
-                           (?s . sexp)
-                           (?l . list)
+  (let ((easy-kill-alist '((?w word)
+                           (?s sexp)
+                           (?l list)
                            (?f filename)
                            (?d defun "\n\n")
-                           (?e . line)
-                           (?b . buffer-file-name)
+                           (?e line)
+                           (?b buffer-file-name)
                            (?x buffer-file-name-buffer-file-name "\t"))))
     (easy-kill-help)
     (with-current-buffer (help-buffer)

Reply via email to