unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* OT: emacs-style variables (etc) in the headers?
@ 2004-12-27 16:59 Mike
  2004-12-27 17:40 ` Peter Dyballa
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Mike @ 2004-12-27 16:59 UTC (permalink / raw)


I'm starting on a project where I want to include script
snippets in the headers of files (perl, shell, etc.) actually
inside comments where these snippets will not bother the real
script. Is there an algorithm somewhere to detect the script
is really a script and not a binary file, what the comment
character is, and some standard way to include these variables
and such in files?

Mike

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

* Re: OT: emacs-style variables (etc) in the headers?
  2004-12-27 16:59 OT: emacs-style variables (etc) in the headers? Mike
@ 2004-12-27 17:40 ` Peter Dyballa
       [not found] ` <mailman.9151.1104169993.27204.help-gnu-emacs@gnu.org>
  2005-01-03 19:57 ` Stefan Monnier
  2 siblings, 0 replies; 8+ messages in thread
From: Peter Dyballa @ 2004-12-27 17:40 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 27.12.2004 um 17:59 schrieb Mike:

> Is there an algorithm somewhere to detect the script
> is really a script and not a binary file, what the comment
> character is, and some standard way to include these variables
> and such in files?

Yes: RTFMs.

The UNIX file command can test what kind of file it is. It might be 
useful to extend file's magic file by some extra entries. The standard 
way to include these variables should be GNU Emacs.

(What about a side project that documents what you've discovered?)

--
Greetings

   Pete

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

* Re: OT: emacs-style variables (etc) in the headers?
       [not found] ` <mailman.9151.1104169993.27204.help-gnu-emacs@gnu.org>
@ 2004-12-27 18:17   ` Mike
  0 siblings, 0 replies; 8+ messages in thread
From: Mike @ 2004-12-27 18:17 UTC (permalink / raw)


In article <mailman.9151.1104169993.27204.help-gnu-emacs@gnu.org>, Peter Dyballa wrote:
> 
> Am 27.12.2004 um 17:59 schrieb Mike:
> 
>> Is there an algorithm somewhere to detect the script
>> is really a script and not a binary file, what the comment
>> character is, and some standard way to include these variables
>> and such in files?
> 
> Yes: RTFMs.
> 
> The UNIX file command can test what kind of file it is. It might be 
> useful to extend file's magic file by some extra entries. The standard 
> way to include these variables should be GNU Emacs.
> 
> (What about a side project that documents what you've discovered?)
> 

Below are the comments at the start of the program I'm working on.
I currently have 20+ boxes with 20+ different configurations. The
program I've started is intended to run on each server and maintain
a consistent configuration.

Mike

#!/usr/bin/perl

# $Id$
# $Log$

# maintain a consistent configuration on the local server

# see if cvs is installed
# check that ~/.cvspass and ~/.cvsrc exist
# load the config file
# see if the $cfgdir exists (else mkdir $cvsdir, then cvs co -d $cfgdir unixcfg)
# execute chdir $cfgdir ; cvs update
# log the output of the cvs update
# examine all files in $cfgdir
# if file in $cfgdir/$file is newer than /$file
#   extract any code snippets from the header of $cfgdir/$file
#   execute any pre-snippets
#   install the file
#   execute any post-snippets
#   update the log with the output of the snippets
#   loop

# if asked, use the pod formatting on the files
# determine the difference between documentation, snippets, and the rest of the file
# (should this be a separate script?)

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

* Re: OT: emacs-style variables (etc) in the headers?
  2004-12-27 16:59 OT: emacs-style variables (etc) in the headers? Mike
  2004-12-27 17:40 ` Peter Dyballa
       [not found] ` <mailman.9151.1104169993.27204.help-gnu-emacs@gnu.org>
@ 2005-01-03 19:57 ` Stefan Monnier
  2005-01-03 20:44   ` Mike
  2 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2005-01-03 19:57 UTC (permalink / raw)


> I'm starting on a project where I want to include script
> snippets in the headers of files (perl, shell, etc.) actually
> inside comments where these snippets will not bother the real
> script. Is there an algorithm somewhere to detect the script
> is really a script and not a binary file, what the comment
> character is, and some standard way to include these variables
> and such in files?

I do not fully understand your question.

Could you give a concrete example?
Does interpreter-mode-alist answer the question?


        Stefan "who doesn't read comp.emacs religiously"

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

* Re: OT: emacs-style variables (etc) in the headers?
  2005-01-03 19:57 ` Stefan Monnier
@ 2005-01-03 20:44   ` Mike
  2005-01-03 22:21     ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Mike @ 2005-01-03 20:44 UTC (permalink / raw)


In article <jwv652eb8cv.fsf-monnier+gnu.emacs.help@gnu.org>, Stefan Monnier wrote:
>> I'm starting on a project where I want to include script
>> snippets in the headers of files (perl, shell, etc.) actually
>> inside comments where these snippets will not bother the real
>> script. Is there an algorithm somewhere to detect the script
>> is really a script and not a binary file, what the comment
>> character is, and some standard way to include these variables
>> and such in files?
> 
> I do not fully understand your question.
> 
> Could you give a concrete example?
> Does interpreter-mode-alist answer the question?
> 
> 
>         Stefan "who doesn't read comp.emacs religiously"

I've looked at cfengine and though I like several things it does,
there are a few things I don't like, so I'm writing my own (just
like every other programmer). What I've come up with is something
like rpm spec files where I'm looking for a beginning tag (in this
case the tag is /^%uconfig file configuration/) and an ending tag
(/^%done/). Between these tags can fall five other tags: %pre,
%post, %inst, %doc, %always. The %pre is done before anything else,
the %post is done after the file is copied, the %always is always
done, the %doc is for documentation, and the %inst is a custom way
to copy the file (like /etc/syslog.conf) instead of using the default
(which copies /etc/syslog.conf :). I have a few other bits of
syntactic sugar in different places to make it all work.

I'm nearing the end of testing and will soon roll it to my server
farm.

What do you think?

 /------------------------
 |# $Id
 |# $Log
 |
 |!loghost:*.info      @loghost
 |loghost:*.info       /var/log/syslog.log
 |
 |%uconfig file configuration
 |%post
 |ps -ef | grep syslogd | grep -v grep | awk '{print $2}' | xargs kill -1
 |%done
 |
 \------------------------

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

* Re: OT: emacs-style variables (etc) in the headers?
  2005-01-03 20:44   ` Mike
@ 2005-01-03 22:21     ` Stefan Monnier
  2005-01-03 23:00       ` Mike
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2005-01-03 22:21 UTC (permalink / raw)


> I've looked at cfengine and though I like several things it does,
> there are a few things I don't like, so I'm writing my own (just
> like every other programmer). What I've come up with is something
> like rpm spec files where I'm looking for a beginning tag (in this
> case the tag is /^%uconfig file configuration/) and an ending tag
> (/^%done/). Between these tags can fall five other tags: %pre,
> %post, %inst, %doc, %always. The %pre is done before anything else,
> the %post is done after the file is copied, the %always is always
> done, the %doc is for documentation, and the %inst is a custom way
> to copy the file (like /etc/syslog.conf) instead of using the default
> (which copies /etc/syslog.conf :). I have a few other bits of
> syntactic sugar in different places to make it all work.

> I'm nearing the end of testing and will soon roll it to my server
> farm.

> What do you think?

What is the question?


        Stefan "still not reading comp.emacs religiously"

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

* Re: OT: emacs-style variables (etc) in the headers?
  2005-01-03 22:21     ` Stefan Monnier
@ 2005-01-03 23:00       ` Mike
  2005-01-03 23:03         ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Mike @ 2005-01-03 23:00 UTC (permalink / raw)


In article <jwvu0py88hl.fsf-monnier+gnu.emacs.help@gnu.org>, Stefan Monnier wrote:
>> I've looked at cfengine and though I like several things it does,
>> there are a few things I don't like, so I'm writing my own (just
>> like every other programmer). What I've come up with is something
>> like rpm spec files where I'm looking for a beginning tag (in this
>> case the tag is /^%uconfig file configuration/) and an ending tag
>> (/^%done/). Between these tags can fall five other tags: %pre,
>> %post, %inst, %doc, %always. The %pre is done before anything else,
>> the %post is done after the file is copied, the %always is always
>> done, the %doc is for documentation, and the %inst is a custom way
>> to copy the file (like /etc/syslog.conf) instead of using the default
>> (which copies /etc/syslog.conf :). I have a few other bits of
>> syntactic sugar in different places to make it all work.
> 
>> I'm nearing the end of testing and will soon roll it to my server
>> farm.
> 
>> What do you think?
> 
> What is the question?
> 
> 
>         Stefan "still not reading comp.emacs religiously"

The question was in the original post that you trimmed.

Mike

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

* Re: OT: emacs-style variables (etc) in the headers?
  2005-01-03 23:00       ` Mike
@ 2005-01-03 23:03         ` Stefan Monnier
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2005-01-03 23:03 UTC (permalink / raw)


> The question was in the original post that you trimmed.

Tough luck,


        Stefan

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

end of thread, other threads:[~2005-01-03 23:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-27 16:59 OT: emacs-style variables (etc) in the headers? Mike
2004-12-27 17:40 ` Peter Dyballa
     [not found] ` <mailman.9151.1104169993.27204.help-gnu-emacs@gnu.org>
2004-12-27 18:17   ` Mike
2005-01-03 19:57 ` Stefan Monnier
2005-01-03 20:44   ` Mike
2005-01-03 22:21     ` Stefan Monnier
2005-01-03 23:00       ` Mike
2005-01-03 23:03         ` Stefan Monnier

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).