|
Karsten Hopp |
6e71d1 |
To: vim-dev@vim.org
|
|
Karsten Hopp |
6e71d1 |
Subject: Patch 7.2.021
|
|
Karsten Hopp |
6e71d1 |
Fcc: outbox
|
|
Karsten Hopp |
6e71d1 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
6e71d1 |
Mime-Version: 1.0
|
|
Karsten Hopp |
6e71d1 |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
6e71d1 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
6e71d1 |
------------
|
|
Karsten Hopp |
6e71d1 |
|
|
Karsten Hopp |
6e71d1 |
Patch 7.2.021
|
|
Karsten Hopp |
6e71d1 |
Problem: When executing autocommands getting the full file name may be
|
|
Karsten Hopp |
6e71d1 |
slow. (David Kotchan)
|
|
Karsten Hopp |
6e71d1 |
Solution: Postpone calling FullName_save() until autocmd_fname is used.
|
|
Karsten Hopp |
6e71d1 |
Files: src/ex_docmd.c, src/fileio.c, src/globals.h
|
|
Karsten Hopp |
6e71d1 |
|
|
Karsten Hopp |
6e71d1 |
|
|
Karsten Hopp |
6e71d1 |
*** ../vim-7.2.020/src/ex_docmd.c Thu Sep 18 12:43:21 2008
|
|
Karsten Hopp |
6e71d1 |
--- src/ex_docmd.c Mon Sep 15 20:04:53 2008
|
|
Karsten Hopp |
6e71d1 |
***************
|
|
Karsten Hopp |
6e71d1 |
*** 9542,9547 ****
|
|
Karsten Hopp |
6e71d1 |
--- 9569,9583 ----
|
|
Karsten Hopp |
6e71d1 |
#ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
6e71d1 |
case SPEC_AFILE: /* file name for autocommand */
|
|
Karsten Hopp |
6e71d1 |
result = autocmd_fname;
|
|
Karsten Hopp |
6e71d1 |
+ if (result != NULL && !autocmd_fname_full)
|
|
Karsten Hopp |
6e71d1 |
+ {
|
|
Karsten Hopp |
6e71d1 |
+ /* Still need to turn the fname into a full path. It is
|
|
Karsten Hopp |
6e71d1 |
+ * postponed to avoid a delay when <afile> is not used. */
|
|
Karsten Hopp |
6e71d1 |
+ autocmd_fname_full = TRUE;
|
|
Karsten Hopp |
6e71d1 |
+ result = FullName_save(autocmd_fname, FALSE);
|
|
Karsten Hopp |
6e71d1 |
+ vim_free(autocmd_fname);
|
|
Karsten Hopp |
6e71d1 |
+ autocmd_fname = result;
|
|
Karsten Hopp |
6e71d1 |
+ }
|
|
Karsten Hopp |
6e71d1 |
if (result == NULL)
|
|
Karsten Hopp |
6e71d1 |
{
|
|
Karsten Hopp |
6e71d1 |
*errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\"");
|
|
Karsten Hopp |
6e71d1 |
*** ../vim-7.2.020/src/fileio.c Wed Aug 6 18:43:07 2008
|
|
Karsten Hopp |
6e71d1 |
--- src/fileio.c Tue Sep 16 21:24:26 2008
|
|
Karsten Hopp |
6e71d1 |
***************
|
|
Karsten Hopp |
6e71d1 |
*** 8523,8528 ****
|
|
Karsten Hopp |
6e71d1 |
--- 8523,8529 ----
|
|
Karsten Hopp |
6e71d1 |
char_u *save_sourcing_name;
|
|
Karsten Hopp |
6e71d1 |
linenr_T save_sourcing_lnum;
|
|
Karsten Hopp |
6e71d1 |
char_u *save_autocmd_fname;
|
|
Karsten Hopp |
6e71d1 |
+ int save_autocmd_fname_full;
|
|
Karsten Hopp |
6e71d1 |
int save_autocmd_bufnr;
|
|
Karsten Hopp |
6e71d1 |
char_u *save_autocmd_match;
|
|
Karsten Hopp |
6e71d1 |
int save_autocmd_busy;
|
|
Karsten Hopp |
6e71d1 |
***************
|
|
Karsten Hopp |
6e71d1 |
*** 8601,8606 ****
|
|
Karsten Hopp |
6e71d1 |
--- 8602,8608 ----
|
|
Karsten Hopp |
6e71d1 |
* Save the autocmd_* variables and info about the current buffer.
|
|
Karsten Hopp |
6e71d1 |
*/
|
|
Karsten Hopp |
6e71d1 |
save_autocmd_fname = autocmd_fname;
|
|
Karsten Hopp |
6e71d1 |
+ save_autocmd_fname_full = autocmd_fname_full;
|
|
Karsten Hopp |
6e71d1 |
save_autocmd_bufnr = autocmd_bufnr;
|
|
Karsten Hopp |
6e71d1 |
save_autocmd_match = autocmd_match;
|
|
Karsten Hopp |
6e71d1 |
save_autocmd_busy = autocmd_busy;
|
|
Karsten Hopp |
6e71d1 |
***************
|
|
Karsten Hopp |
6e71d1 |
*** 8618,8631 ****
|
|
Karsten Hopp |
6e71d1 |
if (fname != NULL && *fname != NUL)
|
|
Karsten Hopp |
6e71d1 |
autocmd_fname = fname;
|
|
Karsten Hopp |
6e71d1 |
else if (buf != NULL)
|
|
Karsten Hopp |
6e71d1 |
! autocmd_fname = buf->b_fname;
|
|
Karsten Hopp |
6e71d1 |
else
|
|
Karsten Hopp |
6e71d1 |
autocmd_fname = NULL;
|
|
Karsten Hopp |
6e71d1 |
}
|
|
Karsten Hopp |
6e71d1 |
else
|
|
Karsten Hopp |
6e71d1 |
autocmd_fname = fname_io;
|
|
Karsten Hopp |
6e71d1 |
if (autocmd_fname != NULL)
|
|
Karsten Hopp |
6e71d1 |
! autocmd_fname = FullName_save(autocmd_fname, FALSE);
|
|
Karsten Hopp |
6e71d1 |
|
|
Karsten Hopp |
6e71d1 |
/*
|
|
Karsten Hopp |
6e71d1 |
* Set the buffer number to be used for <abuf>.
|
|
Karsten Hopp |
6e71d1 |
--- 8620,8634 ----
|
|
Karsten Hopp |
6e71d1 |
if (fname != NULL && *fname != NUL)
|
|
Karsten Hopp |
6e71d1 |
autocmd_fname = fname;
|
|
Karsten Hopp |
6e71d1 |
else if (buf != NULL)
|
|
Karsten Hopp |
6e71d1 |
! autocmd_fname = buf->b_ffname;
|
|
Karsten Hopp |
6e71d1 |
else
|
|
Karsten Hopp |
6e71d1 |
autocmd_fname = NULL;
|
|
Karsten Hopp |
6e71d1 |
}
|
|
Karsten Hopp |
6e71d1 |
else
|
|
Karsten Hopp |
6e71d1 |
autocmd_fname = fname_io;
|
|
Karsten Hopp |
6e71d1 |
if (autocmd_fname != NULL)
|
|
Karsten Hopp |
6e71d1 |
! autocmd_fname = vim_strsave(autocmd_fname);
|
|
Karsten Hopp |
6e71d1 |
! autocmd_fname_full = FALSE; /* call FullName_save() later */
|
|
Karsten Hopp |
6e71d1 |
|
|
Karsten Hopp |
6e71d1 |
/*
|
|
Karsten Hopp |
6e71d1 |
* Set the buffer number to be used for <abuf>.
|
|
Karsten Hopp |
6e71d1 |
***************
|
|
Karsten Hopp |
6e71d1 |
*** 8810,8815 ****
|
|
Karsten Hopp |
6e71d1 |
--- 8813,8819 ----
|
|
Karsten Hopp |
6e71d1 |
sourcing_lnum = save_sourcing_lnum;
|
|
Karsten Hopp |
6e71d1 |
vim_free(autocmd_fname);
|
|
Karsten Hopp |
6e71d1 |
autocmd_fname = save_autocmd_fname;
|
|
Karsten Hopp |
6e71d1 |
+ autocmd_fname_full = save_autocmd_fname_full;
|
|
Karsten Hopp |
6e71d1 |
autocmd_bufnr = save_autocmd_bufnr;
|
|
Karsten Hopp |
6e71d1 |
autocmd_match = save_autocmd_match;
|
|
Karsten Hopp |
6e71d1 |
#ifdef FEAT_EVAL
|
|
Karsten Hopp |
6e71d1 |
***************
|
|
Karsten Hopp |
6e71d1 |
*** 8918,8924 ****
|
|
Karsten Hopp |
6e71d1 |
{
|
|
Karsten Hopp |
6e71d1 |
apc->curpat = NULL;
|
|
Karsten Hopp |
6e71d1 |
|
|
Karsten Hopp |
6e71d1 |
! /* only use a pattern when it has not been removed, has commands and
|
|
Karsten Hopp |
6e71d1 |
* the group matches. For buffer-local autocommands only check the
|
|
Karsten Hopp |
6e71d1 |
* buffer number. */
|
|
Karsten Hopp |
6e71d1 |
if (ap->pat != NULL && ap->cmds != NULL
|
|
Karsten Hopp |
6e71d1 |
--- 8922,8928 ----
|
|
Karsten Hopp |
6e71d1 |
{
|
|
Karsten Hopp |
6e71d1 |
apc->curpat = NULL;
|
|
Karsten Hopp |
6e71d1 |
|
|
Karsten Hopp |
6e71d1 |
! /* Only use a pattern when it has not been removed, has commands and
|
|
Karsten Hopp |
6e71d1 |
* the group matches. For buffer-local autocommands only check the
|
|
Karsten Hopp |
6e71d1 |
* buffer number. */
|
|
Karsten Hopp |
6e71d1 |
if (ap->pat != NULL && ap->cmds != NULL
|
|
Karsten Hopp |
6e71d1 |
*** ../vim-7.2.020/src/globals.h Sat Jul 26 16:04:49 2008
|
|
Karsten Hopp |
6e71d1 |
--- src/globals.h Mon Sep 15 19:59:28 2008
|
|
Karsten Hopp |
6e71d1 |
***************
|
|
Karsten Hopp |
6e71d1 |
*** 1022,1027 ****
|
|
Karsten Hopp |
6e71d1 |
--- 1022,1028 ----
|
|
Karsten Hopp |
6e71d1 |
#endif
|
|
Karsten Hopp |
6e71d1 |
#ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
6e71d1 |
EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */
|
|
Karsten Hopp |
6e71d1 |
+ EXTERN int autocmd_fname_full; /* autocmd_fname is full path */
|
|
Karsten Hopp |
6e71d1 |
EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */
|
|
Karsten Hopp |
6e71d1 |
EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */
|
|
Karsten Hopp |
6e71d1 |
EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */
|
|
Karsten Hopp |
6e71d1 |
*** ../vim-7.2.020/src/version.c Thu Sep 18 20:55:19 2008
|
|
Karsten Hopp |
6e71d1 |
--- src/version.c Thu Sep 18 21:24:30 2008
|
|
Karsten Hopp |
6e71d1 |
***************
|
|
Karsten Hopp |
6e71d1 |
*** 678,679 ****
|
|
Karsten Hopp |
6e71d1 |
--- 678,681 ----
|
|
Karsten Hopp |
6e71d1 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
6e71d1 |
+ /**/
|
|
Karsten Hopp |
6e71d1 |
+ 21,
|
|
Karsten Hopp |
6e71d1 |
/**/
|
|
Karsten Hopp |
6e71d1 |
|
|
Karsten Hopp |
6e71d1 |
--
|
|
Karsten Hopp |
6e71d1 |
From "know your smileys":
|
|
Karsten Hopp |
6e71d1 |
:----} You lie like Pinocchio
|
|
Karsten Hopp |
6e71d1 |
|
|
Karsten Hopp |
6e71d1 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
6e71d1 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
6e71d1 |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
6e71d1 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|