To: vim-dev@vim.org Subject: patch 7.0.230 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 7.0.230 Problem: After using ":lcd" a script doesn't know how to restore the current directory. Solution: Add the haslocaldir() function. (Bob Hiestand) Files: runtime/doc/usr_41.txt, runtime/doc/eval.txt, src/eval.c *** ../vim-7.0.229/runtime/doc/usr_41.txt Sun May 7 17:02:39 2006 --- runtime/doc/usr_41.txt Thu Apr 26 17:06:48 2007 *************** *** 1,4 **** ! *usr_41.txt* For Vim version 7.0. Last change: 2006 Apr 30 VIM USER MANUAL - by Bram Moolenaar --- 1,4 ---- ! *usr_41.txt* For Vim version 7.0. Last change: 2007 Apr 26 VIM USER MANUAL - by Bram Moolenaar *************** *** 703,708 **** --- 703,709 ---- isdirectory() check if a directory exists getfsize() get the size of a file getcwd() get the current working directory + haslocaldir() check if current window used |:lcd| tempname() get the name of a temporary file mkdir() create a new directory delete() delete a file *** ../vim-7.0.229/runtime/doc/eval.txt Tue Mar 27 10:20:58 2007 --- runtime/doc/eval.txt Tue Apr 24 21:50:49 2007 *************** *** 1,4 **** ! *eval.txt* For Vim version 7.0. Last change: 2006 Nov 01 VIM REFERENCE MANUAL by Bram Moolenaar --- 1,4 ---- ! *eval.txt* For Vim version 7.0. Last change: 2007 Apr 24 VIM REFERENCE MANUAL by Bram Moolenaar *************** *** 1623,1628 **** --- 1633,1639 ---- globpath( {path}, {expr}) String do glob({expr}) for all dirs in {path} has( {feature}) Number TRUE if feature {feature} supported has_key( {dict}, {key}) Number TRUE if {dict} has entry {key} + haslocaldir() Number TRUE if current window executed |:lcd| hasmapto( {what} [, {mode} [, {abbr}]]) Number TRUE if mapping to {what} exists histadd( {history},{item}) String add an item to a history *************** *** 3016,3021 **** --- 3041,3049 ---- The result is a Number, which is 1 if |Dictionary| {dict} has an entry with key {key}. Zero otherwise. + haslocaldir() *haslocaldir()* + The result is a Number, which is 1 when the current + window has set a local path via |:lcd|, and 0 otherwise. hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()* The result is a Number, which is 1 if there is a mapping that *** ../vim-7.0.229/src/eval.c Thu Apr 26 10:55:46 2007 --- src/eval.c Thu Apr 26 10:52:09 2007 *************** *** 541,546 **** --- 541,547 ---- static void f_globpath __ARGS((typval_T *argvars, typval_T *rettv)); static void f_has __ARGS((typval_T *argvars, typval_T *rettv)); static void f_has_key __ARGS((typval_T *argvars, typval_T *rettv)); + static void f_haslocaldir __ARGS((typval_T *argvars, typval_T *rettv)); static void f_hasmapto __ARGS((typval_T *argvars, typval_T *rettv)); static void f_histadd __ARGS((typval_T *argvars, typval_T *rettv)); static void f_histdel __ARGS((typval_T *argvars, typval_T *rettv)); *************** *** 7110,7115 **** --- 7111,7117 ---- {"globpath", 2, 2, f_globpath}, {"has", 1, 1, f_has}, {"has_key", 2, 2, f_has_key}, + {"haslocaldir", 0, 0, f_haslocaldir}, {"hasmapto", 1, 3, f_hasmapto}, {"highlightID", 1, 1, f_hlID}, /* obsolete */ {"highlight_exists",1, 1, f_hlexists}, /* obsolete */ *************** *** 11131,11136 **** --- 11133,11150 ---- rettv->vval.v_number = dict_find(argvars[0].vval.v_dict, get_tv_string(&argvars[1]), -1) != NULL; + } + + /* + * "haslocaldir()" function + */ + /*ARGSUSED*/ + static void + f_haslocaldir(argvars, rettv) + typval_T *argvars; + typval_T *rettv; + { + rettv->vval.v_number = (curwin->w_localdir != NULL); } /* *** ../vim-7.0.229/src/version.c Thu Apr 26 16:50:05 2007 --- src/version.c Thu Apr 26 17:04:15 2007 *************** *** 668,669 **** --- 668,671 ---- { /* Add new patch number below this line */ + /**/ + 230, /**/ -- hundred-and-one symptoms of being an internet addict: 22. You've already visited all the links at Yahoo and you're halfway through Lycos. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///