5/6 Is there a way to pass command-line arguments to emacs, and then detect
them in my elisp code in .emacs? I want to distinguish, in my .emacs,
whether it's started by me typing "emacs" at the command line, or by
some other program using the EDITOR environment variable. So I'm
thinking I can change EDITOR from "emacs" to "emacs -foo" and then
detect it in .emacs. Thanks.
\_ try it the other way; set up an alias or wrapper script that gets
run when you run emacs by hand, that does something like
setenv IRANEMACS yes ; emacs $@ ; unsetenv IRANEMACS.
Then you can just get it out of the environment. -tom
\- The argv is processed by startup.el and eventually will
leave a list in the variable command-line-args, e.g.
M-x lisp-interaction-mode
(eval 'command-line-args)C-j
("emacs" "/tmp/holube")
You can also look at command-switch-alist assuming unlike
holube you dont find alists scary and hard. There are probably
other ways to do what you want [e.g. with gnuclient/gnudoit]
if you want to be specific or just calling emacs -f ...
\_ I don't find them scary and hard; I find them stupid. -tom
\- you find alists "stupid" and you love perl? there you
have it folks. do you also recommend people use environment
variables "instead" of hashes?
variables "instead" of hashes? any other data structures
you find "stupid"? how about say patricia trees?
\_ I wonder why, other than emacs, no other program uses
elisp for configuration. It is not the data structure
I object to, it's the syntax and its use in an
application which should be simple. -tom
\- do you know what guile is? are you making a
serious objection to elisp as opposed to objecting
to lisps in general? lisp has much more expressive
power than say a twmrc configuration language.
"emacs people" are more interested in power than
popularity. they also dont confuse aesthetic/elegant
and simple. the rule is not "thing should be simple"
but things should be as simple as necessary" there
are certainly problems [scoping] with elisp and
limitations as well [say with continuations] but
"alists are bad" is not one anybody reasonable would
take seriously. these comments of yours are getting
increasingly retarded. keep it up. bitching about m4
however is reasonable.
\_ I am not objecting to lisp; I am objecting to
lisp used as a configuration language for a text
editor. I don't like it much as an extension
language, either, but that's more a personal
preference. The fact that you have an extension
language doesn't mean that you have to use it
for everything. It would be much more effective
to separate configuration and extension in
emacs. -tom
\_ Tom, do you know lisp, or are you objecting to
not being able to figure out lisp syntax from
randomly looking at code snippets? I don't
see any specific objections of the type
generally expected when critiquing programming
languages. If you don't know what lambas,
let*, progn etc are, you are not qualified to
let*, progn are, you are not qualified to
\- mapcar >> holube
comment on the language design. Maybe you
should just stick to comments in the form
"I do not like elisp" instead of the arrogant
"Elisp is broken". These kinds of incessant
"Elisp is broken". These of incessant
arrogant pronouncements make you look like an
asshole. But maybe you are an asshole.
\_ I'm not commenting on the language design
at all; I'm commenting on its use in
configuration of a text editor. I also
think it would be stupid to use java or
perl to configure a text editor. -tom
\- it might be more effecting at raising
emacs's mkt share but programmatically
i dont think it would be more effective at all.
it sounds really lame in fact to have an
.emacsrc where you do things like "set fgcolor=
blue" just to make people who dont understand
lisp a little happier. the way scope in handled
in web server configs or procmail configs
or mailagent configs is much lamer than how
it is handled in emacs. [like say if you want
to have one notion of what is a paragraph
when editing lisp vs english text].
\_ well for me, that's exactly why I hate lisp.
(set fgcolor blue) instead of just
fgcolor = blue, and it gets worse with the
nested levels of parentheses and quoted
identifiers and blah blah.
I would much prefer a Ruby-like syntax.
I always found lisp to be unpleasant.
\- setq is more powerful than simple
X=Y type assertions. also there is a
point to having setq, setq-default,
defvar, defmacro, defun, defadvise, let
let* etc. you can happily "configure"
much of emacs only knowing a little
bit about setq. however if the
documentation tells you something is
expected to be a list and you dont use
setq correctly, that's an E_TOOSHORT
problem as far as i am concerned and not
a problem with elisp. once again richer
semantics != gratuitious complexity.
\_ I'm inclined to think it is gratuitous
in the context of text editor config.
I don't want to learn all that stuff
just for emacs. I find it questionable
that all those setters are required;
there's no such complexity in Ruby and
I never felt constrained. Plus the oop
stuff would probably work nicely for
a text editor. But text editor
arguments are stupid so I'll stop.
I'm just saying I don't like lisp. I
don't mind that config files use a
rich language but it means I have to
look in a thick manual to find how
do do anything, since the gui tools
are worthless. |