Re: How to obtain an error string from eval_expr

2008-06-22 Fir de Conversatie Tony Mechelynck
On 21/06/08 09:17, Matt Tolton wrote: see :help exception-handling I scanned that and I'm not seeing how it helps me...it's all talking about vimscript. Could you please elaborate? Thanks, Matt So? I thought you were writing a Vim function. Each line in a Vim function is a Vim

Re: How to obtain an error string from eval_expr

2008-06-21 Fir de Conversatie Tony Mechelynck
On 21/06/08 07:50, Matt Tolton wrote: Hi, I'm doing some work on MacVim and I've written a function (see below) to programmatically evaluate an expression in vim and convert the result to cocoa values. I'd like to be able to return information about why the evaluation failed if it does.

Re: How to obtain an error string from eval_expr

2008-06-21 Fir de Conversatie Ben Schmidt
Matt Tolton wrote: Hi, I'm doing some work on MacVim and I've written a function (see below) to programmatically evaluate an expression in vim and convert the result to cocoa values. I'd like to be able to return information about why the evaluation failed if it does. Can anyone give me

Re: How to obtain an error string from eval_expr

2008-06-21 Fir de Conversatie Matt Tolton
I suppose that when eval_expr returns NULL, you should look up the most recent message that :messages would return. So, check out the function ex_messages(). I guess you'll also want to make sure that emsg_not_now() is false, so that the messages are actually recorded, but that emsg_silent

Re: How to obtain an error string from eval_expr

2008-06-21 Fir de Conversatie Matt Tolton
Hmm. Yes. Looking at it, though, the error message is simply: E15: Invalid expression: {expr} That's just the last message, though. Usually the one immediately prior to it is more useful. --~--~-~--~~~---~--~~ You received this message from the vim_dev

Re: How to obtain an error string from eval_expr

2008-06-21 Fir de Conversatie Ben Schmidt
Matt Tolton wrote: Hmm. Yes. Looking at it, though, the error message is simply: E15: Invalid expression: {expr} That's just the last message, though. Usually the one immediately prior to it is more useful. O, right. I see. No, I can't think of any other way apart from trimming the

Re: How to obtain an error string from eval_expr

2008-06-21 Fir de Conversatie Matt Tolton
Ok. I think that this would be doable if I remembered the last error message before I call eval_expr, and then just grabbed anything after that. However, at the moment I don't think it's worth it...perhaps I'll try it at a later date. Thanks for the help, Ben.

How to obtain an error string from eval_expr

2008-06-20 Fir de Conversatie Matt Tolton
Hi, I'm doing some work on MacVim and I've written a function (see below) to programmatically evaluate an expression in vim and convert the result to cocoa values. I'd like to be able to return information about why the evaluation failed if it does. Can anyone give me tips on how to get an