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
main
Daniel Barlow 2022-12-31 13:35:34 +00:00
parent e4ed51e137
commit b8d86c65cb
2 changed files with 6 additions and 4 deletions

View File

@ -29,7 +29,7 @@
[:url #(doto {} (tset $1 $1)) #(do "http://www.example.com")] [:url #(doto {} (tset $1 $1)) #(do "http://www.example.com")]
] ]
(fn [{:url url :buffer buffer}] (fn [{:url url :buffer buffer}]
(let [b (Buffer.find buffer)] (: b :visit url)))) (buffer:visit url)))
(fn find-command [name] (fn find-command [name]
(. commands name)) (. commands name))
@ -77,8 +77,10 @@
}) })
{:command c :this-param k :collected-params p} {:command c :this-param k :collected-params p}
(do (let [{ : completer} (. c.params k)
(tset p k input-string) vals (completer input-string)
value (. vals input-string)]
(tset p k value)
(state-for-next-param c p)) (state-for-next-param c p))
{:command c :this-param nil :collected-params p} {:command c :this-param nil :collected-params p}

View File

@ -9,7 +9,7 @@
;;; when we decide how to do an init file/rc file, this will go in it ;;; when we decide how to do an init file/rc file, this will go in it
(local my-keymap { (local my-keymap {
"g" ["visit-location" {:buffer #(. (. $1 :buffer) :name)}] "g" ["visit-location" {:buffer #$1.buffer }]
"M-q" ["quit-browser" {}] "M-q" ["quit-browser" {}]
"C-x" { "C-x" {
"C-c" ["quit-browser" {}] "C-c" ["quit-browser" {}]