From b8d86c65cb083fce2cd3aed79511e6e7c1385bf2 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sat, 31 Dec 2022 13:35:34 +0000 Subject: [PATCH] invoke command.function with completion value not string this means a function that wants a buffer (for example) gets called with the actual buffer not the buffer name --- command.fnl | 8 +++++--- dunlin.fnl | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/command.fnl b/command.fnl index ade75ac..ade0c84 100644 --- a/command.fnl +++ b/command.fnl @@ -29,7 +29,7 @@ [:url #(doto {} (tset $1 $1)) #(do "http://www.example.com")] ] (fn [{:url url :buffer buffer}] - (let [b (Buffer.find buffer)] (: b :visit url)))) + (buffer:visit url))) (fn find-command [name] (. commands name)) @@ -77,8 +77,10 @@ }) {:command c :this-param k :collected-params p} - (do - (tset p k input-string) + (let [{ : completer} (. c.params k) + vals (completer input-string) + value (. vals input-string)] + (tset p k value) (state-for-next-param c p)) {:command c :this-param nil :collected-params p} diff --git a/dunlin.fnl b/dunlin.fnl index 67ac8c1..4520f86 100644 --- a/dunlin.fnl +++ b/dunlin.fnl @@ -9,7 +9,7 @@ ;;; when we decide how to do an init file/rc file, this will go in it (local my-keymap { - "g" ["visit-location" {:buffer #(. (. $1 :buffer) :name)}] + "g" ["visit-location" {:buffer #$1.buffer }] "M-q" ["quit-browser" {}] "C-x" { "C-c" ["quit-browser" {}]