summaryrefslogtreecommitdiff
path: root/usr.bin/mg
diff options
context:
space:
mode:
authorKjell Wooding <kjell@cvs.openbsd.org>2008-06-14 08:46:31 +0000
committerKjell Wooding <kjell@cvs.openbsd.org>2008-06-14 08:46:31 +0000
commit4ef5afc9653e726120eef49602859549321429b8 (patch)
tree7d8b18154835c4d663a3059f28ceb98954729ea2 /usr.bin/mg
parent51974cb6f416b8d6c346edb2101261825e22f7ee (diff)
We do not need a whole MODE for blinking one character.
both emacsen automatically blink, so mg should too. This can be overridden in your ~/.mg by adding, e.g. global-set-key ")" self-insert-command So, I've eliminated blink mode, and renamed "blink-matching-paren-hack" to "blink-and-insert". It's not just for parens anyway. While I'm here, set up an empty (rescan) target for backtab, so I can bind something convenient to it; e.g. global-set-key "\e[Z" backward-char Finally, remove all references to Scribd. Theo doesn't hate this, though I would hesitate to call it an ok.
Diffstat (limited to 'usr.bin/mg')
-rw-r--r--usr.bin/mg/funmap.c5
-rw-r--r--usr.bin/mg/keymap.c51
-rw-r--r--usr.bin/mg/match.c8
-rw-r--r--usr.bin/mg/modes.c11
4 files changed, 34 insertions, 41 deletions
diff --git a/usr.bin/mg/funmap.c b/usr.bin/mg/funmap.c
index 4c9e68fb461..056658b5224 100644
--- a/usr.bin/mg/funmap.c
+++ b/usr.bin/mg/funmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: funmap.c,v 1.30 2008/06/11 23:18:33 kjell Exp $ */
+/* $OpenBSD: funmap.c,v 1.31 2008/06/14 08:46:30 kjell Exp $ */
/* This file is in the public domain */
@@ -32,8 +32,7 @@ static struct funmap functnames[] = {
{backword, "backward-word",},
{gotobob, "beginning-of-buffer",},
{gotobol, "beginning-of-line",},
- {blinkparen, "blink-matching-paren",},
- {showmatch, "blink-matching-paren-hack",},
+ {showmatch, "blink-and-insert",},
{bsmap, "bsmap-mode",},
{NULL, "c-x 4 prefix",},
{NULL, "c-x prefix",},
diff --git a/usr.bin/mg/keymap.c b/usr.bin/mg/keymap.c
index 0e2ae0c0289..10ebb85ca00 100644
--- a/usr.bin/mg/keymap.c
+++ b/usr.bin/mg/keymap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keymap.c,v 1.41 2008/06/12 21:13:20 kjell Exp $ */
+/* $OpenBSD: keymap.c,v 1.42 2008/06/14 08:46:30 kjell Exp $ */
/* This file is in the public domain. */
@@ -212,7 +212,8 @@ static PF metami[] = {
gotoeob /* > */
};
-static PF metabsl[] = {
+static PF metasqf[] = {
+ NULL, /* [ */
delwhite, /* \ */
rescan, /* ] */
rescan, /* ^ */
@@ -247,11 +248,26 @@ static PF metal[] = {
gotoeop /* } */
};
+static PF metasqlZ[] = {
+ rescan /* Z */
+};
+
static PF metatilde[] = {
notmodified, /* ~ */
delbword /* DEL */
};
+struct KEYMAPE (1 + IMAPEXT) metasqlmap = {
+ 1,
+ 1 + IMAPEXT,
+ rescan,
+ {
+ {
+ 'Z', 'Z', metasqlZ, NULL
+ }
+ }
+};
+
struct KEYMAPE (8 + IMAPEXT) metamap = {
8,
8 + IMAPEXT,
@@ -273,7 +289,7 @@ struct KEYMAPE (8 + IMAPEXT) metamap = {
'-', '>', metami, NULL
},
{
- '\\', 'f', metabsl, NULL
+ '[', 'f', metasqf, (KEYMAP *) &metasqlmap
},
{
'l', '}', metal, NULL
@@ -333,13 +349,17 @@ static PF fund_del[] = {
backdel /* DEL */
};
+static PF fund_cb[] = {
+ showmatch /* ) */
+};
+
#ifndef FUND_XMAPS
#define NFUND_XMAPS 0 /* extra map sections after normal ones */
#endif
-static struct KEYMAPE (4 + NFUND_XMAPS + IMAPEXT) fundmap = {
- 4 + NFUND_XMAPS,
- 4 + NFUND_XMAPS + IMAPEXT,
+static struct KEYMAPE (5 + NFUND_XMAPS + IMAPEXT) fundmap = {
+ 5 + NFUND_XMAPS,
+ 5 + NFUND_XMAPS + IMAPEXT,
selfinsert,
{
#ifndef NO_HELP
@@ -358,6 +378,9 @@ static struct KEYMAPE (4 + NFUND_XMAPS + IMAPEXT) fundmap = {
CCHR('['), CCHR('_'), fund_esc, (KEYMAP *) & metamap
},
{
+ ')', ')', fund_cb, NULL
+ },
+ {
CCHR('?'), CCHR('?'), fund_del, NULL
},
#ifdef FUND_XMAPS
@@ -397,21 +420,6 @@ static struct KEYMAPE (1 + IMAPEXT) indntmap = {
}
};
-static PF blink_rp[] = {
- showmatch /* ) */
-};
-
-static struct KEYMAPE (1 + IMAPEXT) blinkmap = {
- 1,
- 1 + IMAPEXT,
- rescan,
- {
- {
- ')', ')', blink_rp, NULL
- }
- }
-};
-
#ifdef NOTAB
static PF notab_tab[] = {
space_to_tabstop /* ^I */
@@ -459,7 +467,6 @@ struct maps_s fundamental_mode = { (KEYMAP *)&fundmap, "fundamental" };
static struct maps_s map_table[] = {
{(KEYMAP *) &fillmap, "fill",},
{(KEYMAP *) &indntmap, "indent",},
- {(KEYMAP *) &blinkmap, "blink",},
#ifdef NOTAB
{(KEYMAP *) &notabmap, "notab",},
#endif /* NOTAB */
diff --git a/usr.bin/mg/match.c b/usr.bin/mg/match.c
index 70bdead6ced..96ae0db64d2 100644
--- a/usr.bin/mg/match.c
+++ b/usr.bin/mg/match.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: match.c,v 1.14 2008/06/13 19:01:53 kjell Exp $ */
+/* $OpenBSD: match.c,v 1.15 2008/06/14 08:46:30 kjell Exp $ */
/* This file is in the public domain. */
@@ -8,9 +8,6 @@
* The hacks in this file implement automatic matching * of (), [], {}, and
* other characters. It would be better to have a full-blown syntax table,
* but there's enough overhead in the editor as it is.
- *
- * Since I often edit Scribe code, I've made it possible to blink arbitrary
- * characters -- just bind delimiter characters to "blink-matching-paren-hack"
*/
#include "def.h"
@@ -23,7 +20,6 @@ static void displaymatch(struct line *, int);
* Balance table. When balance() encounters a character that is to be
* matched, it first searches this table for a balancing left-side character.
* If the character is not in the table, the character is balanced by itself.
- * This is to allow delimiters in Scribe documents to be matched.
*/
static struct balance {
char left, right;
@@ -37,7 +33,7 @@ static struct balance {
/*
* Hack to show matching paren. Self-insert character, then show matching
- * character, if any. Bound to "blink-matching-paren-command".
+ * character, if any. Bound to "blink-and-insert".
*/
int
showmatch(int f, int n)
diff --git a/usr.bin/mg/modes.c b/usr.bin/mg/modes.c
index 7fc78b3307d..cde87284e65 100644
--- a/usr.bin/mg/modes.c
+++ b/usr.bin/mg/modes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: modes.c,v 1.17 2008/06/11 23:23:55 kjell Exp $ */
+/* $OpenBSD: modes.c,v 1.18 2008/06/14 08:46:30 kjell Exp $ */
/* This file is in the public domain. */
@@ -71,15 +71,6 @@ fillmode(int f, int n)
return (changemode(f, n, "fill"));
}
-/*
- * Fake the GNU "blink-matching-paren" variable.
- */
-int
-blinkparen(int f, int n)
-{
- return (changemode(f, n, "blink"));
-}
-
#ifdef NOTAB
int
notabmode(int f, int n)