I totally forgot about the instance where blink-and-insert can be called
from the mg startup file. My previous diff broke that instance. So this
diff reverts my change but adds a man page line to blink-and-insert (and
comment).
ok?
Index: def.h
===================================================================
RCS file: /cvs/src/usr.bin/mg/def.h,v
retrieving revision 1.160
diff -u -p -u -p -r1.160 def.h
--- def.h 26 Jun 2019 16:42:30 -0000 1.160
+++ def.h 1 Jul 2019 17:00:48 -0000
@@ -642,7 +642,6 @@ void ttykeymapinit(void);
void ttykeymaptidy(void);
/* match.c X */
-int ask_showmatch(int, int);
int showmatch(int, int);
/* version.c X */
Index: funmap.c
===================================================================
RCS file: /cvs/src/usr.bin/mg/funmap.c,v
retrieving revision 1.56
diff -u -p -u -p -r1.56 funmap.c
--- funmap.c 26 Jun 2019 16:42:30 -0000 1.56
+++ funmap.c 1 Jul 2019 17:00:48 -0000
@@ -39,7 +39,7 @@ static struct funmap functnames[] = {
{backword, "backward-word",},
{gotobob, "beginning-of-buffer",},
{gotobol, "beginning-of-line",},
- {ask_showmatch, "blink-and-insert",},
+ {showmatch, "blink-and-insert",},
{bsmap, "bsmap-mode",},
{NULL, "c-x 4 prefix",},
{NULL, "c-x prefix",},
Index: match.c
===================================================================
RCS file: /cvs/src/usr.bin/mg/match.c,v
retrieving revision 1.20
diff -u -p -u -p -r1.20 match.c
--- match.c 26 Jun 2019 16:42:30 -0000 1.20
+++ match.c 1 Jul 2019 17:00:48 -0000
@@ -35,30 +35,11 @@ static struct balance {
{ '\0', '\0' }
};
-
/*
- * Self-insert character, then show matching character.
- * Bound to "blink-and-insert".
- */
-int
-ask_showmatch(int f, int n)
-{
- char *c, cbuf[2];
-
- if ((c = eread("Insert a character: ", cbuf, sizeof(cbuf),
- EFNEW)) == NULL || (c[0] == '\0'))
- return (ABORT);
-
- key.k_chars[0] = *c;
- key.k_chars[1] = '\0';
- key.k_count = 1;
-
- return (showmatch(FFRAND, 1));
-}
-
-
-/*
- * Hack to show matching paren. Bound to balance stucture chars ),],}.
+ * Hack to show matching paren. Self-insert character, then show matching
+ * character, if any. Bound to "blink-and-insert". Used in the mg startup
+ * file to amend the default cursor behaviour of a key press, e.g:
+ * global-set-key "%" blink-and-insert
*/
int
showmatch(int f, int n)
Index: mg.1
===================================================================
RCS file: /cvs/src/usr.bin/mg/mg.1,v
retrieving revision 1.115
diff -u -p -u -p -r1.115 mg.1
--- mg.1 17 Jun 2019 11:39:26 -0000 1.115
+++ mg.1 1 Jul 2019 17:00:48 -0000
@@ -417,6 +417,7 @@ matching delimiter.
For delimiters other than
parenthesis, brackets, and braces, the character itself
is used as its own match.
+Can be used in the startup file with the global-set-key command.
.It bsmap-mode
Toggle bsmap mode, where DEL and C-h are swapped.
.It c-mode