Looks good. Here is a slight cleanup. Essentially, fix alphabetical ordering, change function name :
Index: def.h =================================================================== RCS file: /cvs/src/usr.bin/mg/def.h,v retrieving revision 1.113 diff -u -u -r1.113 def.h --- def.h 30 Jun 2010 19:12:54 -0000 1.113 +++ def.h 27 Dec 2010 21:58:28 -0000 @@ -511,6 +511,7 @@ int forwdel(int, int); int backdel(int, int); int space_to_tabstop(int, int); +int backtoindent(int, int); /* extend.c X */ int insert(int, int); Index: funmap.c =================================================================== RCS file: /cvs/src/usr.bin/mg/funmap.c,v retrieving revision 1.32 diff -u -u -r1.32 funmap.c --- funmap.c 15 Sep 2008 16:13:35 -0000 1.32 +++ funmap.c 27 Dec 2010 21:58:28 -0000 @@ -26,6 +26,7 @@ {auto_execute, "auto-execute", }, {fillmode, "auto-fill-mode",}, {indentmode, "auto-indent-mode",}, + {backtoindent, "back-to-indentation",}, {backchar, "backward-char",}, {delbword, "backward-kill-word",}, {gotobop, "backward-paragraph",}, Index: keymap.c =================================================================== RCS file: /cvs/src/usr.bin/mg/keymap.c,v retrieving revision 1.43 diff -u -u -r1.43 keymap.c --- keymap.c 27 Aug 2008 04:11:52 -0000 1.43 +++ keymap.c 27 Dec 2010 21:58:28 -0000 @@ -241,7 +241,7 @@ static PF metal[] = { lowerword, /* l */ - rescan, /* m */ + backtoindent, /* m */ rescan, /* n */ rescan, /* o */ rescan, /* p */ Index: mg.1 =================================================================== RCS file: /cvs/src/usr.bin/mg/mg.1,v retrieving revision 1.47 diff -u -u -r1.47 mg.1 --- mg.1 7 Oct 2010 17:08:58 -0000 1.47 +++ mg.1 27 Dec 2010 21:58:28 -0000 @@ -230,6 +230,8 @@ forward-word .It M-l downcase-word +.It M-m +back-to-indentation .It M-q fill-paragraph .It M-r @@ -304,6 +306,8 @@ to a new line. .It auto-indent-mode Toggle indent mode, where indentation is preserved after a newline. +.It back-to-indentation +Move the dot to the first non-whitespace character on the current line. .It backward-char Move cursor backwards one character. .It backward-kill-word Index: random.c =================================================================== RCS file: /cvs/src/usr.bin/mg/random.c,v retrieving revision 1.26 diff -u -u -r1.26 random.c --- random.c 15 Sep 2008 16:13:35 -0000 1.26 +++ random.c 27 Dec 2010 21:58:28 -0000 @@ -440,3 +440,16 @@ return (linsert((n << 3) - (curwp->w_doto & 7), ' ')); } #endif /* NOTAB */ + +/* + * Move the dot to the first non-whitespace character of the current line. + */ +int +backtoindent(int f, int n) +{ + gotobol(FFRAND, 1); + while (curwp->w_doto < llength(curwp->w_dotp) && + (isspace(lgetc(curwp->w_dotp, curwp->w_doto)))) + ++curwp->w_doto; + return (TRUE); +}