keymap setting not working for Eval: Clear inline results

95 views
Skip to first unread message

Lance Campbell

unread,
Apr 27, 2015, 1:34:26 PM4/27/15
to light-table...@googlegroups.com
Trying the following entry in my user.keymap file:

 [:evaler "cmd-k" :clear-inline-results]

I can see it adds the proper shortcut key in the Commands sidebar but nothing happens when I hit the shortcut key combo.

Tried different key combos for the Eval: Clear inline results command. Doesn't work.

Tried using the shortcut "cmd-k" on other commands and that all works correctly.

Any ideas or suggestions?

Frank Castellucci

unread,
Apr 27, 2015, 2:20:36 PM4/27/15
to light-table...@googlegroups.com
Lance

What version LT? What OS?

Lance Campbell

unread,
Apr 27, 2015, 11:36:03 PM4/27/15
to light-table...@googlegroups.com
OS: Mac OSX Mavericks

LT Version: 0.7.2

Lance Campbell

unread,
Apr 27, 2015, 11:37:23 PM4/27/15
to light-table...@googlegroups.com
FYI, the command works fine for Instarepl and for Light Table UI connection. It is only when I try to assign a shortcut key and use the shortcut that nothing happens.

Sean Corfield

unread,
Apr 27, 2015, 11:47:44 PM4/27/15
to light-table...@googlegroups.com
I’m not sure what `:evaler` is but I have that shortcut bound in an editor context:

[:editor.clojure "ctrl-c q" :clear-inline-results]

I also have:

[:editor.clojure "ctrl-c ctrl-q" :eval.cancel-all! :clear-inline-results :clear-console]

Sean

Lance Campbell

unread,
Apr 28, 2015, 1:14:41 AM4/28/15
to light-table...@googlegroups.com
 [:editor.clojure "cmd-k" :clear-inline-results]

worked fo rme. Not sure why but I'm thankful for the help.

Magnus Rundberget

unread,
Apr 28, 2015, 8:26:21 AM4/28/15
to light-table...@googlegroups.com
I wish I could explain why in a one liner, but the answer unfortunately isn't that simple !

I've gone into some depth trying to explain the BOT model through code in Light Table in this blog post: http://rundis.github.io/blog/2015/lt_react.html
I'll try and give a simplified version:

The LT architecture is build on a Behavior Object Tag model as explained in http://www.chris-granger.com/2013/01/24/the-ide-as-data/
Commands is a user entry point into to the bot, typically commands are used for things that have keyboard shortcuts.


The keyboard shortcut vector contains: [:tag "someshortcut" :command-name]
- so in your example ":editor.clojure" is a tag. This tag is added by LT to any editor object that it deems to be a clojure file. So when you have an clj file open and focus that is backed by an object which has a tag :editor.clojure (it also has several other tags btw).
- LT will not even try to invoke a command if it doesn't find an object with the tag you provide in the keyboard shortcut vector. ":evaler" I suspect is not a known tag for any relevant Light Table object. So it resulted in a no-op !
- The plot thickens though, because a command will typically trigger one or more behaviors. Behaviors are also scoped by tags... The model is very very flexible, but the flip-side is that it's somewhat hard to understand and even more difficult to explain sensibly to someone new to Light Table (:

Anyways, all editors have a ":editor" tag. So for this shortcut you could have written
[:editor "cmd-k" :clear-inline-results], then it would work for any editor type (regardless of language) that have implemented features for showing inline results.

App wide shortcuts (ie shortcuts not tied to a specific editor), can typically be scoped by :app. I think if you select "Settings: Default keymap" from the command menu in LT you will get an idea of a few
of the default tags (backed by objects) ships with. Plugins may have other objects and tags etc.


I fear I might have confused you more than helped you. Just ask if you need more assistance though.


cheers
Magnus

Lance Campbell

unread,
Apr 29, 2015, 9:29:04 AM4/29/15
to light-table...@googlegroups.com
Thanks for the additional info. It makes sense, not confusing. It looks like I need to spend some time with the BOT model to understand it better. It probably was the first tag that caused the problem.
Reply all
Reply to author
Forward
0 new messages