X11 selection search (emacs)

Dec 13, 2004 17:25

Lets assume you just work in a console or in a some other X11 application. You just select something with a mouse and now you wish to search this in emacs. Of course it is very easy - Control/S, Enter, Paste, Enter. But is it nice and convenient? I don't think so.

If you insert the following code fragment in your .emacs file, you can select ( Read more... )

Leave a comment

Comments 3

what of eshell? smitty1e December 15 2004, 02:23:11 UTC
actually, the thing I'd like an eshell example of is binding an executable's standard input, output, and error to emacs buffers, which I think would be teh b3st, but probably requires more comint knowledge than I currently have.

Reply

Re: what of eshell? vfork December 15 2004, 11:58:56 UTC
IMHO the function you need is shell-command-on-region

Reply

Re: what of eshell? vfork December 17 2004, 10:42:52 UTC
I guess you actually need the following code (I bind the functionality to F1)

(global-set-key [f1] '(lambda(beg end)
(interactive "r")
(setq cmd (read-from-minibuffer "Shell command: "))
(shell-command-on-region beg end cmd nil t)
))

Now when you select region in emacs and press F1, you are prompted for a shell command. Then the command is executed with the selected region as stdin and stdout/stderr of the command replaces the selection.

Reply


Leave a comment

Up