branch: elpa/evil-goggles
commit 221a5ed8ea0455e4274ef9ba14fe852cc512112d
Author: Evgeni Kolev <[email protected]>
Commit: Evgeni Kolev <[email protected]>
Add support for Emacs 24 by not relying on funcall-interactively
---
evil-goggles.el | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/evil-goggles.el b/evil-goggles.el
index 951ddaa3d6..4468b047fc 100644
--- a/evil-goggles.el
+++ b/evil-goggles.el
@@ -4,7 +4,7 @@
;; Author: edkolev <[email protected]>
;; URL: http://github.com/edkolev/evil-goggles
-;; Package-Requires: ((emacs "25") (evil "1.0.0"))
+;; Package-Requires: ((emacs "24.4") (evil "1.0.0"))
;; Version: 0.0.1
;; Keywords: emulations, evil, vim, visual
@@ -37,7 +37,6 @@
;;; Code:
(require 'evil)
-;; TODO try not to depend on cl-lib
(require 'cl-lib)
(defcustom evil-goggles-duration 0.200
@@ -131,10 +130,18 @@ displayed while its running."
(progn ,@body))
(progn ,@body)))
+(defun evil-goggles--funcall-interactively (f &rest args)
+ "Call F with ARGS interactively.
+
+This function mimics `funcall-interactively', available in Emacs 25,
+so this package can work with Emacs 24"
+ (cl-letf (((symbol-function 'called-interactively-p) (lambda (_) t)))
+ (apply f args)))
+
(defmacro evil-goggles--funcall-preserve-interactive (fun &rest args)
"Call FUN with ARGS with `funcall' or `funcall-interactively'."
`(if (called-interactively-p 'any)
- (funcall-interactively ,fun ,@args)
+ (evil-goggles--funcall-interactively ,fun ,@args)
(funcall ,fun ,@args)))
(defmacro evil-goggles--define-switch-and-face (switch-name switch-doc
face-name face-doc)
@@ -277,7 +284,7 @@ N and LIST are the arguments of the original function."
(defun evil-goggles--get-undo-item (list)
"Process LIST.
-The LIST is the input variable to function primitive-undo.
+The LIST is the input variable to function `primitive-undo'.
This function tries to return a single list, either:
('text-added beg end), or:
@@ -540,6 +547,7 @@ COUNT BEG &OPTIONAL END TYPE REGISTER are the arguments of
the original function
"evil-goggles global minor mode."
:lighter evil-goggles-lighter
:global t
+ :require 'evil-goggles
(cond
(evil-goggles-mode