Hi,
2014/11/22(Sat) 11:08:53 UTC+9 h_east:
> Hi Bram and All,
>
> 2014/11/22(Sat) 7:02:29 UTC+9 Bram Moolenaar:
> > Yasuhiro Matsumoto wrote:
> >
> > > > Then the behavior would be:
> > > > vim -o a.txt b.txt c.txt
> > > > [make a change in each window]
> > > > :hide (hides a.txt, still modified)
> > > > :q! (removes modified flag from b.txt, only see c.txt now)
> > > > :q! (removes modified flag from c.txt, error, switches to
> > > > a.txt)
> > > > :q! (exits)
> > >
> > > https://gist.github.com/0dcb7a098130ed8682b6
> > >
> > > This patch should work as above.
> >
> > Thanks! I'll check it out.
>
> I came up with a better way.
> Please wait a few hour.
I attach a patch. (Contains a document patch)
Please check this.
--
Best regards,
Hirohito Higashi (a.k.a h_east)
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff -r 03a813f2cf51 runtime/doc/editing.txt
--- a/runtime/doc/editing.txt Thu Nov 20 23:07:05 2014 +0100
+++ b/runtime/doc/editing.txt Sat Nov 22 11:46:44 2014 +0900
@@ -1081,10 +1081,9 @@
edited. See |:confirm| and 'confirm'. {not in Vi}
:q[uit]! Quit without writing, also when currently visible
- buffers have changes. Does not exit when this is the
- last window and there are is a changed hidden buffer.
- In this case, the first changed hidden buffer becomes
- the current buffer.
+ buffers have changes. If this is the last window and
+ there are a changed hidden buffer, the first changed
+ hidden buffer becomes the current buffer.
Use ":qall!" to exit always.
:cq[uit] Quit always, without writing, and return an error
diff -r 03a813f2cf51 src/ex_cmds2.c
--- a/src/ex_cmds2.c Thu Nov 20 23:07:05 2014 +0100
+++ b/src/ex_cmds2.c Sat Nov 22 11:46:44 2014 +0900
@@ -1638,8 +1638,9 @@
* That changed buffer becomes the current buffer.
*/
int
-check_changed_any(hidden)
+check_changed_any(hidden, unload)
int hidden; /* Only check hidden buffers */
+ int unload; /* unload curbuf if return TRUE */
{
int ret = FALSE;
buf_T *buf;
@@ -1750,7 +1751,7 @@
/* Open the changed buffer in the current window. */
if (buf != curbuf)
- set_curbuf(buf, DOBUF_GOTO);
+ set_curbuf(buf, unload ? DOBUF_UNLOAD : DOBUF_GOTO);
theend:
vim_free(bufnrs);
diff -r 03a813f2cf51 src/ex_docmd.c
--- a/src/ex_docmd.c Thu Nov 20 23:07:05 2014 +0100
+++ b/src/ex_docmd.c Sat Nov 22 11:46:44 2014 +0900
@@ -6591,7 +6591,7 @@
| (eap->forceit ? CCGD_FORCEIT : 0)
| CCGD_EXCMD))
|| check_more(TRUE, eap->forceit) == FAIL
- || (only_one_window() && check_changed_any(eap->forceit)))
+ || (only_one_window() && check_changed_any(eap->forceit, TRUE)))
{
not_exiting();
}
@@ -6655,7 +6655,7 @@
#endif
exiting = TRUE;
- if (eap->forceit || !check_changed_any(FALSE))
+ if (eap->forceit || !check_changed_any(FALSE, FALSE))
getout(0);
not_exiting();
}
@@ -7002,7 +7002,7 @@
|| curbufIsChanged())
&& do_write(eap) == FAIL)
|| check_more(TRUE, eap->forceit) == FAIL
- || (only_one_window() && check_changed_any(eap->forceit)))
+ || (only_one_window() && check_changed_any(eap->forceit, FALSE)))
{
not_exiting();
}
diff -r 03a813f2cf51 src/gui.c
--- a/src/gui.c Thu Nov 20 23:07:05 2014 +0100
+++ b/src/gui.c Sat Nov 22 11:46:44 2014 +0900
@@ -825,7 +825,7 @@
# endif
/* If there are changed buffers, present the user with a dialog if
* possible, otherwise give an error message. */
- if (!check_changed_any(FALSE))
+ if (!check_changed_any(FALSE, FALSE))
getout(0);
exiting = FALSE;
diff -r 03a813f2cf51 src/gui_gtk_x11.c
--- a/src/gui_gtk_x11.c Thu Nov 20 23:07:05 2014 +0100
+++ b/src/gui_gtk_x11.c Sat Nov 22 11:46:44 2014 +0900
@@ -1999,7 +1999,7 @@
* If there are changed buffers, present the user with
* a dialog if possible, otherwise give an error message.
*/
- shutdown_cancelled = check_changed_any(FALSE);
+ shutdown_cancelled = check_changed_any(FALSE, FALSE);
exiting = FALSE;
cmdmod = save_cmdmod;
diff -r 03a813f2cf51 src/os_unix.c
--- a/src/os_unix.c Thu Nov 20 23:07:05 2014 +0100
+++ b/src/os_unix.c Sat Nov 22 11:46:44 2014 +0900
@@ -7163,7 +7163,7 @@
save_cmdmod = cmdmod;
cmdmod.confirm = TRUE;
- if (check_changed_any(FALSE))
+ if (check_changed_any(FALSE, FALSE))
/* Mustn't logout */
cancel_shutdown = True;
cmdmod = save_cmdmod;
diff -r 03a813f2cf51 src/proto/ex_cmds2.pro
--- a/src/proto/ex_cmds2.pro Thu Nov 20 23:07:05 2014 +0100
+++ b/src/proto/ex_cmds2.pro Sat Nov 22 11:46:44 2014 +0900
@@ -39,7 +39,7 @@
void browse_save_fname __ARGS((buf_T *buf));
void dialog_changed __ARGS((buf_T *buf, int checkall));
int can_abandon __ARGS((buf_T *buf, int forceit));
-int check_changed_any __ARGS((int hidden));
+int check_changed_any __ARGS((int hidden, int unload));
int check_fname __ARGS((void));
int buf_write_all __ARGS((buf_T *buf, int forceit));
int get_arglist __ARGS((garray_T *gap, char_u *str));