Re: Wiki: Using 'edit'

2011-07-28 Thread Christian Kellermann
* Alexander Burger  [110728 10:25]:
> Hi Christian,
> 
> > > .. or write an implementation for emacs :)
> > 
> > you could either substitute the call to emacsclient directly or when
> > running under UNIX get $EDITOR and start that.
> 
> Just setting EDITOR is not enough.
> 
> An implementation for another editor would probably define different key
> mappings instead of 'K' and 'Q', according to the conventions of that
> editor (e.g. some finger-twisting combinations for 'emacs').


Ah now the "edit" page makes even more sense ;)
Thanks for the clarification!

Christian

-- 
Who can (make) the muddy water (clear)? Let it be still, and it will
gradually become clear. Who can secure the condition of rest? Let
movement go on, and the condition of rest will gradually arise.
 -- Lao Tse. 
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Wiki: Using 'edit'

2011-07-28 Thread Alexander Burger
Hi Christian,

> > .. or write an implementation for emacs :)
> 
> you could either substitute the call to emacsclient directly or when
> running under UNIX get $EDITOR and start that.

Just setting EDITOR is not enough.


Substituting' another editor instead of 'vim is the way to go. I don't
know 'emacs', but I understand it is more flexible than 'vim', so it
must be possible.


What is needed is just to replace a single expression in "lib/edit.l",
line 40, where 'vim' is called:

   (call 'vim
  "+set isk=33-34,36-38,42-90,92,94-95,97-125"
  "+map K yw:call setline(line(\"$\"), \"(\" . line(\".\") . \" \" . @@ . 
\")\")^MZZ"
  "+map Q GC(0)^[ZZ"
  (pack "+" "N")
  "*F" )

Explanation:

This calls 'vim' with the file "*F" (here the last argument). The other
four arguments instruct the editor to do the following things:

   1. Define which characters constitute a symbol ('isk' = "iskeyword")
  !"
  $%&
  *+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ
  \
  ^_
  abcdefghijklmnopqrstuvwxyz{|}

   2. Define a mapping for 'K':
  - Read the word (Lisp symbol) at the current cursor location

  - Overwrite the last line of the edit buffer with a list
( ). This information is used later by
'edit' to restart the editing session with  added, and
to return to  when going back.

  - Save changes and exit 'vim'

   3. Define a mapping for 'Q':
  - Overwrite the last line with (0). This is used by 'edit' to go
back one level.

  - Save changes and exit 'vim'

   4. Go to line number "N"


An implementation for another editor would probably define different key
mappings instead of 'K' and 'Q', according to the conventions of that
editor (e.g. some finger-twisting combinations for 'emacs').

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


Re: Wiki: Using 'edit'

2011-07-28 Thread Christian Kellermann
* Alexander Burger  [110728 08:15]:
> Hi Tomas,
> 
> > > article about the 'edit' function: http://picolisp.com/5000/-2-1j.html
> > 
> > brilliant, thank you!  Now I just need to learn vi:-D
> 
> .. or write an implementation for emacs :)

you could either substitute the call to emacsclient directly or when
running under UNIX get $EDITOR and start that.

Cheers,

Christian

-- 
Who can (make) the muddy water (clear)? Let it be still, and it will
gradually become clear. Who can secure the condition of rest? Let
movement go on, and the condition of rest will gradually arise.
 -- Lao Tse. 
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Wiki: Using 'edit'

2011-07-27 Thread Alexander Burger
Hi Tomas,

> > article about the 'edit' function: http://picolisp.com/5000/-2-1j.html
> 
> brilliant, thank you!  Now I just need to learn vi:-D

.. or write an implementation for emacs :)
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Wiki: Using 'edit'

2011-07-27 Thread Thorsten
Hi Alex, 
very interesting, helpfull - and comprehensible ;)
Thanks
Thorsten

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


Re: Wiki: Using 'edit'

2011-07-27 Thread Tomas Hlavaty
Hi Alex,

> article about the 'edit' function: http://picolisp.com/5000/-2-1j.html

brilliant, thank you!  Now I just need to learn vi:-D

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