From 6ff26f53771fe8d4dc6cb44ddfbb8eeb75d58b31 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Fri, 8 May 2015 23:10:44 +0300 Subject: [PATCH] Use cl-lib instead of cl-macs Fixes #19 --- .dir-locals.el | 5 +++++ avy-jump.el | 41 +++++++++++++++++++++-------------------- avy.el | 2 +- 3 files changed, 27 insertions(+), 21 deletions(-) create mode 100644 .dir-locals.el diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000..3bcda92 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,5 @@ +;;; Directory Local Variables +;;; For more information see (info "(emacs) Directory Variables") + +((emacs-lisp-mode + (indent-tabs-mode . nil))) diff --git a/avy-jump.el b/avy-jump.el index 67c829f..3f79b8a 100644 --- a/avy-jump.el +++ b/avy-jump.el @@ -29,6 +29,7 @@ ;;; Code: ;;* Requires +(require 'cl-lib) (require 'avy) ;;* Customization @@ -95,16 +96,16 @@ POS is either a position or (BEG . END)." (defun avy--process (candidates overlay-fn) "Select one of CANDIDATES using `avy-read'." (unwind-protect - (cl-case (length candidates) - (0 - nil) - (1 - (car candidates)) - (t - (avy--make-backgrounds (list (selected-window))) - (avy-read (avy-tree candidates avy-keys) - overlay-fn - #'avy--remove-leading-chars))) + (cl-case (length candidates) + (0 + nil) + (1 + (car candidates)) + (t + (avy--make-backgrounds (list (selected-window))) + (avy-read (avy-tree candidates avy-keys) + overlay-fn + #'avy--remove-leading-chars))) (avy--done))) (defvar avy--overlays-back nil @@ -162,12 +163,12 @@ When PRED is non-nil, it's a filter for matching point positions." "Create an overlay with STR at PT in WND." (when (<= (1+ pt) (with-selected-window wnd (point-max))) (let* ((pt (+ pt avy--overlay-offset)) - (ol (make-overlay pt (1+ pt) (window-buffer wnd))) - (old-str (with-selected-window wnd - (buffer-substring pt (1+ pt))))) + (ol (make-overlay pt (1+ pt) (window-buffer wnd))) + (old-str (with-selected-window wnd + (buffer-substring pt (1+ pt))))) (when avy-background - (setq old-str (propertize - old-str 'face 'avy-background-face))) + (setq old-str (propertize + old-str 'face 'avy-background-face))) (overlay-put ol 'window wnd) (overlay-put ol 'display (concat str old-str)) (push ol avy--overlays-lead)))) @@ -209,8 +210,8 @@ LEAF is ((BEG . END) . WND)." old-str 'face 'avy-background-face))) (overlay-put ol 'window wnd) (overlay-put ol 'display (if (string= old-str "\n") - (concat str "\n") - str)) + (concat str "\n") + str)) (push ol avy--overlays-lead)))) (defun avy--overlay-post (path leaf) @@ -274,7 +275,7 @@ The window scope is determined by `avy-all-windows' (ARG negates it)." (avy--generic-jump (let ((c (read-char "char: "))) (if (= 13 c) - "\n" + "\n" (regexp-quote (string c)))) arg avy-goto-char-style)) @@ -286,8 +287,8 @@ The window scope is determined by `avy-all-windows' (ARG negates it)." (interactive "P") (avy--generic-jump (regexp-quote (string - (read-char "char 1: ") - (read-char "char 2: "))) + (read-char "char 1: ") + (read-char "char 2: "))) arg avy-goto-char-style)) diff --git a/avy.el b/avy.el index 6a0dea7..338b084 100644 --- a/avy.el +++ b/avy.el @@ -42,7 +42,7 @@ ;; headache. ;;; Code: -(require 'cl-macs) +(require 'cl-lib) (defmacro avy-multipop (lst n) "Remove LST's first N elements and return them."