help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help with function


From: weber
Subject: Re: help with function
Date: Fri, 09 Nov 2007 23:51:55 -0000
User-agent: G2/1.0

On Nov 9, 7:05 pm, someusernamehere <someusernameh...@gmail.com>
wrote:
> Hey, I need some help, how I can write a simple lisp code which ask
> for a value, after store in a variable, indeed I want to the value is
> concatenate to an url, I have the following:
>
> which found on google:
>
> (defun search-word ()
>  (interactive)
>  (browse-url
>   (concat "http://foo.bar.foobar/index.php?search=";
>           (thing-at-point 'word))))
>
> but this is only with the word at point, I want ask a word, any help?
>
> thanks

Well, that was an easy one ;)


(defun search-word ()
  (interactive)
  (browse-url
   (concat "http://foo.bar.foobar/index.php?search=";
                   (read-from-minibuffer "Word: "))))

If you really want to store the value into a variable do this:

(defun search-word ()
  "Search for a word in foo bar"
  (interactive)
  (let ((word (read-from-minibuffer "Word: ")))
        (browse-url
         (concat "http://foo.bar.foobar/index.php?search="; word))))

bye
weber



reply via email to

[Prev in Thread] Current Thread [Next in Thread]