This adds the command that moves the dot to the first non-whitespace character on the line.
Index: src/usr.bin/mg/def.h =================================================================== RCS file: /cvs/src/usr.bin/mg/def.h,v retrieving revision 1.113 diff -u -p -r1.113 def.h --- src/usr.bin/mg/def.h 30 Jun 2010 19:12:54 -0000 1.113 +++ src/usr.bin/mg/def.h 22 Dec 2010 16:12:15 -0000 @@ -511,6 +511,7 @@ int indent(int, int); int forwdel(int, int); int backdel(int, int); int space_to_tabstop(int, int); +int gotoindent(int, int); /* extend.c X */ int insert(int, int); Index: src/usr.bin/mg/funmap.c =================================================================== RCS file: /cvs/src/usr.bin/mg/funmap.c,v retrieving revision 1.32 diff -u -p -r1.32 funmap.c --- src/usr.bin/mg/funmap.c 15 Sep 2008 16:13:35 -0000 1.32 +++ src/usr.bin/mg/funmap.c 22 Dec 2010 16:12:15 -0000 @@ -191,6 +191,7 @@ static struct funmap functnames[] = { {showcpos, "what-cursor-position",}, {filewrite, "write-file",}, {yank, "yank",}, + {gotoindent, "back-to-indentation",}, {NULL, NULL,} }; Index: src/usr.bin/mg/keymap.c =================================================================== RCS file: /cvs/src/usr.bin/mg/keymap.c,v retrieving revision 1.43 diff -u -p -r1.43 keymap.c --- src/usr.bin/mg/keymap.c 27 Aug 2008 04:11:52 -0000 1.43 +++ src/usr.bin/mg/keymap.c 22 Dec 2010 16:12:15 -0000 @@ -241,7 +241,7 @@ static PF metasqf[] = { static PF metal[] = { lowerword, /* l */ - rescan, /* m */ + gotoindent, /* m */ rescan, /* n */ rescan, /* o */ rescan, /* p */ Index: src/usr.bin/mg/mg.1 =================================================================== RCS file: /cvs/src/usr.bin/mg/mg.1,v retrieving revision 1.47 diff -u -p -r1.47 mg.1 --- src/usr.bin/mg/mg.1 7 Oct 2010 17:08:58 -0000 1.47 +++ src/usr.bin/mg/mg.1 22 Dec 2010 16:12:15 -0000 @@ -230,6 +230,8 @@ kill-word forward-word .It M-l downcase-word +.It M-m +back-to-indentation .It M-q fill-paragraph .It M-r @@ -402,6 +404,8 @@ Set all characters in the region to lowe Set characters to lower case, starting at the dot, and ending .Va n words away. +.It back-to-indentation +Move the dot to the first non-whitespace character of the line. .It emacs-version Return an .Nm Index: src/usr.bin/mg/random.c =================================================================== RCS file: /cvs/src/usr.bin/mg/random.c,v retrieving revision 1.26 diff -u -p -r1.26 random.c --- src/usr.bin/mg/random.c 15 Sep 2008 16:13:35 -0000 1.26 +++ src/usr.bin/mg/random.c 22 Dec 2010 16:12:15 -0000 @@ -440,3 +440,16 @@ space_to_tabstop(int f, int n) return (linsert((n << 3) - (curwp->w_doto & 7), ' ')); } #endif /* NOTAB */ + +/* + * Move the dot to the first non-whitespace character of the current line. + */ +int +gotoindent(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); +}