jed-users mailing list

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

patch for fortran modes


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

/mark

--- fortran.sl.orig     2006-08-28 12:09:09.000000000 +0200
+++ fortran.sl  2006-09-28 10:09:08.000000000 +0200
@@ -336,6 +336,7 @@
 $1 = "Fortran";
 !if (keymap_p ($1)) make_keymap ($1);

+definekey ("indent_line",              "\t",   $1);
 definekey ("fortran_comment",          "\e;",  $1);
 definekey ("fortran_uncomment",                "\e:",  $1);
 definekey ("fortran_continue_newline", "\e\r", $1);
--- f90.sl.orig 2006-08-28 12:09:09.000000000 +0200
+++ f90.sl      2006-09-28 10:29:44.000000000 +0200
@@ -27,6 +27,7 @@
    variable cs = CASE_SEARCH;
    variable ch;

+% FIX: replace USER_BLOCK0 with bol_skip_white()
    % goto beginning of line and skip past tabs and spaces
    USER_BLOCK0
      {
@@ -43,11 +44,13 @@
        bol_skip_white();
        if (eolp() or looking_at("!") or looking_at("&") or looking_at("#")
)
          continue;
+% FIX: replace USER_BLOCK0 with bol_skip_white()
        X_USER_BLOCK0 ();
        goal = what_column ();

 %      if (goal == 1) continue;

+% FIX: replace with skip_chars ("0-9 \t");
        skip_chars (" \t1234567890");
        if (looking_at("do ") or looking_at("else")
            or looking_at("function")
@@ -88,6 +91,7 @@
    % now check current line
    pop_spot ();
    push_spot ();
+% FIX: replace USER_BLOCK0 with bol_skip_white()
    X_USER_BLOCK0 ();

    if (looking_at("end") )
@@ -123,12 +127,13 @@
    switch (ch)
      {
        case F90_Continue_Char :        % continuation character
-       bol (); trim ();
+       bol_trim ();
+% FIX: insert content of USER_BLOCK1 and simplify
        X_USER_BLOCK1 ();
      }
      {
        not (bolp()) or eolp ():        % general case
-       bol (); trim ();
+       bol_trim ();
        goal--;
        insert_spaces (goal);
      }
@@ -187,14 +192,14 @@

    if (cont1)
      {
-       insert( " " );
+       insert_single_space();
        insert(F90_Continue_Char);
      }
    newline ();
    if ( cont )
      {
        insert(F90_Continue_Char);
-       insert( " " );
+       insert_single_space();
      }
    insert_single_space ();
    free_f90_indent ();
@@ -284,19 +289,19 @@

        if (what_column () >= 6)
          {
-            bol (); trim ();
+            bol_trim ();
             insert_single_space ();
          }
        X_USER_BLOCK1 ();
      }
      {
        case F90_Continue_Char :        % continuation character
-       bol (); trim (); insert ("     ");
+       bol_trim (); insert ("     ");
        X_USER_BLOCK1 ();
      }
      {
        not (bolp()) or eolp ():        % general case
-       bol (); trim ();
+       bol_trim ();
        goal--;
        insert_spaces (goal);
      }
@@ -565,6 +570,7 @@
 $1 = "F90";
 !if (keymap_p ($1)) make_keymap ($1);

+definekey ("indent_line",              "\t",   $1);
 definekey ("f90_comment",              "\e;",  $1);
 definekey ("f90_uncomment",            "\e:",  $1);
 definekey ("f90_continue_newline",     "\e\r", $1);



This e-mail message and any attachments may contain legally privileged, confidential or proprietary Information, or information otherwise protected by law of ArvinMeritor, Inc., its affiliates, or third parties. This notice serves as marking of its ?Confidential? status as defined in any confidentiality agreements concerning the sender and recipient. If you are not the intended recipient(s), or the employee or agent responsible for delivery of this message to the intended recipient(s), you are hereby notified that any dissemination, distribution or copying of this e-mail message is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete this e-mail message from your computer.



--------------------------
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]