branch: master
commit f5a21db923dac0193f9417f1e88bf84b0a89e7b8
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
ivy.el: define setq-local and defvar-local unless defined
Fixes #415
With this commit, ivy works on emacs-24.2.
---
counsel.el | 2 +-
ivy.el | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/counsel.el b/counsel.el
index 6cca45c..0d062c1 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1189,7 +1189,7 @@ INITIAL-INPUT can be given as the initial minibuffer
input."
"Format string to use in `cousel-ag-function' to construct the
command. %S will be replaced by the regex string. The default is
\"ag --vimgrep %S\"."
- :type 'stringp
+ :type 'string
:group 'ivy)
(defun counsel-ag-function (string)
diff --git a/ivy.el b/ivy.el
index 9d79617..60c20a6 100644
--- a/ivy.el
+++ b/ivy.el
@@ -387,6 +387,18 @@ When non-nil, it should contain at least one %d.")
(defvar Info-current-file)
+(eval-and-compile
+ (unless (fboundp 'defvar-local)
+ (defmacro defvar-local (var val &optional docstring)
+ "Define VAR as a buffer-local variable with default value VAL."
+ (declare (debug defvar) (doc-string 3))
+ (list 'progn (list 'defvar var val docstring)
+ (list 'make-variable-buffer-local (list 'quote var)))))
+ (unless (fboundp 'setq-local)
+ (defmacro setq-local (var val)
+ "Set variable VAR to value VAL in current buffer."
+ (list 'set (list 'make-local-variable (list 'quote var)) val))))
+
(defmacro ivy-quit-and-run (&rest body)
"Quit the minibuffer and run BODY afterwards."
`(progn