Reply to message «Re: :e handles one file», sent 18:09:32 23 August 2011, Tuesday by Tim Chase:
> Yeah, I noticed that, since POSIX filenames seem to allow for > that head-scratcher. However since glob() returned things with > newlines separators instead of as a List, there wasn't much to do > about that except shrug and accept it as an "if you choose to do > something stupid like put newlines in your filenames, then this > breaks and it's part of the price you pay for doing that. Do it > manually" It is possible to write Expand() :: String -> [Path]. I already have os.listdir[1] function which cares about possible newlines in filenames* and also about some other glob limitations/inconvenienses[2]. * Though it assumes that there is no smart-ass who is trying to open such file on windows: I don't even want to know whether it is going it work: NTFS allows to create them, but Windows does not. [1]https://bitbucket.org/ZyX_I/frawor/src/release-0.1.13/plugin/frawor/os.vim#cl-161 [2] http://stackoverflow.com/questions/6411496/6426638#6426638 Original message: > On 08/22/2011 10:51 PM, ZyX wrote: > > Reply to message «Re: :e handles one file», > > sent 01:15:56 23 August 2011, Tuesday > > > > by Tim Chase: > >> which should give you an ":E" command that works like ":e" except > >> that if you give it one or more filespecs, it loads them all and > >> leaves you on the last one. E.g. > > > > Try :E %, it does not work. You should use expand(...) instead of > > glob(...) because expand(...) expands % and some other specials and also > > globs. You also definitely forgot fnameescape() and use `len(...)' where > > you can write either `!empty(...)' or just `a:0'. > > All three are nice modifications. I'm partial to the simplicity > of a:0 and just didn't have the time/inclination to investigate > whether that was JUST the number of varargs, or whether it was > the number of args in total, when len() worked when I reached for > it. I think !empty() reads the most cleanly for future maint. > purposes. > > > // Not very important, but you can't :E filename with newlines. > > Yeah, I noticed that, since POSIX filenames seem to allow for > that head-scratcher. However since glob() returned things with > newlines separators instead of as a List, there wasn't much to do > about that except shrug and accept it as an "if you choose to do > something stupid like put newlines in your filenames, then this > breaks and it's part of the price you pay for doing that. Do it > manually" > > -tim
signature.asc
Description: This is a digitally signed message part.
