Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to make emacs lisp take argv from shell command line?

24 views
Skip to first unread message

Xah Lee

unread,
Jul 21, 2011, 11:03:49 AM7/21/11
to
i'm writing a text processing emacs lisp script. To be run like this:

emacs --script process_log.el filepath

how to make the script take the argument? i.e. that filepath?

e.g. in perl, python, it's typically argv[1] etc.

Thanks.

Xah

Piotr Chamera

unread,
Jul 21, 2011, 11:31:38 AM7/21/11
to
W dniu 2011-07-21 17:03, Xah Lee pisze:

maybe: command-line-args, i can't check it now.

Swami Tota Ram Shankar

unread,
Jul 21, 2011, 4:46:28 PM7/21/11
to
On Jul 21, 8:31 am, Piotr Chamera <piotr_cham...@poczta.onet.pl>
wrote:

> W dniu 2011-07-21 17:03, Xah Lee pisze:
>
> > i'm writing a text processing emacs lisp script. To be run like this:
>
> > emacs --script process_log.el filepath

Can you give a small example of what the script file would look like ?
Is it a lambda or a progn for the main program ?

>
> > how to make the script take the argument? i.e. that filepath?
>
> > e.g. in perl, python, it's typically argv[1] etc.
>
> maybe: command-line-args, i can't check it now.

command-line-args's value is
("emacs" "lisp.el")
Documentation:
Args passed by shell to Emacs, as a list of strings.

Xah Lee

unread,
Jul 22, 2011, 7:14:09 AM7/22/11
to
On Jul 21, 8:31 am, Piotr Chamera <piotr_cham...@poczta.onet.pl>
wrote:

thank you very much.

Xah

Xah Lee

unread,
Jul 22, 2011, 7:17:52 AM7/22/11
to
> > W dniu 2011-07-21 17:03, Xah Lee pisze:
> > > i'm writing a text processing emacs lisp script. To be run like this:
> > > emacs --script process_log.el filepath

On Jul 21, 1:46 pm, Swami Tota Ram Shankar <tota_...@india.com> wrote:
> command-line-args's value is
> ("emacs" "lisp.el")
> Documentation:
> Args passed by shell to Emacs, as a list of strings.

thank you.

> Can you give a small example of what the script file would look like ?
> Is it a lambda or a progn for the main program ?

one recent example is:
〈Emacs Lisp: Batch Script to Validate Matching Brackets〉
http://xahlee.org/emacs/elisp_validate_matching_brackets.html

thanks.

Xah

0 new messages