unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Emacs Schell Scripting
@ 2009-03-25 13:26 Volkan YAZICI
  2009-03-26  0:02 ` Xah Lee
  2009-03-26 19:21 ` Johan Bockgård
  0 siblings, 2 replies; 6+ messages in thread
From: Volkan YAZICI @ 2009-03-25 13:26 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I have written a small wrapper shell script over htmlize.el to output
syntax highlighted forms of buffers into HTML files. (Why bothering
with syntax highligting libraries while there is emacs already?) But
I'm having some troubles with command line arguments in emacs shell
scripts. Consider below output:

  $ cat example.el
  #!/usr/local/bin/emacs --script
  (message "ARGV: %s\n" command-line-args)

  $ ./example.el foo bar baz
  ARGV: (/usr/local/bin/emacs -scriptload ./example.el foo bar baz)

In the initialization of my program, I create a custom args variable:

  (defvar args (cons (first command-line-args) (subseq command-line-
args 3)))

But isn't there a more portable and concise way of doing this? (OTOH,
I don't know if "-scriptload ./example.el" part differs between
different emacs versions.)


Regards.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs Schell Scripting
  2009-03-25 13:26 Emacs Schell Scripting Volkan YAZICI
@ 2009-03-26  0:02 ` Xah Lee
  2009-03-26  6:19   ` Xah Lee
  2009-03-26 19:21 ` Johan Bockgård
  1 sibling, 1 reply; 6+ messages in thread
From: Xah Lee @ 2009-03-26  0:02 UTC (permalink / raw)
  To: help-gnu-emacs

On Mar 25, 6:26 am, Volkan YAZICI <volkan.yaz...@gmail.com> wrote:
> Hi,
>
> I have written a small wrapper shell script over htmlize.el to output
> syntax highlighted forms of buffers into HTML files. (Why bothering
> with syntax highligting libraries while there is emacs already?) But
> I'm having some troubles with command line arguments in emacs shell
> scripts. Consider below output:
>
>   $ cat example.el
>   #!/usr/local/bin/emacs --script
>   (message "ARGV: %s\n" command-line-args)
>
>   $ ./example.el foo bar baz
>   ARGV: (/usr/local/bin/emacs -scriptload ./example.el foo bar baz)
>
> In the initialization of my program, I create a custom args variable:
>
>   (defvar args (cons (first command-line-args) (subseq command-line-
> args 3)))
>
> But isn't there a more portable and concise way of doing this? (OTOH,
> I don't know if "-scriptload ./example.el" part differs between
> different emacs versions.)

dont' have answer to your question specifically...  but, there are at
least 2 robust packages that do what you want already.

I use htmlize.el by Hrvoje Niksic.
at http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el

For a tutorial, pls see:

• Elisp: Syntax Coloring Source Code In HTML
  http://xahlee.org/emacs/elisp_htmlize.html

Also, at the bottom of the above page, you'll see that google has
released a js code that syntax color source code as presented in html
with the pre tag, without needing span markup, and does it in real
time. It is fast, small, and works for many langs.

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs Schell Scripting
  2009-03-26  0:02 ` Xah Lee
@ 2009-03-26  6:19   ` Xah Lee
  2009-03-27  8:35     ` TomSW
  0 siblings, 1 reply; 6+ messages in thread
From: Xah Lee @ 2009-03-26  6:19 UTC (permalink / raw)
  To: help-gnu-emacs

On Mar 25, 5:02 pm, Xah Lee <xah...@gmail.com> wrote:
> On Mar 25, 6:26 am, Volkan YAZICI <volkan.yaz...@gmail.com> wrote:

> > I have written a small wrapper shell script over htmlize.el to output
> > syntax highlighted forms of buffers into HTML files. (Why bothering
> > with syntax highligting libraries while there is emacs already?) But
> > I'm having some troubles with command line arguments in emacs shell
> > scripts. Consider below output:
>
> >   $ cat example.el
> >   #!/usr/local/bin/emacs --script
> >   (message "ARGV: %s\n" command-line-args)
>
> >   $ ./example.el foo bar baz
> >   ARGV: (/usr/local/bin/emacs -scriptload ./example.el foo bar baz)
>
> > In the initialization of my program, I create a custom args variable:
>
> >   (defvar args (cons (first command-line-args) (subseq command-line-
> > args 3)))
>
> > But isn't there a more portable and concise way of doing this? (OTOH,
> > I don't know if "-scriptload ./example.el" part differs between
> > different emacs versions.)

sorry, didn't read your previous message carefully.

i read your message again, but after 1 min, i don't quite understand
what you wanted.

Get to the point!

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs Schell Scripting
  2009-03-25 13:26 Emacs Schell Scripting Volkan YAZICI
  2009-03-26  0:02 ` Xah Lee
@ 2009-03-26 19:21 ` Johan Bockgård
  2009-03-27 20:05   ` Volkan YAZICI
  1 sibling, 1 reply; 6+ messages in thread
From: Johan Bockgård @ 2009-03-26 19:21 UTC (permalink / raw)
  To: help-gnu-emacs

Volkan YAZICI <volkan.yazici@gmail.com> writes:

>   (defvar args (cons (first command-line-args) (subseq command-line-
> args 3)))
>
> But isn't there a more portable and concise way of doing this?

command-line-args-left


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs Schell Scripting
  2009-03-26  6:19   ` Xah Lee
@ 2009-03-27  8:35     ` TomSW
  0 siblings, 0 replies; 6+ messages in thread
From: TomSW @ 2009-03-27  8:35 UTC (permalink / raw)
  To: help-gnu-emacs

> Get to the point!

He means, is there an existing way to access any command-line
arguments that haven't been processed by Emacs.
How about the variable "command-line-args-left"?

~$ cat example2.el
#!/usr/bin/emacs  --script

(message "ARGS: %s\n" command-line-args-left)

~$ ./example2.el foo bar baz
...
ARGS: (foo bar baz)


cheers,
Tom SW


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs Schell Scripting
  2009-03-26 19:21 ` Johan Bockgård
@ 2009-03-27 20:05   ` Volkan YAZICI
  0 siblings, 0 replies; 6+ messages in thread
From: Volkan YAZICI @ 2009-03-27 20:05 UTC (permalink / raw)
  To: help-gnu-emacs

On Mar 26, 9:21 pm, bojohan+n...@dd.chalmers.se (Johan Bockgård)
wrote:
> command-line-args-left

Oops! I must have gone blind. Thanks for the tip. (Also, thanks to
TomSW.)


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-03-27 20:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-25 13:26 Emacs Schell Scripting Volkan YAZICI
2009-03-26  0:02 ` Xah Lee
2009-03-26  6:19   ` Xah Lee
2009-03-27  8:35     ` TomSW
2009-03-26 19:21 ` Johan Bockgård
2009-03-27 20:05   ` Volkan YAZICI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).