Re: a9709ee: second draft of eval command

2018-03-29 Thread Terry Brown
On Thu, 29 Mar 2018 10:36:48 -0500 "Edward K. Ream" wrote: > > > After the exec, the local dictionary contains all results. These > > > become the self.answers array. > > > > They don't seem to be in c.vs - how are the accessed now? > > ​The only "connection" is in the

Re: File Templating

2018-03-29 Thread Terry Brown
On Thu, 29 Mar 2018 10:40:51 -0700 (PDT) k-hen wrote: > Hi All, > > I'm familiar with the scripting components but was wondering if > there's an existing way to do basic templating using @files. > > Essentially for starters I just want to be able to reference the >

Log message re. UTF-8

2018-03-29 Thread Rob
This message comes up in the terminal log when I launch Leo. I don't recall seeing it before. Note: sys.stdout.encoding is not UTF-8 See: https://stackoverflow.com/questions/14109024 Despite looking over the link to Stackoverflow, I don't really understand what, if anything, I need to do about

Re: a9709ee: second draft of eval command

2018-03-29 Thread Edward K. Ream
On Thursday, March 29, 2018 at 10:56:34 AM UTC-5, Edward K. Ream wrote: >From two previous posts: > This project isn't about code cleanup, it's a prototype for full jupyter support. > Some invention is required, perhaps involving eval("2+2"), but I don't have ideas at present. > It will be

Re: a9709ee: second draft of eval command

2018-03-29 Thread Terry Brown
On Thu, 29 Mar 2018 10:56:32 -0500 "Edward K. Ream" wrote: > To repeat, I don't plan to going back to the old code. It is not sound > because it can't handle "else" or any other compound statement. See > the post script. The old code relied on the user to select a valid

Re: a9709ee: second draft of eval command

2018-03-29 Thread Edward K. Ream
On Thu, Mar 29, 2018 at 11:23 AM, Milan Melena wrote: > Hi, > > I use following code snippet for code exec/eval: > > ​​ > def exec_then_eval(code, ns): > block = ast.parse(code, mode='exec') > if len(block.body) > 0 and isinstance(block.body[-1], ast.Expr): >

Re: Syntax colorizer change for html

2018-03-29 Thread Rob
I'm stumped! After much experimenting, I find the following: 1. The Leo Light theme (copied from EKRLight.leo) is my favorite color palette. However, the html syntax color for tags is black (same as content color), not blue. I changed the @color markup_color = blue (also tried some

File Templating

2018-03-29 Thread k-hen
Hi All, I'm familiar with the scripting components but was wondering if there's an existing way to do basic templating using @files. Essentially for starters I just want to be able to reference the current headline name within the body that gets written to the file. I could probably write a

Re: a9709ee: second draft of eval command

2018-03-29 Thread Edward K. Ream
On Thu, Mar 29, 2018 at 11:47 AM, Terry Brown wrote: To me the entire point of the vs-eval commands was to give > the smoothest possible Python evaluation / execution in Leo - without > any additional motivations. > ​..​ > > So I don't want to limit options with the eval-* commands because of >

Re: a9709ee: second draft of eval command

2018-03-29 Thread Milan Melena
Hi, I use following code snippet for exec/eval: def exec_then_eval(code, ns): block = ast.parse(code, mode='exec') if len(block.body) > 0 and isinstance(block.body[-1], ast.Expr): last = ast.Expression(block.body.pop().value) exec(compile(block, '', mode='exec'), ns)

Re: Syntax colorizer change for html

2018-03-29 Thread Terry Brown
On Thu, 29 Mar 2018 14:20:17 -0700 Chris George wrote: > Terry uses a custom theme of his own devising. which is attached here is anyone wants to try it https://github.com/leo-editor/leo-editor/issues/595#issuecomment-347030885 although I may have tweaked it to cope with

45b20e4: Third draft of eval commands optionally restores legacy operation

2018-03-29 Thread Edward K. Ream
The "legacy" ivar, set using @bool legacy-eval, controls whether the old or new code is used. The default is True if no such setting is found. The new code is much like the old. The old_eval and eval.show_legacy_answer methods contain almost all the legacy code. There are a few minor other

Re: 45b20e4: Third draft of eval commands optionally restores legacy operation

2018-03-29 Thread Terry Brown
On Thu, 29 Mar 2018 14:39:23 -0700 (PDT) "Edward K. Ream" wrote: > The "legacy" ivar, set using @bool legacy-eval, controls whether the > old or new code is used. The default is True if no such setting is > found. > > The new code is much like the old. The old_eval and >

Re: Syntax colorizer change for html

2018-03-29 Thread Rob
So, the mystery is why does it work with some themes and not with others? After much searching, I can't find the 'missing link'. Rob... On Thursday, March 29, 2018 at 3:48:03 PM UTC-4, Terry Brown wrote: > > > with @language html at top of node, and my personal old solarized dark > theme, I

Re: a9709ee: second draft of eval command

2018-03-29 Thread Milan Melena
Hi, I use following code snippet for code exec/eval: def exec_then_eval(code, ns): block = ast.parse(code, mode='exec') if len(block.body) > 0 and isinstance(block.body[-1], ast.Expr): last = ast.Expression(block.body.pop().value) exec(compile(block, '', mode='exec'), ns)

Re: Syntax colorizer change for html

2018-03-29 Thread Chris George
Terry uses a custom theme of his own devising. Do you use the syntax coloring settings Terry? Chris On Thu, Mar 29, 2018 at 1:49 PM, Rob wrote: > So, the mystery is why does it work with some themes and not with others? > After much searching, I can't find the 'missing

Re: Syntax colorizer change for html

2018-03-29 Thread Chris George
My system does exactly what yours does. I loaded a large, complex html document. With no @language directive, all of the text except for urls is white. The urls are the color specified in the "Leo constructs" setting. Add @language html. Now the document pulls in coloring for other elements

Re: Syntax colorizer change for html

2018-03-29 Thread Chris George
Looking at a raw html file, it is all white except the urls are the color which is defined in "Leo constructs". As soon as I add @language html to the node, the syntax coloring comes into play. HTH, Chris

Re: Syntax colorizer change for html

2018-03-29 Thread Chris George
I am becoming convinced that the syntax coloring settings don't work. Before I changed the settings, I read as much as I could find about it. My understanding is those language elements are tagged with the keyboard1, keyword2 etc. and the colors themselves are set via the syntax coloring

Re: Syntax colorizer change for html

2018-03-29 Thread Rob
That doesn't work for me. I always have the @language html in the root node of these files, and it still doesn't work. Wonder what's different about my system from yours. This screenshot of an example with Breeze Dark theme loaded:

a9709ee: second draft of eval command

2018-03-29 Thread Edward K. Ream
I spent quite a few happy hours yesterday and this morning completely revising the EvalController code. The evaluation of python expressions and statements has collapsed as follows: *do_exec*: Only exec is used, never eval. The code works for both python 2 and 3. After the exec, the local

Re: 45b20e4: Third draft of eval commands optionally restores legacy operation

2018-03-29 Thread Edward K. Ream
On Thu, Mar 29, 2018 at 4:57 PM, Terry Brown wrote: > > vs-eval would eval the selection if there was one, eval doesn't seem to > do that. > ​Rev 266da64c makes the selection visible. But I'm pretty the sure eval works as always.​ > > eval-block on this rather odd

Re: 45b20e4: Third draft of eval commands optionally restores legacy operation

2018-03-29 Thread Terry Brown
On Thu, 29 Mar 2018 18:35:49 -0500 "Edward K. Ream" wrote: > On Thu, Mar 29, 2018 at 4:57 PM, Terry Brown > wrote: > > > vs-eval would eval the selection if there was one, eval doesn't > > seem to do that. > > ​Rev 266da64c makes the selection

Re: a9709ee: second draft of eval command

2018-03-29 Thread Edward K. Ream
On Thursday, March 29, 2018 at 4:08:15 AM UTC-5, Edward K. Ream wrote: > > > The evaluation of python expressions and statements has collapsed as > follows: > Rev c27c613 correctly assigns a value to the last_result ivar, so that eval-replace works as expected. Edward -- You received this

Re: a9709ee: second draft of eval command

2018-03-29 Thread Terry Brown
On Thu, 29 Mar 2018 02:08:15 -0700 (PDT) "Edward K. Ream" wrote: > I spent quite a few happy hours yesterday and this morning completely > revising the EvalController code. Which probably makes it hard to hear a bunch of whiny criticism, but all the functionality of these

Re: a9709ee: second draft of eval command

2018-03-29 Thread Edward K. Ream
On Thu, Mar 29, 2018 at 8:12 AM, Edward K. Ream wrote: Rev c27c613 correctly assigns a value to the last_result ivar, so that >> eval-replace works as expected. >> > ​And rev d48a636 updates proc_cmds in mod_http.py to use c.evalController.eval_text instead of

Re: a9709ee: second draft of eval command

2018-03-29 Thread Edward K. Ream
On Thu, Mar 29, 2018 at 10:36 AM, Edward K. Ream wrote: These problems​​ > ​ ​ > must be fixed with the new scheme. > ​Rev 5282399 ​ ​fixes a crasher in get_selected_lines, but that does not fix the evaluation of expressions. Indeed, exec(2+2) adds nothing to the