From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Deniz Dogan Newsgroups: gmane.emacs.help Subject: Re: browse select text, text at point Date: Thu, 07 Jul 2011 09:28:36 +0200 Message-ID: <4E156024.3060605@dogan.se> References: <86mxgrlhys.fsf@S0106001636ac5854.gv.shawcable.net> <4E146686.2010103@dogan.se> <4E149CC4.5070604@easy-emacs.de> <4E14BEA4.7000503@dogan.se> <4E155B29.7070401@easy-emacs.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1310023811 15559 80.91.229.12 (7 Jul 2011 07:30:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 7 Jul 2011 07:30:11 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 07 09:30:04 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qej2C-0000xw-36 for geh-help-gnu-emacs@m.gmane.org; Thu, 07 Jul 2011 09:30:04 +0200 Original-Received: from localhost ([::1]:34258 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qej2B-0000J3-4w for geh-help-gnu-emacs@m.gmane.org; Thu, 07 Jul 2011 03:30:03 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:34116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qej0J-0000IG-Ay for help-gnu-emacs@gnu.org; Thu, 07 Jul 2011 03:28:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qej0H-0006dN-TL for help-gnu-emacs@gnu.org; Thu, 07 Jul 2011 03:28:07 -0400 Original-Received: from mail.sch.se ([81.93.141.11]:37936 helo=SCHSERVER01.sch-got.local) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qej0G-0006cM-Rw for help-gnu-emacs@gnu.org; Thu, 07 Jul 2011 03:28:05 -0400 Original-Received: from [10.0.0.38] ([10.0.0.38]) by SCHSERVER01.sch-got.local with Microsoft SMTPSVC(6.0.3790.4675); Thu, 7 Jul 2011 09:28:36 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 In-Reply-To: <4E155B29.7070401@easy-emacs.de> X-OriginalArrivalTime: 07 Jul 2011 07:28:36.0332 (UTC) FILETIME=[7BD652C0:01CC3C77] X-detected-operating-system: by eggs.gnu.org: Windows 2000 SP4, XP SP1+ X-Received-From: 81.93.141.11 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:81514 Archived-At: On 2011-07-07 09:07, Andreas Röhler wrote: > 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. > What?