Re: Add back-to-indentation (M-m) for mg

Previous thread: upgrade and fsck by Otto Moerbeek on Friday, December 24, 2010 - 2:05 am. (3 messages)

Next thread: cleanup i386 pmap_fork() by Vladimir Kirillov on Friday, December 24, 2010 - 9:42 am. (4 messages)
From: Henri Kemppainen
Date: Friday, December 24, 2010 - 6:28 am

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 ...
From: Nima Hoda
Date: Friday, December 24, 2010 - 11:00 pm

Thanks for this.  Working great for me on 4.8-current/sparc64.

Cheers,
-Nima

From: Kjell Wooding
Date: Monday, December 27, 2010 - 3:01 pm

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
 ...
From: Nima Hoda
Date: Monday, December 27, 2010 - 7:33 pm

The patch isn't applying for me.  It seems tabs have been converted to

From: Kjell Wooding
Date: Tuesday, December 28, 2010 - 12:06 am

Probably my (pasting) bad. This isn't my favourite mailer. patch -l will fix
that though...


From: Nima Hoda
Date: Tuesday, December 28, 2010 - 7:19 am

Thanks, I didn't know that.  I'm not sure if more testing is needed
but the cleaned up patch is working fine for me (4.8-current/sparc64).

Cheers,
-Nima

Previous thread: upgrade and fsck by Otto Moerbeek on Friday, December 24, 2010 - 2:05 am. (3 messages)

Next thread: cleanup i386 pmap_fork() by Vladimir Kirillov on Friday, December 24, 2010 - 9:42 am. (4 messages)