[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [StrongED] modefile adding to menu; comment markers



In message <f2c310cc56.jim@xxxxxxxxxxxxxxxx>
          Jim Nagel <stred@xxxxxxxxxxxxxxxx> wrote:

> I've been experimenting with a StrongEd modefile for handling HTML. 
> Apparently certain lines in the modefile add items to the menu that 
> you see when editing an HTML file -- nifty.

Specifying a Menu line in the Functions section of the ModeFile will
cause the associated text to be added as an entry to the mode menu.

> Haven't yet figured out whether it's possible to assign a keystroke to 
> one of those menu operations.  How?  And, if so, is it possible to 
> make the chosen key shortcut show on the menu?  (because I know in a 
> few months I'll have forgotten which key to use).

Have a look at the 'Save & Render' entry which does exactly that. The
Key line specifies the keyboard shortcut. The Menu line has the shortcut
at the end separated from the entry text by one or more spaces. 

> The menu option to put comment markers around a chunk of HTML text has 
> proved very useful.   <!-- chunkchunk -->
> 
> However, would it be possible to achieve a tidier result when dealing 
> with a chunk consisting of many lines instead of just a single line?  
> The current routine puts <!-- and --> at the beginning and end of 
> every line separately.

Yes, but you need to be careful. In particular, make sure that block
editing is turned off using the 'NoIndent' function. Tie the list of
functions below to a menu entry on a single line separated by spaces.
(ie Push NoIndent Goto_BlockStart ... ).

  Push                 ; remember current caret position
  NoIndent             ; turn off block editing for these actions
  Goto_BlockStart      ; move caret to start of selected block
  InsertStr("<!-- ")   ; insert string "<!-- " at caret position
  Goto_BlockEnd        ; move caret to end of selected block
  InsertStr(" -->)     ; insert string " -->" at caret position
  Pop                  ; restore original caret position

You could replace the Replace command that is currently being used by
this list of functions. To do so, locate the following lines in the HTML
ModeFile:

  Menu      Comment section
  Select    Replace (selected_line, comment, block, line)
  Help      Hhtml_comm

Delete the entire Replace command and put in the above list of functions.

Cheers,
Fred.

-- 
StrongED Developer
http://www.stronged.iconbar.com/

-- 
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxx
List archives and instructions at
http://diy.Torrens.org/RO/StrongED/index.html