summaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-01-13 22:01:02 +0100
committerBram Moolenaar <Bram@vim.org>2017-01-13 22:01:02 +0100
commite13b9afe1283f5ae43232b5992372a0eb570666c (patch)
treebd533d936ffe99f5791dc6f2f9284d980a88633d /src/buffer.c
parent70bcd7336f9f19304f32c52a86ed5b4b3de852c2 (diff)
patch 8.0.0177: BufEnter autocommand not fired for a directoryv8.0.0177
Problem: When opening a buffer on a directory and inside a try/catch then the BufEnter event is not triggered. Solution: Return NOTDONE from readfile() for a directory and deal with the three possible return values. (Justin M. Keyes, closes #1375, closes #1353)
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/buffer.c b/src/buffer.c
index e77fc04976..b79e277a01 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -113,16 +113,19 @@ read_buffer(
* it can be changed there. */
if (!readonlymode && !bufempty())
changed();
- else if (retval != FAIL)
+ else if (retval == OK)
unchanged(curbuf, FALSE);
#ifdef FEAT_AUTOCMD
+ if (retval == OK)
+ {
# ifdef FEAT_EVAL
- apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
+ apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
curbuf, &retval);
# else
- apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf);
+ apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf);
# endif
+ }
#endif
}
return retval;
@@ -294,7 +297,7 @@ open_buffer(
#endif
)
changed();
- else if (retval != FAIL && !read_stdin && !read_fifo)
+ else if (retval == OK && !read_stdin && !read_fifo)
unchanged(curbuf, FALSE);
save_file_ff(curbuf); /* keep this fileformat */
@@ -328,7 +331,7 @@ open_buffer(
# endif
#endif
- if (retval != FAIL)
+ if (retval == OK)
{
#ifdef FEAT_AUTOCMD
/*