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

Reply via email to