1. ed.ex auto complete for switch, loop, and ifdef

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

new topic     » topic index » view message » categorize

2. Re: ed.ex auto complete for switch, loop, and ifdef

K_D_R said...

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: ed.ex auto complete for switch, loop, and ifdef

petelomax said...

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

new topic     » goto parent     » topic index » view message » categorize

4. Re: ed.ex auto complete for switch, loop, and ifdef

Hi Ken, thanks for doing this!

new topic     » goto parent     » topic index » view message » categorize

5. Re: ed.ex auto complete for switch, loop, and ifdef

Davy said...

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

new topic     » goto parent     » topic index » view message » categorize

6. Re: ed.ex auto complete for switch, loop, and ifdef

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).

new topic     » goto parent     » topic index » view message » categorize

7. Re: ed.ex auto complete for switch, loop, and ifdef

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.

new topic     » goto parent     » topic index » view message » categorize

8. Re: ed.ex auto complete for switch, loop, and ifdef

Davy said...

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.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu