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

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

[elpa] 58/77: Emacs 24.x compatibility


From: Leo Liu
Subject: [elpa] 58/77: Emacs 24.x compatibility
Date: Sat, 05 Apr 2014 04:08:24 +0000

leoliu pushed a commit to branch master
in repository elpa.

commit b49c2f114cd8b7454c7cc6f2bae789aa346f2948
Author: Leo Liu <address@hidden>
Date:   Thu Oct 17 15:01:02 2013 +0800

    Emacs 24.x compatibility
---
 easy-kill.el |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/easy-kill.el b/easy-kill.el
index 1728f41..1d10ea9 100644
--- a/easy-kill.el
+++ b/easy-kill.el
@@ -44,6 +44,29 @@
 (eval-when-compile (require 'cl))
 (require 'thingatpt)
 
+(eval-and-compile
+  (or (fboundp 'set-temporary-overlay-map) ; new in 24.3
+      (defun set-temporary-overlay-map (map &optional keep-pred)
+        (let* ((clearfunsym (make-symbol "clear-temporary-overlay-map"))
+               (overlaysym (make-symbol "t"))
+               (alist (list (cons overlaysym map)))
+               (clearfun
+                `(lambda ()
+                   (unless ,(cond ((null keep-pred) nil)
+                                  ((eq t keep-pred)
+                                   `(eq this-command
+                                        (lookup-key ',map
+                                                    
(this-command-keys-vector))))
+                                  (t `(funcall ',keep-pred)))
+                     (set ',overlaysym nil) ;Just in case.
+                     (remove-hook 'pre-command-hook ',clearfunsym)
+                     (setq emulation-mode-map-alists
+                           (delq ',alist emulation-mode-map-alists))))))
+          (set overlaysym overlaysym)
+          (fset clearfunsym clearfun)
+          (add-hook 'pre-command-hook clearfunsym)
+          (push alist emulation-mode-map-alists)))))
+
 (defcustom easy-kill-alist
   '((?w . word)
     (?s . sexp)



reply via email to

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