1. ed.ed :: replacing "clone" with "open" in the ed.ex menu
- Posted by K_D_R Jan 20, 2012
- 1116 views
In order to load a new file in a new ed.ex "pane", you have to go through two steps. First - ESCAPE + 'c' which "clones" the current file 2nd - ESCAPE + 'n' which allows you to enter a name or name and path for a new file.
This is a very simple modification to the procedure "get_escape(boolean help)" which automates the process and saves a couple of key strokes. You will be replacing, or rather, editing the routines related to the menu item "clone" with ones for the menu item "open". Also, you can simply add the "open" routine, without deleting the clone routines, by simply adding the letter 'o' to the sequence of hot-keys and adding the new elsif call to 'o' after the existing call to 'c'. If your screen width is big enough, "open " can be added to the menu, if you wish not to replace the "clone " menu item. As long as 'o' is listed in the sequence of hot-keys and the corresponding elsif code exists, it does not matter if "open " is listed as a menu item.
-- replace this this clause: elsif command [1] = 'c' then clone_window() -- this clause: elsif command [1] = 'o' then clone_window() add_queue(CR & ESCAPE & 'n')
Make a back-up copy of ed.ex, then load ed.ex into ed.ex. With "ed.ex" loaded into a pane...
ONE: Replace "clone" with open in the top-line menu: Enter ESCAPE + 'r', the enter the search string, "clone ", with the space and the quote marks. Press return and enter the replace string, "open ", likewise with the space and quote marks, then press RETURN.
TWO: replace the hot-key letter 'c' with 'o': Press ESCAPE + 'r' and enter the search string,'hcq', without the single quote marks, then press RETURN. Enter 'hoq' for the replace string, then press RETURN.
THREE: Insert the "elsif" clause which processes the new hot-key command, 'o', for the new top line menu item, "open":
Press ESCAPE 'r' and then enter the search string,'c', with the single quote marks then Press RETURN. Enter 'o' with the single quote marks for the replace string, then press RETURN. Now add the fo llowing line beneath the call to the procedure clone_window():
add_queue(CR & ESCAPE & 'n')
Press ESCAPE & 'e' to test it. You have lost zero functionality because, the file has still been cloned, and all you have to do is hit return to continue editing the cloned file, if that is what you wish to do.
Regards, Kenneth Rhodes