jed-users mailing list

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

C-mode indentation: parameters


Hi!

Here is a patch that enables one to indent function call parameters like
this:

      foothatdoessomething(
            p1,
            p2);

instead of this:

      foothatdoessomething(
                           p1,
                           p2);

To enable the feature, in your .jedrc (jed.rc) add

custom_variable ("C_Param_Offset_Max", N);

where N is the maximum number of characters to indent from previous line.
If N is less than 0, feature is disabled. In the example above, N=6.

Marko

--- cmode.sl.orig     2002-10-20 08:55:30.000000000 +0200
+++ cmode.sl    2003-06-02 12:46:16.000000000 +0200
@@ -19,6 +19,7 @@
 %!%-
 custom_variable ("C_Autoinsert_CPP_Comments", 1);
 custom_variable ("C_Switch_Offset", 0);
+custom_variable ("C_Param_Offset_Max", -1);

 define cmode_is_slang_mode ()
 {
@@ -637,6 +638,9 @@
      {
       case 1:
        extra_indent = 0;              %  match found
+        if (C_Param_Offset_Max >= 0)
+           if (col - match_indent > C_Param_Offset_Max)
+              extra_indent = match_indent + C_Param_Offset_Max - col;
      }
      {
       case -2:                        %  inside comment

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


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