[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4. Integration with `el' command

Oneliner has a perl script the name of `el'. You can more integrate shell with Emacs with `el' command.

4.1 What is `el' command ?  
4.2 Manual of `el' command  
4.3 Let's try `el' command  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.1 What is `el' command ?

You can make a tuned shell-command for Oneliner with `el' command. The `el' command can send S-exp to Emacs, and it can make Emacs to evaluate it, too. In other words, You can execute Emacs's function from shell-commands. And you can make Emacs to work in closer cooperation with your favorite shell-commands.

For example, You can perform a technique as follows: (If you input the follows, Emacs opens a file "a.c" automatically.)

 
$ find-file a.c

How do we implement to do it ? Let's define an alias with `el' as follows:

 
alias find-file="el -x -f '(display-buffer (find-file-noselect \"%s\"))'"


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2 Manual of `el' command

Here is explanation for `el' command. We assume that a default pipe-buffer has data as follows on all examples:

 
1 2
3 4

The primary actions are building S-exp from command line arguments and stdin. And then, display it.

 
$ el 1 2 3 4
(1 "2" "3" "4")
$ echo 1 2 3 4 | el
(1 "2" "3" "4")
$ echo 1 2 | el 3 4
(3 "4")
$ | el
(1 "2")
(3 "4")

`el' command has many command line switches. Here is explanation of switches.

`-c (--command cmd)'
`cmd' means a function of Elisp. Command line arguments and data from stdin means arguments of `cmd'. If you specify the only -c switch, `el' output one S-exp by one line of stdin.

 
$ | el -c elisp-func
(elisp-func "1" "2")
(elisp-func "3" "4")

`-a (--args n)'
Specifies the maximum number of arguments of a Elisp function with `-c' switch.

 
$ | el -a 1 -c elisp-func
(elisp-func "1")
(elisp-func "2")
(elisp-func "3")
(elisp-func "4")

`-f (--format fmt)'
Allows you to use format string of printf for making a S-exp.

 
$ | el -f '(elisp-func "%s")'
(elisp-func "1")
(elisp-func "2")
(elisp-func "3")
(elisp-func "4")
$ | el -f '(elisp-func "%s" "%s")'
(elisp-func "1" "2")
(elisp-func "3" "4")

`-x (--execute)'
Requests to Oneliner to evaluate the S-exp to use `*Oneliner auto-eval*' buffer.

`-i (--inpipe buf)'
Gets input from pipe-buffer. You can specify a number of pipe-buffer, too.

`-o (--outpipe buf)'
Puts output to pipe-buffer. You can specify a number of pipe-buffer, too.

`-s (--serial)'
Makes `el' to serialize multiple lines to one line.

 
$ | el -s -c elisp-func
(elisp-func "1" "2" "3" "4")
$ | el -s -a 3 -c elisp-func
(elisp-func "1" "2" "3")
(elisp-func "4")

`-h (--help)'
Display help message.

`-V (--version)'
Display version identifiers.

`-d (--debug)'
Enable debugging state.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3 Let's try `el' command


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.0.1 Useful aliases

alias find-file="el -x -f '(display-buffer (find-file-noselect \"%s\"))'"
Make Emacs to open files as follows:

 
 find-file file.c 
 find ./ -name \*.c | find-file 

find-dired="el -x -f '(find-dired \"%s\" \"-name %s\")'"
Start a Emacs's function `find-dired' with parameters which you specify.

 
 find-dired ./ \*.c 

alias dired='el -x -a 1 -c dired'
Start `dired' with directory path which you specify.

 
 dired /etc 

alias ediff-files='el -x -s -a 2 -c ediff-files'
Start `ediff-files' with two file names which you specify.

 
 ediff-files a.c b.c 

alias w3m-find-file='el -x -a 1 -c w3m-find-file'
Start w3m-find-file with a html file with you specify.

 
 w3m-find-file index.html 

alias cvs-update="el -x -f '(cvs-update \"%s\" nil)'"
Start cvs-update function of pcl-cvs package with directory path which you specify.

 
 cvs-update . 

alias google="echo nil | el -x -f '(w3m \"http://www.google.co.jp/\" %s)'"
Open the top page of google with emacs-w3m.

 
 google 


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Kiyoka Nishiyama on December, 7 2003 using texi2html