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")]
]
(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}

View File

@ -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" {}]