diff options
author | William Carroll <wpcarro@gmail.com> | 2020-02-08T15·55+0000 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-02-08T15·55+0000 |
commit | f145bc9eb6f1bc51fd70a3df02c978b3333fa012 (patch) | |
tree | 172737cc30385afe3823f111f1b8fdca0dc1f303 /emacs/.emacs.d | |
parent | 3f54dd8601ca7b484a42a8d2b1ee867201bcfccb (diff) |
Support cycle/focus-item
I oftentimes call `cycle/focus` and pass `(lambda (a) (equal a b))`. This function should tighten up my code.
Diffstat (limited to 'emacs/.emacs.d')
-rw-r--r-- | emacs/.emacs.d/wpc/cycle.el | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/emacs/.emacs.d/wpc/cycle.el b/emacs/.emacs.d/wpc/cycle.el index 592de10e0de7..f876cf7054a4 100644 --- a/emacs/.emacs.d/wpc/cycle.el +++ b/emacs/.emacs.d/wpc/cycle.el @@ -131,6 +131,11 @@ underlying struct." (cycle/jump i cycle) (error "No element in cycle matches predicate")))) +(defun cycle/focus-item (x xs) + "Focus ITEM in cycle XS. +ITEM is the first item in XS that t for `equal'." + (cycle/focus (lambda (y) (equal x y)) xs)) + (defun cycle/contains? (x xs) "Return t if cycle, XS, has member X." (->> xs |