Download raw body.
mg: c-mode should respect set-tab-width
this comes from Daniel Hennigar via the troglobit/mg fork/portable
version.
it makes mg c-mode respect `set-tab-width' (the per-buffer tab width)
instead of hardcoding 8 and 4.
okay?
diff /home/op/w/mg
path + /home/op/w/mg
commit - eebb4eb391ed9237ebc2e3d507d4f7f1c310229d
blob - 26bba76dd5a610f78220d3d63d600e6c2f6cd078
file + cmode.c
--- cmode.c
+++ cmode.c
@@ -23,9 +23,6 @@
extern int changemode(int, int, char *);
static int cc_strip_trailp = TRUE; /* Delete Trailing space? */
-static int cc_basic_indent = 8; /* Basic Indent multiple */
-static int cc_cont_indent = 4; /* Continued line indent */
-static int cc_colon_indent = -8; /* Label / case indent */
static int getmatch(int, int);
static int getindent(const struct line *, int *);
@@ -322,17 +319,17 @@ getindent(const struct line *lp, int *curi)
* we continue
*/
if (colonp) {
- *curi += cc_colon_indent;
- newind -= cc_colon_indent;
+ *curi += -curbp->b_tabw;
+ newind -= -curbp->b_tabw;
}
- *curi -= (cbrace) * cc_basic_indent;
- newind += obrace * cc_basic_indent;
+ *curi -= (cbrace) * curbp->b_tabw;
+ newind += obrace * curbp->b_tabw;
if (nparen < 0)
- newind -= cc_cont_indent;
+ newind -= curbp->b_tabw / 2;
else if (nparen > 0)
- newind += cc_cont_indent;
+ newind += curbp->b_tabw / 2;
*curi += nicol;
mg: c-mode should respect set-tab-width