Hi Ed,

Eduardo Cavazos <[EMAIL PROTECTED]> writes:

> Jose,
>
> Something I've experimented with, though never put into 'factor.el' is an 
> electric ';' key.

[...]

> I don't think this kind of "electric key" behaviour is for everybody, but it 
> might be worth experimenting with. Definately should be easy to opt out 
> of. :-) Maybe even be off by default.

This is an interesting suggestion, and not difficult to implement as a
minor mode (factor-electric-mode or somesuch) for easy (de)activation.
But i'm not sure about the need to overload ';'... perhaps all we need
is an interactive factor-mode-define-word that asks for the word name
and stack effects in the minibuffer, inserting the skeleton. Then one
can have, if desired,

 (defun factor-insert-colon ()
   (interactive)
   (if (bolp)
       (factor-mode-define-word)
     (factor-mode-insert-semicolon)))

 (defun factor-mode-insert-semicolon ()
   "Inserts a semicolon if inside an unfinished word definition
   or moves outside the current word definition."
   ...)

 (define-key factor-mode-map ";" 'factor-insert-colon)

where factor-mode-insert-semicolon would scan for the end of the current
word definition, insert a ';' if need be, and go to the next line...
unless you're in the middle of a comment.

I'm not sure if this is better or preferable to have a magic ';' in the
way you describe. With the interactive factor-mode-define-word one can
also read a word definition and, when asking for the name and stack
effect components, offer its current values for easy modification in the
minibuffer, but, come to think of it, jumping between those parts in the
buffer by just pressing ';' sounds convenient too.

> Another possibility is using the ']' key to close the current expression 
> (i.e. 
> it might insert '}' or ']').

This is definitely doable; i'll give it a try.

> We type double quotes a whole lot more often than single quotes. Maybe the 
> single-quote key should insert a double-quote.

Hmm. This is very easy to set up for moderately experienced emacs users,
while probably confusing to new ones: i'm not sure it's worth putting it
there. What i've found more useful in other modes is automatic insertion
of matching parens and double quotes when inserting the opening one.

> Finally, crazy stuff like 'paredit.el' is also interesting. I.e. navigating 
> Factor code in semantic chunks.

Yes, if we can have this in place, the navigation and edition of word
definitions we were discussing above would be just a part of it,
probably without needing to define 'electric' keys: one could use
standard emacs combos like M-f, C-M-f &co. What do you think?

Cheers,
jao

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to