Re: New Emacs-style command-line editor

2012-11-30 Thread Joe Bogner
Hi Alex,


Are the arrow keys usable on the phone? Both the vi- and the
 emacs-style command line in PicoLisp now also support arrow keys
 for navigating the history.


Yes, they work great. One less keypress. Great!

Thorsten, Alex -

Would it be possible to add hooks to the emacs line editor? I came up with
a rough patch to demonstrate what I mean. I wanted to minimize the number
of changes to eled but had some problems due to needing to reference the
transient symbols. Also, I'm still pretty basic when it comes to my
understanding on the best way to do things.

In any case:

Change #1 - lib/eled.l add a hook to the front of the insMode case list

(de insMode (C)
   (if (= C ^I)
...
  (case C
 ~(car (list *EmacsKeyHook))
 (^?



Change #2 - lib/eled.l add a method to wrap the transients and invoke a
block

(de EmacsHook Prg
  (let (_Line Line _chgLine chgLine)
(eval (car Prg ))) )


From these two changes, I can inject my own functions such as this one to
automatically close parens

Let's say I have an init.l

(de closeParens (Line)
  (let (Open (length (sect Line (list ( )))
Close (length (sect Line (list ) 
(make
  (for X Line (link X))
  (for X (- Open Close) (link ))

(setq *EmacsKeyHook '((^y (EmacsHook (let L (closeParens _Line) (_chgLine
L (length L)))


I can then run:

/pil init.l -em +

: '(a (b (c Ctrl-Y

and have it automatically close my open parens

I'm sure there's other ways to do this but wanted to share the concept

Thanks again for the new feature

Joe


Re: New Emacs-style command-line editor

2012-11-30 Thread Thorsten Jolitz
Joe Bogner joebog...@gmail.com writes:

Hi Joe, 


 I tried it and it works great - just as expected. It works very well
 on my phone too which had some trouble with the terminal program
 switching in and out of vi mode due to the poor handling of Esc. I
 will definitely be using this

Thanks for the feedback, good to know that it works for others too. In
some cases there is surprising behaviour (like 'eating' the last char of
the line after a navigation command), but thats easily changed. Please
report, if you encounter 'not emacs-like' behaviour, I reused many of
the vi-functions, and sometimes the semantics of the same command are a
bit different in vi and emacs. 

 I have spent the last year learning emacs and what I've found is (my
 personal experience, not a flame war) that emacs can be more efficient
 and natural when creating new content - either code or text. Vim is
 more efficient for me when changing large amounts of code or
 refactoring. That may come with time in emacs.


I think both vi and emacs users are in the top 5pc of efficient computer
users, so no real reason to worry if one is slightly better than the
other in occasions. But since the concepts are so different, I would not
want to change frequently between thinking in vi and thinking in emacs,
so I did not even touch vi (and won't do so ;)

did you know that:

,-
| C-c v runs the command view-buffer, which is an interactive compiled
| Lisp function in `view.el'.
| 
| It is bound to C-c v.
| 
| (view-buffer BUFFER optional EXIT-ACTION)
| 
| View BUFFER in View mode, returning to previous buffer when done.
| Emacs commands editing the buffer contents are not available; instead, a
| special set of commands (mostly letters and punctuation) are defined for
| moving around in the buffer.
| Space scrolls forward, Delete scrolls backward.
| For a list of all View commands, type H or h while viewing.
`-

I dired, you just type v instead of f on a file to open it in view mode.
That nice if you want (vi-like ?) read-only navigation without messing
up your sources accidentally. Just type e to make the buffer editable
again, or q to delete the buffer.

-- 
cheers,
Thorsten

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


New Emacs-style command-line editor

2012-11-29 Thread Thorsten Jolitz

Hi List, 

I just posted a reference article on the wiki
(http://picolisp.com/5000/!wiki?emacsstyleled) that explains how to
activate and use the new Emacs-style command-line editor developed by me
(with some help from Alex). 

You can try it out with the new testing version 3.1.0.15 available on
the download page. Feedback is welcome. The goal is that Emacs users
feel right at home at the PicoLisp command-line - that its possible to
switch between the REPL and Emacs almost without being aware of changing
the application (like switching between Emacs and Conkeror).

There is still some functionality to add, but it works already quite
good, I use it all the time now. I would be highly appreciated if Emacs
users could test it and report bugs. 

-- 
cheers,
Thorsten


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


Re: New Emacs-style command-line editor

2012-11-29 Thread Joe Bogner
Thanks Thorsten!

I will give it a shot. This gives me a reason to try emacs again for
picolisp. I installed everything the other day and then switched back to vi
and vi mode in the repl after getting frustrated with not knowing how to
cycle through my command history in inferior-picolisp. I am so used to
esc k j

After some googling tonight I found how to cycle using


   - M-p (comint-previous-input)
   Select the previous command in the input history.

   - M-n (comint-next-input)
   Select the next command in the input history.


It might be nice to add this and any other tricks to your emacs style page.

By the way, if no one has tried it yet, ConqueTerm makes a nice alternative
to inferior-lisp when using vim. I typically run it in a split. I've found
the paren matching to be somewhat slow when it copies in the text so
sometimes I'll just skip ConqueTerm altogether and map a key to run pil on
the file I'm working on.




On Thu, Nov 29, 2012 at 5:27 PM, Thorsten Jolitz tjol...@googlemail.comwrote:


 Hi List,

 I just posted a reference article on the wiki
 (http://picolisp.com/5000/!wiki?emacsstyleled) that explains how to
 activate and use the new Emacs-style command-line editor developed by me
 (with some help from Alex).

 You can try it out with the new testing version 3.1.0.15 available on
 the download page. Feedback is welcome. The goal is that Emacs users
 feel right at home at the PicoLisp command-line - that its possible to
 switch between the REPL and Emacs almost without being aware of changing
 the application (like switching between Emacs and Conkeror).

 There is still some functionality to add, but it works already quite
 good, I use it all the time now. I would be highly appreciated if Emacs
 users could test it and report bugs.

 --
 cheers,
 Thorsten


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



Re: New Emacs-style command-line editor

2012-11-29 Thread Thorsten Jolitz
Joe Bogner joebog...@gmail.com writes:

Hi Joe, 

 I will give it a shot. This gives me a reason to try emacs again for
 picolisp. I installed everything the other day and then switched back
 to vi and vi mode in the repl after getting frustrated with not
 knowing how to cycle through my command history in inferior-picolisp.
 I am so used to esc k j 

there is something superior to inferior-picolisp out there: Tomas
Hlavaty's slime/swank mode for PicoLisp. He recently posted the link to
his git-repo on the mailing list. Thats a top point on my agenda to make
that mode work for me and replace inferior-picolisp. 

However, I found it very frustrating to be totally lost on the PicoLisp
command-line (since I don't know nothing about vi). And I do think that
the PicoLisp philosophy (live in the command-line, open an editor on
demand) does have its merits sometimes. Therefore I wrote the
Emacs-style editor. Its still alpha, but now I can use the PicoLisp line
editor in a 'natural way' (for an Emacs user), just like I use the Bash
command-line in Emacs mode without thinking.

 After some googling tonight I found how to cycle using

 * M-p (comint-previous-input) 
   Select the previous command in the input history.

   
 * M-n (comint-next-input) 
   Select the next command in the input history.


 It might be nice to add this and any other tricks to your emacs style
 page.


Thats already implemented, but I used C-p and C-n instead of M-p and M-n
since there is only only line in the REPL and and C-p and C-n can't
server as line-up and line-down in a buffer. However, I could change
that anytime. 

 On Thu, Nov 29, 2012 at 5:27 PM, Thorsten Jolitz
 tjolitz@googlemailcom wrote:


 Hi List,
 
 I just posted a reference article on the wiki
 (http://picolisp.com/5000/!wiki?emacsstyleled) that explains how
 to
 activate and use the new Emacs-style command-line editor developed
 by me
 (with some help from Alex).
 
 You can try it out with the new testing version 3.1.0.15 available
 on
 the download page. Feedback is welcome. The goal is that Emacs
 users
 feel right at home at the PicoLisp command-line - that its
 possible to
 switch between the REPL and Emacs almost without being aware of
 changing
 the application (like switching between Emacs and Conkeror).
 
 There is still some functionality to add, but it works already
 quite
 good, I use it all the time now. I would be highly appreciated if
 Emacs
 users could test it and report bugs.
 
 --
 cheers,
 Thorsten
 
 
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
 



-- 
cheers,
Thorsten

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


Re: New Emacs-style command-line editor

2012-11-29 Thread Joe Bogner
Thorsten - Thanks for the reply. I tried it and it works great - just as
expected. It works very well on my phone too which had some trouble with
the terminal program switching in and out of vi mode due to the poor
handling of Esc. I will definitely be using this


On Thu, Nov 29, 2012 at 10:15 PM, Thorsten Jolitz tjol...@googlemail.comwrote:

 Joe Bogner joebog...@gmail.com writes:

 Hi Joe,

  I will give it a shot. This gives me a reason to try emacs again for
  picolisp. I installed everything the other day and then switched back
  to vi and vi mode in the repl after getting frustrated with not
  knowing how to cycle through my command history in inferior-picolisp.
  I am so used to esc k j

 there is something superior to inferior-picolisp out there: Tomas
 Hlavaty's slime/swank mode for PicoLisp. He recently posted the link to
 his git-repo on the mailing list. Thats a top point on my agenda to make
 that mode work for me and replace inferior-picolisp.


I will have to look into that further. Thanks for the suggestion


 However, I found it very frustrating to be totally lost on the PicoLisp
 command-line (since I don't know nothing about vi). And I do think that
 the PicoLisp philosophy (live in the command-line, open an editor on
 demand) does have its merits sometimes. Therefore I wrote the
 Emacs-style editor. Its still alpha, but now I can use the PicoLisp line
 editor in a 'natural way' (for an Emacs user), just like I use the Bash
 command-line in Emacs mode without thinking.


I have spent the last year learning emacs and what I've found is (my
personal experience, not a flame war) that emacs can be more efficient and
natural when creating new content - either code or text. Vim is more
efficient for me when changing large amounts of code or refactoring. That
may come with time in emacs.


  After some googling tonight I found how to cycle using
 
  * M-p (comint-previous-input)
Select the previous command in the input history.
 
 
  * M-n (comint-next-input)
Select the next command in the input history.
 
 
  It might be nice to add this and any other tricks to your emacs style
  page.


 Thats already implemented, but I used C-p and C-n instead of M-p and M-n
 since there is only only line in the REPL and and C-p and C-n can't
 server as line-up and line-down in a buffer. However, I could change
 that anytime.


Works like a charm


  On Thu, Nov 29, 2012 at 5:27 PM, Thorsten Jolitz
  tjolitz@googlemailcom wrote:
 
 
  Hi List,
 
  I just posted a reference article on the wiki
  (http://picolisp.com/5000/!wiki?emacsstyleled) that explains how
  to
  activate and use the new Emacs-style command-line editor developed
  by me
  (with some help from Alex).
 
  You can try it out with the new testing version 3.1.0.15 available
  on
  the download page. Feedback is welcome. The goal is that Emacs
  users
  feel right at home at the PicoLisp command-line - that its
  possible to
  switch between the REPL and Emacs almost without being aware of
  changing
  the application (like switching between Emacs and Conkeror).
 
  There is still some functionality to add, but it works already
  quite
  good, I use it all the time now. I would be highly appreciated if
  Emacs
  users could test it and report bugs.
 
  --
  cheers,
  Thorsten
 
 
  --
  UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
 
 
 

 --
 cheers,
 Thorsten

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



Re: New Emacs-style command-line editor

2012-11-29 Thread Alexander Burger
Hi Joe,

 expected. It works very well on my phone too which had some trouble with
 the terminal program switching in and out of vi mode due to the poor
 handling of Esc.

Are the arrow keys usable on the phone? Both the vi- and the
emacs-style command line in PicoLisp now also support arrow keys
for navigating the history.

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