jed-users mailing list

[2006 Date Index] [2006 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: patch for fortran modes


On 28.09.06, Olesen, Mark wrote:
> I recently needed to edit a fortran file and had problems with the TAB
> indent key. The problem is caused by having previously used 'text-mode',
> which causes the "indent_line" bind to get lost:
> 
> public define text_mode()
> {
>    ...
>    local_setkey ("text_indent_relative", "\t");
>    %set_buffer_hook ("indent_hook", "text_indent_relative");
>    ...
> }
> 
> For extra safety (and parallel to some other modes) I've added the required
> key binding explicitly to fortran.sl and f90.sl

IMO, the better way would be to patch the text_mode(). This way the binding
of the TAB key can be done by the emulation mode (emacs, CUA, brief, ...) or
the users jed.rc without beeing overwritten by language modes.

Günter


%!%+
%\function{newline_and_indent_hook}
%\synopsis{newline_and_indent for structured text}
%\usage{ newline_and_indent_hook ()}
%\description
% Indent to level of preceding line
%\notes
% We need a separate definition, as by default newline_and_indent() uses the
% indent_hook.
%!%-
define newline_and_indent_hook()
{
   variable indent, col = what_column();
   % get number of leading spaces
   push_spot();
   bol_skip_white();
   indent = what_column();
   pop_spot();
   newline();
   if (indent > col)  % more whitespace than the calling points column
     indent = col;
   whitespace(indent-1);
}


public define text_mode()
{
   ...
   % local_setkey ("text_indent_relative", "\t");
   set_buffer_hook ("indent_hook", "text_indent_relative");
   set_buffer_hook("newline_indent_hook", "newline_and_indent_hook");
   ...
}


--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2006 date index] [2006 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]