Skip to content

Commit

Permalink
Use cl-lib instead of cl-macs
Browse files Browse the repository at this point in the history
Fixes #19
  • Loading branch information
bbatsov authored and abo-abo committed May 8, 2015
1 parent c32b91f commit 6ff26f5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 21 deletions.
5 changes: 5 additions & 0 deletions .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)))
41 changes: 21 additions & 20 deletions avy-jump.el
Expand Up @@ -29,6 +29,7 @@

;;; Code:
;;* Requires
(require 'cl-lib)
(require 'avy)

;;* Customization
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))))
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand All @@ -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))

Expand Down
2 changes: 1 addition & 1 deletion avy.el
Expand Up @@ -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."
Expand Down

0 comments on commit 6ff26f5

Please sign in to comment.