edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Karl Dahlke <eklhad@comcast.net>
To: Edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev]  wordexp again
Date: Fri, 17 Apr 2015 14:01:13 -0400	[thread overview]
Message-ID: <20150317140113.eklhad@comcast.net> (raw)
In-Reply-To: <20150417125002.GA14517@toaster.adamthompson.me.uk>

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

  parent reply	other threads:[~2015-04-17 18:02 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-16 21:40 Karl Dahlke
2015-04-17  7:12 ` Adam Thompson
2015-04-17 12:50   ` Adam Thompson
2015-04-17 13:33     ` Karl Dahlke
2015-04-17 17:59       ` Adam Thompson
2015-04-17 13:47     ` Karl Dahlke
2015-04-17 18:01     ` Karl Dahlke [this message]
2015-04-17 21:34       ` Adam Thompson
2015-04-17 21:58         ` Adam Thompson
2015-04-17 22:25           ` Karl Dahlke
2015-04-17 22:43             ` Adam Thompson
2015-04-17 23:14               ` Karl Dahlke
2015-04-17 22:28           ` Adam Thompson
2015-04-17 22:39             ` Karl Dahlke
2015-04-18 10:53               ` Adam Thompson
2015-04-18  4:18     ` Karl Dahlke
2015-04-18 10:49       ` Adam Thompson
2015-04-18 11:34         ` Karl Dahlke
2015-04-18 13:09           ` Adam Thompson
2015-04-18 19:33             ` Chris Brannon
2015-04-18 20:05               ` Adam Thompson
2015-04-18 23:03                 ` Chris Brannon
2015-04-18 12:36         ` Karl Dahlke
2015-04-18 12:54           ` Adam Thompson
2015-04-18 13:09             ` Karl Dahlke
2015-04-18 13:24               ` Adam Thompson
2015-04-18 13:45                 ` Karl Dahlke
2015-04-18 17:44                   ` Adam Thompson
2015-04-18 19:48                     ` Karl Dahlke
  -- strict thread matches above, loose matches on Subject: below --
2015-01-09 22:44 Karl Dahlke
2015-01-09 22:19 Karl Dahlke
2015-01-09 22:29 ` Chris Brannon
2015-01-09 21:16 Chris Brannon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150317140113.eklhad@comcast.net \
    --to=eklhad@comcast.net \
    --cc=Edbrowse-dev@lists.the-brannons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).