emacs-devel
[Top][All Lists]
Advanced

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

A not quite stylish proposal for command line processing


From: David Kastrup
Subject: A not quite stylish proposal for command line processing
Date: Sun, 29 Jul 2007 15:07:47 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

How about
(defun *argv++ nil (pop command-line-args-left))
?

It would allow to write

emacs --eval '(ediff-files (*argv++) (*argv++))' "$FILE1" "$FILE2"

instead of the much more tedious explicit variant.  Note that

emacs --eval "(ediff-files \"$FILE1\" \"$FILE2\")"

is _not_ equivalent since it requires $FILE1 to be properly quoted for
appearing inside of a Lisp string.

Somewhat more Lispish would be
(defvaralias 'argv 'command-line-args-left)
which would at least permit
emacs --eval '(ediff-files (pop argv) (pop argv))' "$FILE1" "$FILE2"

And it is more likely to be found by programmers using "apropos".  And
is actually only one character longer than the *argv++ cuteness.

Comments?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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