all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: help-gnu-emacs@gnu.org
Subject: Re: browse select text, text at point
Date: Thu, 07 Jul 2011 09:07:21 +0200	[thread overview]
Message-ID: <4E155B29.7070401@easy-emacs.de> (raw)
In-Reply-To: <4E14BEA4.7000503@dogan.se>

Am 06.07.2011 21:59, schrieb Deniz Dogan:
> On 2011-07-06 19:35, Andreas Röhler wrote:
>> Am 06.07.2011 15:43, schrieb Deniz Dogan:
>>> On 2011-07-06 14:19, smclean0640@gmail.com wrote:
>>>> Hello,
>>>>
>>>> I am wondering whether anyone in the group knows a package that will
>>>> accomplish the following:
>>>> - I am on a word, say "limousine", by pressing a keystroke I can browse
>>>> this word in google (or a chosen search engine) with my default
>>>> browser,
>>>> - I have selected a region of text and I want to search that text in my
>>>> default browser.
>>>>
>>>> Any ideas as to how to most effectively accomplish this? Downloading a
>>>> packaged would be ideal, but I am willing to try my hand at elisp.
>>>>
>>>> Stuart
>>>>
>>>>
>>>
>>> Something like this should google the word at point.
>>>
>>>
>>> (defun google-word-at-point ()
>>> (interactive)
>>> (let ((word (thing-at-point 'word)))
>>> (if word
>>> (funcall browse-url-browser-function
>>> (concat "http://google.com/" word))
>>> (error "No word at point!"))))
>>>
>>> You can either call this using M-x google-word-at-point RET or bind it
>>> to a suitable key:
>>>
>>> (global-set-key (kbd "C-c g") 'google-word-at-point)
>>>
>>> You could extend the function `google-word-at-point' further to check if
>>> `use-region-p' returns non-nil and if so use the region as the "word".
>>>
>>> Hope that helps,
>>> Deniz
>>>
>>>
>>
>> Interesting, but get an 404 error.
>>
>
> That's because the URL is wrong of course. :) I couldn't bother finding
> the right querystring to use. This seems to work though:
>
> (concat "http://www.google.com/search?q="
> (url-hexify-string "Hello there"))
>
>
> Deniz
>
>

thanks, BTW let's mention the code of "whois" in this context.


Andreas



  reply	other threads:[~2011-07-07  7:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-06 12:19 browse select text, text at point smclean0640
2011-07-06 13:43 ` Deniz Dogan
2011-07-06 17:35   ` Andreas Röhler
2011-07-06 19:59     ` Deniz Dogan
2011-07-07  7:07       ` Andreas Röhler [this message]
2011-07-07  7:28         ` Deniz Dogan
2011-07-06 15:26 ` Drew Adams
2011-07-08 12:05   ` Stuart McLean
2011-07-06 19:42 ` Thamer Mahmoud
2011-07-07  8:24   ` Deniz Dogan
2011-07-07  9:24   ` Jonathan Groll

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=4E155B29.7070401@easy-emacs.de \
    --to=andreas.roehler@easy-emacs.de \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.