[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: selected word as parameter to function
From: |
Xah |
Subject: |
Re: selected word as parameter to function |
Date: |
Mon, 3 Nov 2008 20:15:46 -0800 (PST) |
User-agent: |
G2/1.0 |
On Nov 3, 11:11 am, Rodrigo Canellas <rodrigo.canel...@tqtvd.com>
wrote:
> Hi,
>
> I would like to create a function that would execute:
>
> grep -nH -R --include="*.cpp" --include="*.h" --include ="*.c" -e
> "'selected-word'" .
>
> Where 'selected-word' would be the word where the cursor is at (or below?).
easy.
your task is few parts:
• how to get the current word as a string.
• how to call a shell command.
this gets you the current sting
(setq myWord (thing-at-point 'symbol))
this calls shell:
(shell-command cmd-str)
assuming you know the basic of elisp, how to define a function, join
strings, set variables, etc.
for more detail, you can see:
http://xahlee.org/emacs/elisp_run_current_file.html
Xah
∑ http://xahlee.org/
☄
- Re: selected word as parameter to function,
Xah <=