On Fri, Nov 18, 2011 at 11:40 PM, Benjamin Fritz <[email protected]> wrote: > Fixed item from todo list: > >> Win32: When 'shell' is cmd.exe this command fails: >> echo system('"c:/path/echo.exe" "foo bar"') >> Should we set the default for 'shellxquote' to a double quote, when 'shell' >> contains "cmd" in the tail? (Benjamin Fritz, 2008 Oct 13) >> Also set 'shellcmdflag' to include /s. > > While making my changes, I noticed the following strange behavior. > > If a user's .vimrc sets the value of 'shellxquote' or 'shellcmdflag', > then the default value is not updated by the code I touched, because > of the checks for the P_WAS_SET flag. > > But this means, if the user has this in their .vimrc on Windows: > > set shell=sh > set shellxquote=\" > set shellcmdflag=-c > > Then a later command of :set shell& shellxquote& shellcmdflag& will > set the values to "cmd.exe", "", and "/c" respectively. But if in > their .vimrc they only have: > > set shell=sh > > then Vim automatically sets shellxquote and shellcmdflag to "\"" and > "-c", respectively. > > However, if the user later does :set shell& shellxquote& > shellcmdflag&, they get "cmd.exe", "\"", and "-c". > > More to the point for this patch, if the user has in their .vimrc on > Windows, because they were enlightened back in 2008, 'set > shellxquote=\" shellcmdflag=/s /c', then after this patch this is > unnecessary, but if they try to set these values to their defaults, > they will get the *old* defaults. > > What is the reason for only updating the default value of options, if > P_WAS_SET is false? I get that we don't want to override the actual > value of the option if the user set it to something, but don't we want > to update the default value? E.g. shouldn't we do something like this, > throughout option.c? > > int idx3; > > idx3 = findoption((char_u *)"shcf"); > - if (idx3 >= 0 && !(options[idx3].flags & P_WAS_SET)) > - { > - p_shcf = (char_u *)"-c"; > - options[idx3].def_val[VI_DEFAULT] = p_shcf; > + if (idx3 >= 0) > + { > + options[idx3].def_val[VI_DEFAULT] = (char_u *)"-c"; > + if (!(options[idx3].flags & P_WAS_SET)) > + { > + p_shcf = options[idx3].def_val[VI_DEFAULT]; > + } > } > > -- > Ben >
Oops, I forgot. Discussion of the fixed issue, for those with memories shorter than 3 years: http://groups.google.com/group/vim_dev/browse_thread/thread/3d1cc6cb0c0d27b3/756e7b2dafeb34f8 -- 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
