On Fri, Apr 17, 2015 at 02:01:13PM -0400, Karl Dahlke wrote: > I pulled the latest, withthe quick check removed, > and I don't like it, or I'm just not use to it. > This is a change in the user interface, > and if we all agree it should be made, then I also need to change the documentation. > I designed it so that it would not be hard or complicated > or confusing to edit files, like a'b or a(b or a|b or a[b, > and now these all produce errors, where they didn't before. > Errors because they all run through wordexp, and they didn't before. > > e a(b > unexpected error while evaluating the shell pattern > > What is the user suppose to do with that?? > > edbrowse use to run filenames through wordexp when > it is "reasonable" to do so, as per my check, and as per the following section > from my documentation. > > ------------------------------------------------------------ > > Whenever a file is read from or written to disk, $var, in the filename, > is replaced with the corresponding environment variable. > Thus you can edit your address book at any time via `e $adbook', > provided $adbook has been set in your environment. > Also, a leading ~/ is replaced with $HOME/, > making it easy to edit files in your home directory such as ~/.profile. > > Shell meta characters are also expanded, provided the result is one file name. > You can read or write a file by typing a minimal portion of its name. > e work/foo* to get work/foobar. > > Expansion is performed by wordexp(3), simulating a posix shell. > Unfortunately this has certain side effects. > Meta characters such as | & ' < ; etc will derail the expansion, > unless escaped by a backslash. This is confusing at first, > so think of it this way: "If I want to expand a file name using variables or > wild cards, i.e. a string containing $ [] * ? > or a leading ~/, I have to type it in as though I were typing at the shell." > An example might be $phones/at\&t. Even spaces must be escaped with backslash > or put in quotes. This complexity only occurs > if you are accessing environment variables or globbing. > > ------------------------------------------------------------ > > So the quick check was there for a reason, > and I don't think it was particularly buggy. > I don't want us to undo each other's work, that isn't productive, > so we should decide if we want this feature, yes or no, > and if we do put it back in, > and if we don't then I need to change the documentation. > I like the feature, because I don't want to have to escape things with backslashes all the time, > except on that rare occasion that I am invoking wordexp and need to escape things for wordexp. > Another option is to forget wordexp and go back to the code > that I wrote 5 years ago, my own variable expansion and globbing, > which worked, and didn't have any of this '"()|; confusion around it. > It did what you want and didn't have any side effects. > Maybe I should have left well enough alone. > But we are where we are, and from here I guess I'd like to put my quick check > back in, perhaps modified if you think it has some bugs. > > By the way, removing quick check had nothing to do with the bug > that I posted at the top of this thread. > You stil can't edit a directory with backslash in the name, > and I think that is a bug in wordexp that we can't get around. > That's maybe another reason to go back to my home grown code. > > Karl Dahlke > _______________________________________________ > Edbrowse-dev mailing list > Edbrowse-dev@lists.the-brannons.com It fixed my test case when I tested it, which appears to be *another* bug which looked similar to this one. With it as it stands now, typing: e a\\b When you've got a directory named 'a\b' in the current directory allows you to edit the correct thing (i.e. typing 'f' yields 'a\b') but the files aren't visible in this case. This isn't an escaping bug in wordexp as otherwise the double '\' would still be there. I suspect we're double expanding or something somewhere, I need to check. As for the quick check, there are corner cases it misses, like the ~username syntax which is surprisingly useful once you get used to it. I think the better way round this would be to reverse the leading ` since readline completion doesn't do wordexp-safe file names at the moment (and making it do that is difficult). This would work for me as a user since it'd mean "treat this filename specially". That'd get rid of all the random confusion and need to escape things, apart from in the very rare cases that you genuinely want an ` at the start of your file name. Cheers, Adam.