-
Notifications
You must be signed in to change notification settings - Fork 203
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
emacs M-x completes to commands that are not Yi.Keymap.Action #292
Comments
From [email protected] on April 01, 2009 03:40:26 |
From [email protected] on April 03, 2009 17:05:22 |
I thought that was intended behaviour? Wasn't it? I understand it is governed by list of modules imported in In particular |
There is no checking of type we can do from Hint because it's all We're currently considering ditching Hint for |
I thought it was already implemented, and user-configurable by changing |
Even better idea would be to just limit a set of published actions by replacing |
I believe it is currently not used anywhere, the idea is to make it a first-class member that users/modes can expand rather than an obscure field that's not used by anything.
Hint will stay, just not for M-x. It is hardly ‘full power of Haskell’ at the moment anyway.
This only solves this issue and makes us maintain such a completion method without benefits of fully-exposed table. |
I used it for some time a while ago, but for current use we would add many more actions, and their comments. I would still stick to the current Evaluator structure, possibly expanding it, since it is well engineered. |
How do you propose I would only use the Evaluator to actually evaluate some code in a buffer and whatnot rather than making it the central driver behind M-x. Even emacs doesn't have code eval in M-x, you spawn an eval prompt with separate command (C-:). |
You may put every new action I want into |
You still can't remove actions based on which mode is up &c. |
Yes, it needs extension to multiple environments here. But, of course, it may be better to just a custom action filter, that will modify names given by BTW How much would it fix current behaviour, if we import only As for documentation, I still hope for a haddock solution, because it is much less effort to keep it up-to-date. |
So rather than simply saying ‘add this Map to available actions‘ you'd create a new module for every single environment you could possibly want, take care to only export actions we want to see and then tell hint to import that? And how do we unload modules? How do we only load some functions from the modules? This approach doesn't scale and is hostile to user-defined (or mode-defined) functions. Also it doesn't scale because we'll need to load more and more modules which would slow it down considerably.
And how will you do that for arbitrary input from the user/mode?
The point of the discussion we're having right now is that while it is possible to fix this issue with current Hint setup (such as by having a dedicated module with re-exports), we should instead do it differently which solves this problem AND other problems (extensible, easily modifiable, overridable) that are vital for user modes and usability in general as well as much more efficient. As you say yourself, making a list of actions is hard: you don't know what people use and what you use so Hint approach is even harder. But it's easy to let the user provide a Map exposing the actions they want.
I also hope we can leverage Haddock. We could probably read Haddock's interface files in the end but I'm not thinking about this just now. By the way, Map approach allows us to employ a temporary solution of attaching documentation explicitly and Hint does not. Another reason to not use Hint for this. In summary, yes, we could fix this issue while using Hint but it's close-minded and doesn't fix other problems. |
I offered my help and contribution, and got an answer about 'close-minded' and wrong solution. Even though, I risk a flamewar, and I'd argue that blindly following complex Emacs solutons is not the way to go. Since we can textually filter completions, and freely juggle sub-scopes using Hint, it would be a reckless abandon of arbitrary subexpression arguments. That is just an argument for the superiority of homogeneous Haskell-based (hint) solution. That sounds wrong in principle! (Ok, sorry for that. Felt compelled to counter the technical argument.) |
Well, I don't mean to offend and it's certainly not ‘not welcome’. It just seems to fix this issue and this issue only and it seems like the wrong fix in general to employ.
Maps would still be using Haskell. It would be no different than it is now. The only difference is the source of the Actions: currently they come from Hint. I propose they should come from somewhere else, in this case some Map. Reasoning is simple: we can easily change the Map, we can't easily change Hint output.
I agree namespacing may become awkward but it is not very difficult. If we want to prefix commands from some mode, map over keys. To achieve the same thing in Hint we'd have to import all modules we're interested in, rename clashes, re-export everything and have Hint load it. Additonally, easy access to the names may prove beneficial: we may want to override certain available actions (consider situation where we eval some piece of code (through Hint or otherwise) and want it to be available in M-x immedatielly instead of the old version). With Map it is easy, simply replace that name. With Hint, not so much: you'll either have to have a different name or Hint will throw a fit about a name clash.
This is incorrect, nothing is being constrained. Hint does a simple thing, it spits out Action. Our Map would also spit out Action. The power is the same, the only thing that changes is ease of extension and modification. My ‘proposal’ is simple: source actions for M-x from a Map instead from Hint. Motivation is also simple: we can easily change the Map, we can't easily change what Hint has available. As a side effect, using Map fixes this issue because we can specify exactly which actions we want. If we're going to instead fix this issue by mandating the choices Hint shows, how is that any more flexible than the Map approach? Either way we have to maintain some sort of list of functions so why not use this fact and solve other problems along the way? Removing hint from M-x all together (at least by default) is a good thing: it makes Yi faster, it makes it take less memory and it makes it easy to try. I get questions frequently about why M-x doesn't work (due to messed up GHC_PACKAGE_PATH or else) or why user-defined functions don't show up (because Hint doesn't load the module they defined them in). With Map first question doesn't exist. Second question can simply be answered with ‘just put them in this Map’. With Hint first question is a big problem because it depends heavily on user's setup. Second question is also not easy to answer. So in light of this I think what is wrong in principle is to fix and close this issue by changing Hint code. |
Original author: [email protected] (April 01, 2009 03:38:51)
What steps will reproduce the problem?
What is the expected output?
2. M-x should not suggest Backward, etc if it can't execute them.
What do you see instead?
2. minibuffer shows:
"""
M-x
Backward Character Document Forward Line Point atBoundaryB cabalBuildE
cabalConf
"""
3. minibuffer says "error: value doesn't have type Yi.Keymap.Action"
Please provide relevant version information:
What version of Yi are you using? darcs head
What version of GHC? 6.10.1
What operating system/version? Fedora 10
Original issue: http://code.google.com/p/yi-editor/issues/detail?id=260
The text was updated successfully, but these errors were encountered: