emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 02/16: Teach easy-kill-help to handle old format of easy-kill-ali


From: Leo Liu
Subject: [elpa] 02/16: Teach easy-kill-help to handle old format of easy-kill-alist
Date: Tue, 22 Apr 2014 00:33:38 +0000

leoliu pushed a commit to branch master
in repository elpa.

commit 804e88fbb4a2c6823a2c7163e44a1bce7dd0a105
Author: Leo Liu <address@hidden>
Date:   Mon Apr 14 12:10:09 2014 +0800

    Teach easy-kill-help to handle old format of easy-kill-alist
    
    Also enhance it to handle long thing names and missing append
    separator.
---
 easy-kill.el |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/easy-kill.el b/easy-kill.el
index 91a1a21..0eda453 100644
--- a/easy-kill.el
+++ b/easy-kill.el
@@ -170,19 +170,20 @@ The value is the function's symbol if non-nil."
           (mapcar 'car easy-kill-alist))
     map))
 
-(defun easy-kill--fmt (x y z)
+(defun easy-kill--fmt (x y &optional z)
   (cl-etypecase x
     (character (easy-kill--fmt
                 (single-key-description x)
                 (symbol-name y)
-                (let ((print-escape-newlines t))
-                  (prin1-to-string z))))
+                (and z (let ((print-escape-newlines t))
+                         (prin1-to-string z)))))
     (string (with-output-to-string
               (princ x)
-              (princ (make-string (- 16 (length x)) ?\s))
+              (princ (make-string (- 16 (mod (length x) 16)) ?\s))
               (princ y)
-              (princ (make-string (- 16 (length y)) ?\s))
-              (princ z)))))
+              (when z
+                (princ (make-string (- 16 (mod (length y) 16)) ?\s))
+                (princ z))))))
 
 (defun easy-kill-help ()
   (interactive)
@@ -195,11 +196,13 @@ 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))))
+    (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))))
                       easy-kill-alist "\n"))
-    (princ "\n")
+    (princ "\n\n")
     (princ (substitute-command-keys "\\{easy-kill-base-map}"))))
 
 (defvar easy-kill-candidate nil)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]