diff options
author | lum <lum@cvs.openbsd.org> | 2013-06-02 10:09:22 +0000 |
---|---|---|
committer | lum <lum@cvs.openbsd.org> | 2013-06-02 10:09:22 +0000 |
commit | 8fe2dc9ae70e427a49f9750e326bdf3f70d565d4 (patch) | |
tree | 0506a1a21abd3a68827c92f4e3e7afbb23f6a267 | |
parent | 19189f6fb0f314c5e0ebc47ed5042c110ff0a036 (diff) |
Add the 'quit-window' dired command and receive a basic English lesson
from jmc@ again.
-rw-r--r-- | usr.bin/mg/buffer.c | 12 | ||||
-rw-r--r-- | usr.bin/mg/dired.c | 13 | ||||
-rw-r--r-- | usr.bin/mg/mg.1 | 6 |
3 files changed, 23 insertions, 8 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c index a847ae49d07..162db4ed950 100644 --- a/usr.bin/mg/buffer.c +++ b/usr.bin/mg/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.90 2013/02/17 10:30:26 florian Exp $ */ +/* $OpenBSD: buffer.c,v 1.91 2013/06/02 10:09:21 lum Exp $ */ /* This file is in the public domain. */ @@ -124,10 +124,10 @@ poptobuffer(int f, int n) /* * Dispose of a buffer, by name. - * Ask for the name. Look it up (don't get too - * upset if it isn't there at all!). Clear the buffer (ask + * Ask for the name (unless called by dired mode). Look it up (don't + * get too upset if it isn't there at all!). Clear the buffer (ask * if the buffer has been changed). Then free the header - * line and the buffer header. Bound to "C-X k". + * line and the buffer header. Bound to "C-x k". */ /* ARGSUSED */ int @@ -136,7 +136,9 @@ killbuffer_cmd(int f, int n) struct buffer *bp; char bufn[NBUFN], *bufp; - if ((bufp = eread("Kill buffer: (default %s) ", bufn, NBUFN, + if (f & FFRAND) /* dired mode 'q' */ + bp = curbp; + else if ((bufp = eread("Kill buffer: (default %s) ", bufn, NBUFN, EFNUL | EFNEW | EFBUF, curbp->b_bname)) == NULL) return (ABORT); else if (bufp[0] == '\0') diff --git a/usr.bin/mg/dired.c b/usr.bin/mg/dired.c index c1f83e69a7f..0259d54d375 100644 --- a/usr.bin/mg/dired.c +++ b/usr.bin/mg/dired.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dired.c,v 1.61 2013/06/02 09:57:23 lum Exp $ */ +/* $OpenBSD: dired.c,v 1.62 2013/06/02 10:09:21 lum Exp $ */ /* This file is in the public domain. */ @@ -44,6 +44,7 @@ static int d_forwpage(int, int); static int d_backpage(int, int); static int d_forwline(int, int); static int d_backline(int, int); +static int d_killbuffer_cmd(int, int); static void reaper(int); static struct buffer *refreshbuffer(struct buffer *); @@ -109,7 +110,7 @@ static PF diredn[] = { d_forwline, /* n */ d_ffotherwindow, /* o */ d_backline, /* p */ - rescan, /* q */ + d_killbuffer_cmd, /* q */ d_rename, /* r */ rescan, /* s */ rescan, /* t */ @@ -197,6 +198,7 @@ dired_init(void) funmap_add(d_backpage, "dired-scroll-down"); funmap_add(d_forwpage, "dired-scroll-up"); funmap_add(d_undel, "dired-unmark"); + funmap_add(d_killbuffer_cmd, "quit-window"); maps_add((KEYMAP *)&diredmap, "dired"); dobindkey(fundamental_map, "dired", "^Xd"); } @@ -642,6 +644,13 @@ d_create_directory(int f, int n) return (showbuffer(bp, curwp, WFFULL | WFMODE)); } +/* ARGSUSED */ +int +d_killbuffer_cmd(int f, int n) +{ + return(killbuffer_cmd(FFRAND, 0)); +} + struct buffer * refreshbuffer(struct buffer *bp) { diff --git a/usr.bin/mg/mg.1 b/usr.bin/mg/mg.1 index 828e3a0b439..b646de5316c 100644 --- a/usr.bin/mg/mg.1 +++ b/usr.bin/mg/mg.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mg.1,v 1.82 2013/06/02 09:53:42 lum Exp $ +.\" $OpenBSD: mg.1,v 1.83 2013/06/02 10:09:21 lum Exp $ .\" This file is in the public domain. .\" .Dd $Mdocdate: June 2 2013 $ @@ -947,6 +947,8 @@ dired-next-line dired-find-file-other-window .It p dired-previous-line +.It q +quit-window .It r dired-do-rename .It u @@ -996,6 +998,8 @@ Remove the deletion flag for the file on the current line. .It dired-unmark-backward Remove the deletion flag from the file listed on the current line of the dired buffer, then move up one line. +.It quit-window +Close the current dired buffer. .El .Sh CONFIGURATION FILES There are two configuration files, |