Re: PilCon tomorrow (Anatomy of Vip)

2021-04-18 Thread Alexander Burger
On Sun, Apr 18, 2021 at 07:13:50PM +0200, Alexander Burger wrote:
> OK, thinking about it, I simplified it a little and will indeed use it
> occasionally perhaps :)
> 
>(de *F9  # Eval lines till mark "e"
>   (evCmd
>  (run (str (getText (jmpMark "e" ) )
> ...
> So now I do "me" somewhere to set ark "e" and then "F9" from somewhere before
> that position to execute the code.

No, thinking about it again, I will remove it frmm my ~/.pil/viprc :)

It is useless, because

1. using the existing Ctrl-E on a few expressions, one after the other, is more
   interactive and intuitive than pressing many keys to select a region and then
   evaluate it with other keys.

2. it is easier to type ":l" to reload the whole file. In general I write
   sources to be 'load'able as a whole any time.

3. it wastes a precious function key.

4. it requires more rules to remember. Keep it simple!

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: PilCon tomorrow (Anatomy of Vip)

2021-04-18 Thread Alexander Burger
On Sun, Apr 18, 2021 at 06:51:26PM +0200, Alexander Burger wrote:
> For example, put this into your .pil/viprc file:
> 
>(de *F9  # Eval lines till mark
>   (evCmd
>  (run (str (getText (jmpMark (getch) NIL 1 ) )

OK, thinking about it, I simplified it a little and will indeed use it
occasionally perhaps :)

   (de *F9  # Eval lines till mark "e"
  (evCmd
 (run (str (getText (jmpMark "e" ) )

As I'm almost always using "e" for the mark (easiest letter to type on Penti), I
hard-coded it.

And omitting the '1' is better, as it jumps to any position of mark "e" in the
line instead of the beginning of that line.

So now I do "me" somewhere to set ark "e" and then "F9" from somewhere before
that position to execute the code.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe



Re: PilCon tomorrow (Anatomy of Vip)

2021-04-18 Thread Alexander Burger
Hi Thorsten,

> that is cool, a bit like in Emacs, where you work in a major mode buffer
> and eval expressions there, maybe sending the results to a repl buffer.

Yeah, but I never missed these features, so I did not bother ;)


> What do you think about some more enhancements in that spirit:
> 
> [X] eval atom
> [X] eval expression
> [ ] eval definition/form (?)
> [ ] eval region
> [ ] eval buffer/window
> 
> (In Emacs all these commands often have "eval-x-and-go" siblings, that eval
> the expression and then jump to the repl)
> 
> In Emacs one uses markers for regions, in VIP I'm not sure ...

Vip has (like Vim) 26 markable buffers (registers a - z, but in fact you can use
any other character and thus have a lot more). Currently there is no eval for a
region, but would be simple to implement. I can't say much about such features,
as they are not my style of work.

For example, put this into your .pil/viprc file:

   (de *F9  # Eval lines till mark
  (evCmd
 (run (str (getText (jmpMark (getch) NIL 1 ) )

Mark the end of your desired region with

   m

Then go to the start of the region and type

   F9

(the register  can be a - z (or any character)).

This F9 behavior is analog to all the other editing commands like !, >, <, c, d
and y (shell, shifts, copy, delete and yank).

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: PilCon tomorrow (Anatomy of Vip)

2021-04-18 Thread Thorsten Jolitz
Hi Alex,
that is cool, a bit like in Emacs, where you work in a major mode buffer
and eval expressions there, maybe sending the results to a repl buffer.

What do you think about some more enhancements in that spirit:

[X] eval atom
[X] eval expression
[ ] eval definition/form (?)
[ ] eval region
[ ] eval buffer/window

(In Emacs all these commands often have "eval-x-and-go" siblings, that eval
the expression and then jump to the repl)

In Emacs one uses markers for regions, in VIP I'm not sure ...

The difference between expression and definition is, that in Emacs the
cursor might be inside the expression/definition, and first jumps to the
opening paren, then evaluates.

(de foo (X) (+ X| 2))

With the cursor behind X would then either return X+2 or foo. Saves some
cursor movements before evaluation, but needs different keybindings, not
only one.

Cheers
Thorsten



Alexander Burger  schrieb am So., 18. Apr. 2021, 16:39:

> Hi all,
>
> when a question or request came up at PilCon about evaluating expressions
> in
> Vip's edit buffer, I explained how this works in a line-oriented way in the
> bottom command window.
>
> Now (version 21.4.18) I added a similiar feature to normal edit buffers:
> Hitting
> Ctrl-E (edit) on either an open parenthesis or an atom causes the
> evaluation of
> that expression, with output directed to the command window.
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: PilCon tomorrow (Anatomy of Vip)

2021-04-18 Thread Alexander Burger
Hi all,

when a question or request came up at PilCon about evaluating expressions in
Vip's edit buffer, I explained how this works in a line-oriented way in the
bottom command window.

Now (version 21.4.18) I added a similiar feature to normal edit buffers: Hitting
Ctrl-E (edit) on either an open parenthesis or an atom causes the evaluation of
that expression, with output directed to the command window.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe