Similarly, I use engine-mode (https://github.com/hrs/engine-mode) with Emacs, which allows you to set up basically any search engine. I use Google (on C-c / g) and Github (on C-c / h), but the engine-mode readme explains how to set it up with DuckDuckGo, stack overflow, etc.
It's configurable, but results can be displayed in eww, Emacs' built-in text-based web browser.
Emacs gets a bad rap as a "kitchen sink" program, but it isn't really, any more than something like the Bourne shell or Python. The majority of Emacs' built-ins are things like an elisp interpreter, some text processing stuff, and system libraries. Conversely, most of the really interesting things you can do with Emacs, like web browsing (eww), git repo management (magit), terminal emulation (ansi-term), etc. are really just programs written in elisp. Some of them also happen to be distributed with Emacs.
I explained more or less how to use the plumber and endpoints, and gave a sample shell script and a reddit browser written in python you could plug into acme
Yes, there are very few resources about the "API", at least the original Acme/plumber papers are easy to read... And specially, the code is very straightforward in acme, the plumber or most of Plan9
I use Launchbar (https://www.obdev.at/products/launchbar/index.html) for this. It works system wide, I just select the word or phrase and tap the Option key once. This brings up Launchbar with that text inputted, and then I can send that off to Google, Wikipedia, the system dictionary, YouTube, or anything else. I love it because instead of having different convoluted keybindings for every different type of search (C-c / g, C-c / h, etc.) I only have one, and then dispatch off a fuzzy frecency search that takes <2 letters for the result I want. So tap Alt, Tab, g, Enter searches Google, while Alt, Tab, w, Enter searches Wikipedia, etc. It does tons more with this same paradigm, I use it more than the command line, and can't recommend it enough to people who like to optimize their computer use.
I use LaunchBar and didn't know about this; cool! For those who also didn't know about it: it's the 'Instant Send' feature under 'Shortcuts' in the preferences.
It doesn't seem to work for words selected in the terminal, though, like in vim, or a scrollback buffer in tmux or less (you can click-and-drag to highlight things, but I mean highlighting in the apps themselves, like `viw` in vim to select the word under the cursor). That would be very nice.
Wait -- you need an app for this now? Ever since NEXTStep, Mac OS X has had the "Services" entry on the menu which can do things like this. Is that gone now?
Haha, interesting -- i've had a similar functionality that i hacked into my window manager (XMonad) forever ago. I have an arbitrary keystroke that grabs the highlighted (x clipboard) text, raises a running firefox instance, and plugs it into a StartPage search :). Especially useful when a terminal command barfs an error.
In a similar type of helpfulness (though the Google one could replace this in certain cases) helm-dash is an excellent plugin. You can bring up the helm-dash menu and search your Dash docs for functions by name, or search for the symbol at point. I have mine configured to open the docs in my browser, pointing to the local docs.
If you use OS X, something is broken in browse-url (I think) which causes anchors to not get opened correctly (annoying), so I added this[0] snippet to allow it. Not robust at all, but you get the idea. The "open -a" gives window focus to Chrome, mimicking the built in behavior.
Great! Thanks for this. I had considered writing something like that for ages. Sometimes error messages seem to be created only as a key for a search on Stackoverflow.
I don't understand the practical difference between your two examlpes. What does a browser do, other than essentially "run curl on the URL and then show the results"
It's configurable, but results can be displayed in eww, Emacs' built-in text-based web browser.