1. ed.ex auto complete for switch, loop, and ifdef
- Posted by K_D_R Jan 16, 2012
- 1187 views
- Last edited Jan 17, 2012
Davy, in another thread, lamented the lack of support for the following control statements in ed.ex. The following code should do a fair job of supporting those features:
-- search for "-- expandable words and corresponding text" -- comment out the existing code block for the following -- constant assignments and then paste this code afterward: constant expand_word = {"if", "for", "while", "elsif", "switch", "ifdef", "loop", "procedure", "type", "function"}, expand_text = {" then", "= to by do", " do", " then", " do", " then", " do", "()", "()", "()" } -------------------------------------------------------------------------------------------------- -- in the subsequent procedure "try_auto_complete": insert the following code after -- the last "elsif" clause and before the "else insert_string" clause: elsif find(word, {"switch"}) then insert_string(begin & leading_white & "\tcase then" & CR & "end " & expand_word[wordnum]) elsif find(word, {"ifdef"}) then insert_string(begin & leading_white & "elsifdef then" & CR & "end " & expand_word[wordnum]) elsif find(word, {"loop"}) then insert_string(begin & CR & leading_white & "\tuntil" & CR & "end " & expand_word[wordnum])
The output should look like this:
switch do case then end switch ifdef then elsifdef then end ifdef loop do until end loop
Regards, Kenneth Rhodes
2. Re: ed.ex auto complete for switch, loop, and ifdef
- Posted by petelomax Jan 17, 2012
- 1119 views
Davy, in another thread, lamented the lack of support for the following control statements in ed.ex.
elsif find(word, {"ifdef"}) then insert_string(begin & leading_white & "\telsifdef then" & CR & "end " & expand_word[wordnum])
The output should look like this:
ifdef then elsifdef then end ifdef
Looks to me like an extraneous "\t" got left in there.
Regards, Pete
3. Re: ed.ex auto complete for switch, loop, and ifdef
- Posted by K_D_R Jan 17, 2012
- 1138 views
Looks to me like an extraneous "\t" got left in there.
Regards, Pete
LOL... you got that right! Thanks - I edited that code snippet.
Regards, Ken
4. Re: ed.ex auto complete for switch, loop, and ifdef
- Posted by Davy Jan 17, 2012
- 1135 views
Hi Ken, thanks for doing this!
5. Re: ed.ex auto complete for switch, loop, and ifdef
- Posted by K_D_R Jan 18, 2012
- 1112 views
Hi Ken, thanks for doing this!
Your welcome, Davy,
But, somehow, I'm thinking your still going to leave poor old ed for something au courant.
If you use Linux, I encourage you to give Geany a try.
Regards, Kenneth Rhodes
6. Re: ed.ex auto complete for switch, loop, and ifdef
- Posted by Davy Jan 18, 2012
- 1108 views
Ken, I've been using ed since I first discovered Euphoria in 2000, and I've got used to its simplicity. I like the fact that you don't have to keep moving from mouse to keyboard and back again; it's really a more efficient way to edit, once you get used to it. I'll take a look at Geany - I see there's Eu support for it (thanks to you).
7. Re: ed.ex auto complete for switch, loop, and ifdef
- Posted by Davy Jan 20, 2012
- 1047 views
Will Ken's additions be included in the "official" ed? I assume they will, but just checking in case I need to save a copy of ed so it's not overwritten when I update to future versions of Eu.
8. Re: ed.ex auto complete for switch, loop, and ifdef
- Posted by DerekParnell (admin) Jan 20, 2012
- 1020 views
Will Ken's additions be included in the "official" ed? I assume they will, but just checking in case I need to save a copy of ed so it's not overwritten when I update to future versions of Eu.
We'll consider it and I expect that it will be included ... but there may be a tweak or two.