
Emacs, Google this - sndean
https://github.com/Malabarba/emacs-google-this
======
sjm
Similarly, I use engine-mode ([https://github.com/hrs/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.

~~~
ams6110
_Emacs ' built-in text-based web browser_

Is it time to update Zawinski's Law to "Every program attempts to expand until
it can browse the web."

Not that Emacs isn't already one of the best (if not the number one) examples
of "kitchen sink" programs...

~~~
sjolsen
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.

------
ktamura
Neat idea. I've been using something like this with Acme from plan9port.

Acme's plumber lets the user customize behavior on a piece of text based on
its context or a program that takes it as an argument.

A previous discussion about Acme on HN:
[https://news.ycombinator.com/item?id=4533156](https://news.ycombinator.com/item?id=4533156)

~~~
RBerenguel
Seems ages ago, but I wrote a post about its extensibility here:
[http://www.mostlymaths.net/2013/03/extensibility-
programming...](http://www.mostlymaths.net/2013/03/extensibility-programming-
acme-text-editor.html)

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

~~~
ktamura
oh yea, I remember your blog. As a matter of fact, it was one of few variable
resources to learn about Acme's "API". Thanks for your work =)

~~~
RBerenguel
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

------
agumonkey
Funny, just installed it two days ago after reading
[http://melpa.org/#/selected](http://melpa.org/#/selected) page which hints at
it.

------
sooheon
I use Launchbar
([https://www.obdev.at/products/launchbar/index.html](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.

~~~
ams6110
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?

~~~
dubya
Services are still there. Command-shift-L Googles the selection, though I
don't know how standard this is.

------
toothbrush
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.

~~~
psibi
This functionality is sort of now available in the package xmonad-contrib[0].

[0] [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-
Actions-...](http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-
Search.html)

------
_asummers
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.

[0]
[https://gist.github.com/asummers/8b8dfabf0e25a86ce0c320b39ba...](https://gist.github.com/asummers/8b8dfabf0e25a86ce0c320b39ba5aa29)

~~~
barrkel
For context, Dash appears to be a documentation browser for OS X APIs.

~~~
alxprc
Dash [1] is an OS X app for browsing documentation of many different APIs.

[1]: [https://kapeli.com/dash](https://kapeli.com/dash)

------
merb
Emacs is a great operating system – it lacks a good editor, though.

~~~
supernintendo
I love Emacs as an editor but there's also Evil mode [1] (and I'd disagree if
you told me Vim isn't a good editor).

[1]
[https://www.emacswiki.org/emacs/Evil](https://www.emacswiki.org/emacs/Evil)

------
_ph_
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.

------
raverbashing
Does Google's terms of use allow this?

~~~
Styx-
Two questions. Why wouldn't they, and how could they tell?

~~~
raverbashing
I might have gotten this wrong, but it seems emacs open a browser window with
the given query, then it's ok

I was thinking it would do a curl/wget on the url then show the results on
emacs

~~~
ams6110
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"

~~~
raverbashing
Technically of course, there's no difference, however:
[https://support.google.com/webmasters/answer/66357?hl=en](https://support.google.com/webmasters/answer/66357?hl=en)

------
vcdimension
Emacs already has webjump which does pretty much the same thing but with
arbitrary webpages.

