Thomas | 3 Nov 2010 15:40

Binding some function to a key

Hi,

I would like to start using Yi.  I found this tutorial on the web.

http://www.nobugs.org/developer/yi/example-helloworld.html

As I understand the tutorial is outdated and quite a few things have
changed since then.  Is there something more up to date on the web
somewhere?

One question in particular.  I defined some function.  How can I get
access to that, so that I can do "M-x myFunction"?  I found some hint
from 2008 that I should look into the Yi.Yi module... but couldn't
find a Yi.Yi module.  I guess that hint is old, too.

I also tried to bind M-r to some function.  It complies, but I must
nevertheless do something wrong, as M-r is still not recognised as a
valid key.

I attached my ~/.yi/yi.hs below.

I can remember that when I heard from Yi the first time, one of the
selling points was, that you could recompile your configuration file
on the fly -- just the same way as it works with Xmonad.  I love this
feature in Xmonad, but I can't find a "recompile"-function or anything
similar in the Yi-index on hackage.  Is it called something different?

Thanks for your help.

Thomas
(Continue reading)

Anders Karlsson | 3 Nov 2010 15:59
Picon
Gravatar

Re: Binding some function to a key

Hi,

We have some example configs in
http://code.haskell.org/yi/src/Yi/Users/ I have an example of how to
bind a key (C-c n) to a function in my
config(http://code.haskell.org/yi/src/Yi/Users/Anders.hs). I hope this
helps with some of the problems :)

cheers,
Anders

On Wed, Nov 3, 2010 at 2:40 PM, Thomas <auwehago@...> wrote:
> Hi,
>
> I would like to start using Yi.  I found this tutorial on the web.
>
> http://www.nobugs.org/developer/yi/example-helloworld.html
>
> As I understand the tutorial is outdated and quite a few things have
> changed since then.  Is there something more up to date on the web
> somewhere?
>
> One question in particular.  I defined some function.  How can I get
> access to that, so that I can do "M-x myFunction"?  I found some hint
> from 2008 that I should look into the Yi.Yi module... but couldn't
> find a Yi.Yi module.  I guess that hint is old, too.
>
> I also tried to bind M-r to some function.  It complies, but I must
> nevertheless do something wrong, as M-r is still not recognised as a
> valid key.
(Continue reading)

Jean-Philippe Bernardy | 3 Nov 2010 17:07
Picon
Picon

Re: Binding some function to a key

On Wed, Nov 3, 2010 at 3:40 PM, Thomas <auwehago@...> wrote:

> One question in particular.  I defined some function.  How can I get
> access to that, so that I can do "M-x myFunction"?  I found some hint
> from 2008 that I should look into the Yi.Yi module... but couldn't
> find a Yi.Yi module.  I guess that hint is old, too.

Edit  ~/.yi/local/Env.hs and put your function there.

example:

module Env where

import Yi

hello :: EditorM Int
hello = return 123

Look into src/Yi/Eval.hs to understand what's going on.

> I also tried to bind M-r to some function.  It complies, but I must
> nevertheless do something wrong, as M-r is still not recognised as a
> valid key.
>
> I attached my ~/.yi/yi.hs below.
>
> I can remember that when I heard from Yi the first time, one of the
> selling points was, that you could recompile your configuration file
> on the fly -- just the same way as it works with Xmonad.  I love this
> feature in Xmonad, but I can't find a "recompile"-function or anything
(Continue reading)

Gwern Branwen | 8 Nov 2010 04:53
Picon
Gravatar

Re: Ireader mode not showing up in M-x

On Fri, Sep 17, 2010 at 9:45 AM, Gwern Branwen <gwern0@...> wrote:
> On Wed, Sep 1, 2010 at 12:10 PM, Jean-Philippe Bernardy
> <bernardy@...> wrote:
>> On Wed, Sep 1, 2010 at 3:28 PM, Gwern Branwen <gwern0@...> wrote:
>>> On Sun, Aug 29, 2010 at 12:24 PM, Jean-Philippe Bernardy
>>> <bernardy@...> wrote:
>>>> Your function should be in the scope of the interpreter.
>>>>
>>>> See Eval.hs:
>>>>
>>>> LHI.setImportsQ [("Yi", Nothing), ("Yi.Keymap",Just "Yi.Keymap")] -
>>>>
>>>> The set of imported stuff should probably be a config option.
>>>>
>>>> Cheers,
>>>> JP.
>>>
>>> Well, alright. (I assume I am supposed to add a line importing Yi.IReader?)
>>
>> Yes.
>>
>>> But I know M-x used to work for this; was all that recently changed?
>>
>> Using Hint for M-x used to be an experimental feature.
>> I seem to recall Jeff pushing a patch making it default.
>>
>> Cheers,
>> JP.
>>
>
(Continue reading)

Jean-Philippe Bernardy | 8 Nov 2010 09:04
Picon
Picon

Re: Ireader mode not showing up in M-x

>
> I happened to be trying this with Nothing, and when no completions
> appeared, on a lark I tried typing ireadMode and hitting enter anyway
> - which landed me in ireader-mode! So apparently it was present and
> ready to go, but it was not showing up in completions.

Maybe you could file a bug report?

The related code should be in Yi.Eval if you feel like fixing it :)

Cheers,
-- JP

--

-- 
Yi development mailing list
yi-devel@...
http://groups.google.com/group/yi-devel

codesite | 9 Nov 2010 19:15
Picon
Favicon

Issue 322 in yi-editor: Yi.Eval does not update completion list for interpreted modules?

Status: Accepted
Owner: gwern0
Labels: Type-Defect Priority-Low

New issue 322 by gwern0: Yi.Eval does not update completion list for  
interpreted modules?
http://code.google.com/p/yi-editor/issues/detail?id=322

To use ireaderMode I edited Yi.Eval to read

     LHI.setImportsQ [("Yi", Nothing), ("Yi.Keymap",Just "Yi.Keymap"),  
("Yi.Mode.IReader",Nothing)]

Originally I thought this was just broken, but it turns out that M-x  
ireadMode does in fact work - it just will not show up in the completions  
and anyone going on that will be misled.

See thread:  
http://www.mail-archive.com/yi-devel-/JYPxA39Uh5TLH3MbocFFw <at> public.gmane.org/msg04576.html

--

-- 
Yi development mailing list
yi-devel@...
http://groups.google.com/group/yi-devel

Gwern Branwen | 9 Nov 2010 19:15
Picon
Gravatar

Re: Ireader mode not showing up in M-x

On Mon, Nov 8, 2010 at 3:04 AM, Jean-Philippe Bernardy
<bernardy@...> wrote:
>>
>> I happened to be trying this with Nothing, and when no completions
>> appeared, on a lark I tried typing ireadMode and hitting enter anyway
>> - which landed me in ireader-mode! So apparently it was present and
>> ready to go, but it was not showing up in completions.
>
> Maybe you could file a bug report?

Done: http://code.google.com/p/yi-editor/issues/detail?id=322

-- 
gwern
http://www.gwern.net

--

-- 
Yi development mailing list
yi-devel@...
http://groups.google.com/group/yi-devel


Gmane