POV-Ray : Newsgroups : povray.off-topic : Use case Server Time
29 Jul 2024 16:23:14 EDT (-0400)
  Use case (Message 1 to 10 of 14)  
Goto Latest 10 Messages Next 4 Messages >>>
From: Orchid XP v8
Subject: Use case
Date: 24 Aug 2011 13:31:53
Message: <4e553589$1@news.povray.org>
Now that the debate has died down slightly, here's an idea...

Suppose I have a bunch of files. I edit one of them, and then I want to 
edit all of the others in the same way. Is there an easy way to make 
Emacs do that? Because, if there is, that would be Actually Useful for 
something.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Warp
Subject: Re: Use case
Date: 25 Aug 2011 11:36:46
Message: <4e566c0e@news.povray.org>
Orchid XP v8 <voi### [at] devnull> wrote:
> Suppose I have a bunch of files. I edit one of them, and then I want to 
> edit all of the others in the same way. Is there an easy way to make 
> Emacs do that? Because, if there is, that would be Actually Useful for 
> something.

  Your question can be reduced to "can elisp be used to do that?"
Since elisp is a programming language with basically all the same
expressiveness as lisp, the answer should be obvious.

  The more relevant question would be, however, whether that's the
*easiest* way of doing that. Probably not, unless you are an elisp guru.

-- 
                                                          - Warp


Post a reply to this message

From: Invisible
Subject: Re: Use case
Date: 25 Aug 2011 11:49:49
Message: <4e566f1d@news.povray.org>
On 25/08/2011 04:36 PM, Warp wrote:
> Orchid XP v8<voi### [at] devnull>  wrote:
>> Suppose I have a bunch of files. I edit one of them, and then I want to
>> edit all of the others in the same way. Is there an easy way to make
>> Emacs do that? Because, if there is, that would be Actually Useful for
>> something.
>
>    Your question can be reduced to "can elisp be used to do that?"
> Since elisp is a programming language with basically all the same
> expressiveness as lisp, the answer should be obvious.
>
>    The more relevant question would be, however, whether that's the
> *easiest* way of doing that. Probably not, unless you are an elisp guru.

The question was more "is there already a button that does that?" I 
could implement such a feature in any language. The question was whether 
one is already present.


Post a reply to this message

From: Warp
Subject: Re: Use case
Date: 25 Aug 2011 12:14:15
Message: <4e5674d7@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> The question was more "is there already a button that does that?" I 
> could implement such a feature in any language. The question was whether 
> one is already present.

  "I want to edit all of the others in the same way" is quite a vague
description. I don't even know what exactly you mean by that.

  There's probably no "button" to do that (although it wouldn't surprise
me if there was). It doesn't sound like an extremely common task.

-- 
                                                          - Warp


Post a reply to this message

From: Orchid XP v8
Subject: Re: Use case
Date: 25 Aug 2011 14:22:47
Message: <4e5692f7$1@news.povray.org>
On 25/08/2011 05:14 PM, Warp wrote:
> Invisible<voi### [at] devnull>  wrote:
>> The question was more "is there already a button that does that?" I
>> could implement such a feature in any language. The question was whether
>> one is already present.
>
>    "I want to edit all of the others in the same way" is quite a vague
> description. I don't even know what exactly you mean by that.
>
>    There's probably no "button" to do that (although it wouldn't surprise
> me if there was). It doesn't sound like an extremely common task.

As best as I can tell, it's a line-based file format, where each line 
contains a key/value pair. Basically if I use the tool and it changes 
the line that says "mode=7" to read "mode=9", then I want to make that 
change to all the files in the set. Similarly if it adds a new line or 
removes an existing one.

I imagine you can probably do it somehow using diff and patch. But those 
aren't usually present on Windows. (I gather Emacs has a special mode 
for viewing the output from diff or something like that... Presumably 
that only works on Unix though.)

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Warp
Subject: Re: Use case
Date: 25 Aug 2011 15:27:27
Message: <4e56a21f@news.povray.org>
Orchid XP v8 <voi### [at] devnull> wrote:
> As best as I can tell, it's a line-based file format, where each line 
> contains a key/value pair. Basically if I use the tool and it changes 
> the line that says "mode=7" to read "mode=9", then I want to make that 
> change to all the files in the set. Similarly if it adds a new line or 
> removes an existing one.

  Usually you'd do a search&replace on multiple files to do that. I don't
know offhand if emacs has readymade support for search&replace on multiple
files, but it sounds like something that could be done with just a bit of
elisp. (Normally you would do this on the command line using 'sed' or other
similar tools, unless the changes are very complex, in which case it becomes
more difficult.)

-- 
                                                          - Warp


Post a reply to this message

From: nemesis
Subject: Re: Use case
Date: 25 Aug 2011 18:28:00
Message: <4e56cc70$1@news.povray.org>
Orchid XP v8 escreveu:
> On 25/08/2011 05:14 PM, Warp wrote:
>> Invisible<voi### [at] devnull>  wrote:
>>> The question was more "is there already a button that does that?" I
>>> could implement such a feature in any language. The question was whether
>>> one is already present.
>>
>>    "I want to edit all of the others in the same way" is quite a vague
>> description. I don't even know what exactly you mean by that.
>>
>>    There's probably no "button" to do that (although it wouldn't surprise
>> me if there was). It doesn't sound like an extremely common task.
> 
> As best as I can tell, it's a line-based file format, where each line 
> contains a key/value pair. Basically if I use the tool and it changes 
> the line that says "mode=7" to read "mode=9", then I want to make that 
> change to all the files in the set. Similarly if it adds a new line or 
> removes an existing one.
> 
> I imagine you can probably do it somehow using diff and patch. But those 
> aren't usually present on Windows. (I gather Emacs has a special mode 
> for viewing the output from diff or something like that... Presumably 
> that only works on Unix though.)

Install perl.  I don't remember perl at all, but it's probably a simple 
one-liner.  A few switches on the command line and a simple regex 
substitution should do the trick.  The right tool for the job, plain and 
simple.  And yes, it's available for windows in a standard windows 
install package.

-- 
a game sig: http://tinyurl.com/d3rxz9


Post a reply to this message

From: Invisible
Subject: Re: Use case
Date: 26 Aug 2011 03:55:10
Message: <4e57515e$1@news.povray.org>
>> As best as I can tell, it's a line-based file format, where each line
>> contains a key/value pair. Basically if I use the tool and it changes
>> the line that says "mode=7" to read "mode=9", then I want to make that
>> change to all the files in the set. Similarly if it adds a new line or
>> removes an existing one.
>>
>> I imagine you can probably do it somehow using diff and patch. But
>> those aren't usually present on Windows. (I gather Emacs has a special
>> mode for viewing the output from diff or something like that...
>> Presumably that only works on Unix though.)
>
> Install perl. I don't remember perl at all, but it's probably a simple
> one-liner. A few switches on the command line and a simple regex
> substitution should do the trick. The right tool for the job, plain and
> simple. And yes, it's available for windows in a standard windows
> install package.

The right tool for the job would obviously be some sort of file 
comparison tool - which Perl isn't.


Post a reply to this message

From: Francois Labreque
Subject: Re: Use case
Date: 26 Aug 2011 09:48:41
Message: <4e57a439$1@news.povray.org>

>>> As best as I can tell, it's a line-based file format, where each line
>>> contains a key/value pair. Basically if I use the tool and it changes
>>> the line that says "mode=7" to read "mode=9", then I want to make that
>>> change to all the files in the set. Similarly if it adds a new line or
>>> removes an existing one.
>>>
>>> I imagine you can probably do it somehow using diff and patch. But
>>> those aren't usually present on Windows. (I gather Emacs has a special
>>> mode for viewing the output from diff or something like that...
>>> Presumably that only works on Unix though.)
>>
>> Install perl. I don't remember perl at all, but it's probably a simple
>> one-liner. A few switches on the command line and a simple regex
>> substitution should do the trick. The right tool for the job, plain and
>> simple. And yes, it's available for windows in a standard windows
>> install package.
>
> The right tool for the job would obviously be some sort of file
> comparison tool - which Perl isn't.

Do you need to make the same change in each file?  If so, Perl or sed, 
or awk are perfect tools for the job.

I don't see where diff comes into play...

-- 
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/*    flabreque    */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/*        @        */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/*   gmail.com     */}camera{orthographic location<6,1.25,-6>look_at a }


Post a reply to this message

From: Warp
Subject: Re: Use case
Date: 26 Aug 2011 10:53:54
Message: <4e57b382@news.povray.org>
Francois Labreque <fla### [at] videotronca> wrote:
> > The right tool for the job would obviously be some sort of file
> > comparison tool - which Perl isn't.

> Do you need to make the same change in each file?  If so, Perl or sed, 
> or awk are perfect tools for the job.

> I don't see where diff comes into play...

  The problem sounds indeed like a simple search&replace task, which
tools like sed or perl are designed for.

-- 
                                                          - Warp


Post a reply to this message

Goto Latest 10 Messages Next 4 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.