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

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

[elpa] externals/smart-yank a76c865 3/9: Make smart-yank-yank-pop a top-


From: Stefan Monnier
Subject: [elpa] externals/smart-yank a76c865 3/9: Make smart-yank-yank-pop a top-level def (use defalias)
Date: Tue, 1 Dec 2020 17:14:18 -0500 (EST)

branch: externals/smart-yank
commit a76c8650c8f147f2d41a566c281cd2550741c4c5
Author: Michael Heerdegen <michael_heerdegen@web.de>
Commit: Michael Heerdegen <michael_heerdegen@web.de>

    Make smart-yank-yank-pop a top-level def (use defalias)
    
    Thanks Stefan.
---
 smart-yank.el | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/smart-yank.el b/smart-yank.el
index a5289eb..007b789 100644
--- a/smart-yank.el
+++ b/smart-yank.el
@@ -130,9 +130,10 @@ yanked text \"to the beginning\" of the kill ring."
         (setq kill-ring (cons last-yank (delete last-yank kill-ring)))
         (smart-yank-reset-yank-pointer)))))
 
-(let ((r (smart-yank--stopwatch)))
-  (defun smart-yank-yank-pop (&optional arg)
-    "\"smart-yank\"'s private version of `yank-pop'.
+(defalias 'smart-yank-yank-pop
+  (let ((r (smart-yank--stopwatch)))
+    (lambda (&optional arg)
+      "\"smart-yank\"'s private version of `yank-pop'.
 
 When called directly after a `yank' command (including itself),
 call `yank-pop'.
@@ -145,19 +146,19 @@ yanked text; in addition call
 When not called after a yank, yank the next-to-the-last
 `kill-ring' entry; with prefix arg, call the
 `smart-yank-browse-kill-ring-command'."
-    (interactive "P")
-    (let ((diff (funcall r)))
-      (cond
-       ((not (eq last-command 'yank)) (if arg (call-interactively 
smart-yank-browse-kill-ring-command)
-                                        (rotate-yank-pointer 1)
-                                        (yank)))
-       ((or (not diff)
-            (> diff smart-yank-yank-pop-multikey-delay))
-                                      (call-interactively #'yank-pop))
-       (t                             (funcall (or yank-undo-function 
#'delete-region)
-                                               (region-beginning) (region-end))
-                                      (when smart-yank-browse-kill-ring-command
-                                        (call-interactively 
smart-yank-browse-kill-ring-command)))))))
+      (interactive "P")
+      (let ((diff (funcall r)))
+        (cond
+         ((not (eq last-command 'yank)) (if arg (call-interactively 
smart-yank-browse-kill-ring-command)
+                                          (rotate-yank-pointer 1)
+                                          (yank)))
+         ((or (not diff)
+              (> diff smart-yank-yank-pop-multikey-delay))
+          (call-interactively #'yank-pop))
+         (t                             (funcall (or yank-undo-function 
#'delete-region)
+                                                 (region-beginning) 
(region-end))
+                                        (when 
smart-yank-browse-kill-ring-command
+                                          (call-interactively 
smart-yank-browse-kill-ring-command))))))))
 
 (declare-function smart-yank-yank-pop 'smart-yank)
 



reply via email to

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