1. [LINUX] source files made executable instantly

Hi,

I thought I'd share this neat little prefix_macro for any of you who may 
use my Object Euphoria editor (available on the Recent User 
Contributions page on RDS web site).

-- insert in "elsif" clauses in function prefix_macro()

elsif equal(macro, "topline")then
 if platform() = LINUX
	
	addqueue(CONTROL_T & CR & ARROW_UP & "#!" & gentenv("EUDIR")
 		    & "/bin/exu" & CR)
	addqueue(ESCAPE & "w")  -- save file
	
	-- "file_name" is the sequence declared previously in 
	-- in the editor holding the name of the file currently
        -- being edited - use as is:
	system("chmod +x " & file_name, 0)  	
        	
 end if

Once the macro is installed in the editor save the amended editor file. 
Now whenever your editing a file you can execute the macro
from any point in the file your editing thusly:

";topline "  ( without the quotes of course - the space after the macro 
triggers exectution of the macro) The macro call string (;topline ) is 
immediately erased from the text.

The file you are editing has now been made executable under LINUX by 
entering "./myprog.ex(u)" at the command line.  Or it may be executed in 
the same manner as a compiled executable if copied anywhere into the 
path, such as "/home/ken/euphoria/bin/". For that matter you can
easily add a command to the "topline" macro to copy your executable file 
into your path such as this: 

system("cp " & file_name & " /home/ken/euphoria/bin/", 0)

Mike Nelson wrote the prefix_macro() function for me when I told him
I was working on an editor for Object Euphoria.  It really is a 
marvelous piece of work -as is everything Mike codes! Thanks again
Mike!  :) :)


Kenneth Rhodes

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu