all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Terrence Brannon <metaperl@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: access command line (arguments) from emacs --script
Date: Mon, 26 Jul 2010 06:39:54 -0700 (PDT)	[thread overview]
Message-ID: <b6486c70-509e-4912-b16b-b89038d3c35d@j8g2000yqd.googlegroups.com> (raw)

Hello, I am interested in accessing the arguments passed to an emacs
script.

I am interested in either:
(a) accessing what would be $1 to a shell program, in other words

./emacs-script.el 'here is dollar one... how does emacs get it'

(b) accessing an argument specified as an argument either in long or
short format:

./emacs-script.el --argument 'here is the argument .. how to get with
emacs'

I have written my entire program below. I just need to know how to get
command line arguments.

#!/bin/env emacs --script

(open-file "edan.el")
(search-forward "(provide 'edan)")
(move-beginning-of-line)
(open-line 2)

;;; option a
;;; prepend-edan.el `script-to-generate-text`
(insert $ARGV[0])

;;; option b
;;; prepend-edan.el --text `script-to-generate-text`
(insert $ARG['text'])

By the way, I found the manual (
http://www.gnu.org/software/emacs/elisp/html_node/Command_002dLine-Arguments.html
) to be confusing. Why is the handler function for the command-switch-
alist only passed the name of the option? How does it get the value of
the option?

Why is command-line args a list? How are you supposed to access the
arguments by name if this is just a list of the arguments.



             reply	other threads:[~2010-07-26 13:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-26 13:39 Terrence Brannon [this message]
2010-07-26 20:11 ` access command line (arguments) from emacs --script David Kastrup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b6486c70-509e-4912-b16b-b89038d3c35d@j8g2000yqd.googlegroups.com \
    --to=metaperl@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.