[Surfraw-devel] searchable_bookmarks
Ivy Foster
joyfulgirl at archlinux.us
Wed Jun 27 20:47:21 UTC 2012
On 23 Apr 2012, at 12:58 am +0300, Thomas Zervogiannis wrote:
> Dear all,
Thomas,
> I would like your feedback on a patch I have created to
> implement bookmarks that support search.
Gladly! Sorry it took me so long to get back to you. The
patch overall was a good idea, I think. I've taken the
liberty, after testing it out today, of applying it along
with a couple of fixes (some options were getting clobbered
somehow originally, and I added some documentation and
credited you in AUTHORS).
> The main change is the addition of the function
> "browse_or_google" which supports the following idea:
> 1) If I give a bookmark with a URL that contains %s, then
> I can also give search terms and %s will be substituted
> with these terms.
This core functionality seems pretty solid.
> Advantage: there are a lot of elvi that are made just
> to support this functionality [...]
> Disadvantage: no autocompletion if it is not an elvi.
Indeed. Due to that disadvantage, I have not audited the
existing elvi to weed out those that would work just as well
as a searchable bookmark. Perhaps with some bash completion
rules that could be worked around.
> 2) If I give a bookmark with a URL that does NOT contain
> %s but I also give search terms, the function uses the
> google elvi and google's site:URL feature to search the
> terms in the domain specified by the bookmark.
I've also changed this somewhat; the user can set
SURFRAW_bookmark_search_elvis to change the search engine.
Any elvis that has a google-compatible site search will
work for now.
> 3) If I give a bookmark with multiple URL's and no search
> term, the function opens the browser to the first URL. If
> search terms are given, the function uses the google elvi
> and google's "site:URL1 OR site:URL2..." syntax to search
> the terms in all URL's of the bookmark.
Seems fine to me.
> Example bookmark:
> zshwiki http://zsh.sourceforge.net/ http://zshwiki.org/
> Advantage: easy and very flexible "bookmark-able" searches that
> can span multiple domains.
> Disadvantage: I used an array for this, which is the only
> bashism to my knowledge that is left in the script.
...and in a complete brainfart, I completely forgot that
that's a bashism. I'll look at it further tonight or
tomorrow and see about fixing that up, since it's my fault
these bashisms ended up in the repository. Sorry 'bout that.
Thanks for your patience, and thanks for the patch!
Ivy
More information about the Surfraw-devel
mailing list