Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(telescope): magic command #11

Merged
merged 9 commits into from
Apr 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
fedemengo committed Apr 4, 2023
commit cf859ea637f82bffcf4b38c941dffff25763c884
8 changes: 3 additions & 5 deletions fnl/init.fnl
Original file line number Diff line number Diff line change
@@ -19,11 +19,9 @@
(global in
(fn [x lst]
"Returns true if <x> is in <lst>"
(var found nil)
(each [k v (pairs lst)]
(when (= x v)
(set found true)))
found))
(accumulate [found false
_ v (pairs lst)]
(or found (= x v)))))

;; car and cdr to let the magic begin
(global car
4 changes: 2 additions & 2 deletions fnl/mods/tools/telescope.fnl
Original file line number Diff line number Diff line change
@@ -220,7 +220,7 @@
:<C-e>
(fn []
(var nwd (first_dir_from_entry prompt_buf cwd))
(when (should_cd (. opts :cwd) nwd)
(when (should_cd cwd nwd)
(set cwd nwd)
(tset opts :cwd cwd)
(tset opts :entry_maker (make_entry.gen_from_file opts))
@@ -230,7 +230,7 @@
:<tab>
(fn []
(var nwd (all_dirs_from_entry prompt_buf cwd))
(when (should_cd (. opts :cwd) nwd)
(when (should_cd cwd nwd)
(set cwd nwd)
(tset opts :cwd cwd)
(tset opts :entry_maker (make_entry.gen_from_file opts))
4 changes: 2 additions & 2 deletions tests/test.fnl
Original file line number Diff line number Diff line change
@@ -113,8 +113,8 @@

(assert= true (in 2 [1 2 3]))
(assert= true (in 2 {:a 1 :b 2 :c 3}))
(assert= nil (in 2 [1 3 4]))
(assert= nil (in 2 {:a 1 :b 3 :c 4}))
(assert= false (in 2 [1 3 4]))
(assert= false (in 2 {:a 1 :b 3 :c 4}))

;;(cons s t)
(assert-eq [1 2 3 4 5 6] (cons [1 2 3] [4 5 6]))