Mercurial > vim
changeset 4613:219b2fcad60d v7.3.1054
updated for version 7.3.1054
Problem: Can't build without the +autocmd feature. (Elimar Riesebieter)
Solution: Fix use of buf and curbuf.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 30 May 2013 11:43:15 +0200 |
parents | 44ca4bc7d747 |
children | 560c247794b8 |
files | src/ex_cmds.c src/testdir/test86.ok src/testdir/test87.ok src/version.c |
diffstat | 4 files changed, 21 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -2421,10 +2421,11 @@ rename_buffer(new_fname) char_u *new_fname; { char_u *fname, *sfname, *xfname; + buf_T *buf; + #ifdef FEAT_AUTOCMD - buf_T *buf = curbuf; - - apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, buf); + buf = curbuf; + apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); /* buffer changed, don't change name now */ if (buf != curbuf) return FAIL; @@ -2440,18 +2441,18 @@ rename_buffer(new_fname) * But don't set the alternate file name if the buffer didn't have a * name. */ - fname = buf->b_ffname; - sfname = buf->b_sfname; - xfname = buf->b_fname; - buf->b_ffname = NULL; - buf->b_sfname = NULL; - if (setfname(buf, new_fname, NULL, TRUE) == FAIL) - { - buf->b_ffname = fname; - buf->b_sfname = sfname; + fname = curbuf->b_ffname; + sfname = curbuf->b_sfname; + xfname = curbuf->b_fname; + curbuf->b_ffname = NULL; + curbuf->b_sfname = NULL; + if (setfname(curbuf, new_fname, NULL, TRUE) == FAIL) + { + curbuf->b_ffname = fname; + curbuf->b_sfname = sfname; return FAIL; } - buf->b_flags |= BF_NOTEDITED; + curbuf->b_flags |= BF_NOTEDITED; if (xfname != NULL && *xfname != NUL) { buf = buflist_new(fname, xfname, curwin->w_cursor.lnum, 0); @@ -2461,7 +2462,7 @@ rename_buffer(new_fname) vim_free(fname); vim_free(sfname); #ifdef FEAT_AUTOCMD - apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, buf); + apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); #endif /* Change directories when the 'acd' option is set. */ DO_AUTOCHDIR
--- a/src/testdir/test86.ok +++ b/src/testdir/test86.ok @@ -320,13 +320,13 @@ Second line Third line foo 1:BufFilePre:1 -6:BufFilePost:1 +1:BufFilePost:1 testdir/foo 5:BufFilePre:5 5:BufFilePost:5 testdir/bar 1:BufFilePre:1 -7:BufFilePost:1 +1:BufFilePost:1 testdir/test86.in valid: b:False, cb:True i:<buffer test86.in>
--- a/src/testdir/test87.ok +++ b/src/testdir/test87.ok @@ -309,13 +309,13 @@ Second line Third line foo 1:BufFilePre:1 -6:BufFilePost:1 +1:BufFilePost:1 testdir/foo 5:BufFilePre:5 5:BufFilePost:5 testdir/bar 1:BufFilePre:1 -7:BufFilePost:1 +1:BufFilePost:1 testdir/test87.in valid: b:False, cb:True i:<buffer test87.in>