From: ·········@gmail.com
Subject: How to write a string to a file inside emacs ?
Date: 
Message-ID: <1193156806.446070.169910@i38g2000prf.googlegroups.com>
Here is the problem:

How would you write a string to a file inside emacs ? There is the
main buffer that you are viewing called file1. Here you run a lisp
function which is supposed to write some text of the file or in a
variable to another file called file2.

I have looked and found this function:

(append-to-file START END FILENAME)

This function is only good enough to copy selected text from file1 to
file2, BUT I want a function that copies value of a string variable
str-var into file2 or some other string. Basically, I want a
generalization/modification of the command "insert" to append which
takes a filename as an argument and appends a given string over there.

I know one dirty workaround is to insert the text in file1, and then
append-to-file into file2 and then remove it from file1.

Is there a faster or cleaner approach ? This has to be done a lot and
one wants something faster than writing, copying and erasing.


append-to-buffer is an interactive compiled Lisp function in `simple'.
(append-to-buffer BUFFER START END)

Append to specified buffer the text of the region.
It is inserted into that buffer before its point.

When calling from a program, give three arguments:
BUFFER (or buffer name), START and END.
START and END specify the portion of the current buffer to be copied.

From: ·········@gmail.com
Subject: Re: How to write a string to a file inside emacs ?
Date: 
Message-ID: <1193157022.502345.219810@k35g2000prh.googlegroups.com>
On Oct 23, 9:26 am, ·········@gmail.com wrote:
> Here is the problem:
>
> How would you write a string to a file inside emacs ? There is the
> main buffer that you are viewing called file1. Here you run a lisp
> function which is supposed to write some text of the file or in a
> variable to another file called file2.
>
> I have looked and found this function:
>
> (append-to-file START END FILENAME)
>
> This function is only good enough to copy selected text from file1 to
> file2, BUT I want a function that copies value of a string variable
> str-var into file2 or some other string. Basically, I want a
> generalization/modification of the command "insert" to append which
> takes a filename as an argument and appends a given string over there.
>
> I know one dirty workaround is to insert the text in file1, and then
> append-to-file into file2 and then remove it from file1.
>
> Is there a faster or cleaner approach ? This has to be done a lot and
> one wants something faster than writing, copying and erasing.
>
> append-to-buffer is an interactive compiled Lisp function in `simple'.
> (append-to-buffer BUFFER START END)
>
> Append to specified buffer the text of the region.
> It is inserted into that buffer before its point.
>
> When calling from a program, give three arguments:
> BUFFER (or buffer name), START and END.
> START and END specify the portion of the current buffer to be copied.

just found the write-file is based on write-region but neither solves
my problem.
From: ·········@gmail.com
Subject: Re: How to write a string to a file inside emacs ?
Date: 
Message-ID: <1193157722.974559.53510@e34g2000pro.googlegroups.com>
On Oct 23, 9:30 am, ·········@gmail.com wrote:
> On Oct 23, 9:26 am, ·········@gmail.com wrote:
>
>
>
> > Here is the problem:
>
> > How would you write a string to a file inside emacs ? There is the
> > main buffer that you are viewing called file1. Here you run a lisp
> > function which is supposed to write some text of the file or in a
> > variable to another file called file2.
>
> > I have looked and found this function:
>
> > (append-to-file START END FILENAME)
>
> > This function is only good enough to copy selected text from file1 to
> > file2, BUT I want a function that copies value of a string variable
> > str-var into file2 or some other string. Basically, I want a
> > generalization/modification of the command "insert" to append which
> > takes a filename as an argument and appends a given string over there.
>
> > I know one dirty workaround is to insert the text in file1, and then
> > append-to-file into file2 and then remove it from file1.
>
> > Is there a faster or cleaner approach ? This has to be done a lot and
> > one wants something faster than writing, copying and erasing.
>
> > append-to-buffer is an interactive compiled Lisp function in `simple'.
> > (append-to-buffer BUFFER START END)
>
> > Append to specified buffer the text of the region.
> > It is inserted into that buffer before its point.
>
> > When calling from a program, give three arguments:
> > BUFFER (or buffer name), START and END.
> > START and END specify the portion of the current buffer to be copied.
>
> just found the write-file is based on write-region but neither solves
> my problem.

Kludgy feature: if START is a string, then that string is written
to the file, instead of any buffer contents, and END is ignored.
<--------It does not seem to work
From: ·········@gmail.com
Subject: Re: How to write a string to a file inside emacs ?
Date: 
Message-ID: <1193159148.301854.314380@q3g2000prf.googlegroups.com>
On Oct 23, 9:42 am, ·········@gmail.com wrote:
> On Oct 23, 9:30 am, ·········@gmail.com wrote:
>
>
>
> > On Oct 23, 9:26 am, ·········@gmail.com wrote:
>
> > > Here is the problem:
>
> > > How would you write a string to a file inside emacs ? There is the
> > > main buffer that you are viewing called file1. Here you run a lisp
> > > function which is supposed to write some text of the file or in a
> > > variable to another file called file2.
>
> > > I have looked and found this function:
>
> > > (append-to-file START END FILENAME)
>
> > > This function is only good enough to copy selected text from file1 to
> > > file2, BUT I want a function that copies value of a string variable
> > > str-var into file2 or some other string. Basically, I want a
> > > generalization/modification of the command "insert" to append which
> > > takes a filename as an argument and appends a given string over there.
>
> > > I know one dirty workaround is to insert the text in file1, and then
> > > append-to-file into file2 and then remove it from file1.
>
> > > Is there a faster or cleaner approach ? This has to be done a lot and
> > > one wants something faster than writing, copying and erasing.
>
> > > append-to-buffer is an interactive compiled Lisp function in `simple'.
> > > (append-to-buffer BUFFER START END)
>
> > > Append to specified buffer the text of the region.
> > > It is inserted into that buffer before its point.
>
> > > When calling from a program, give three arguments:
> > > BUFFER (or buffer name), START and END.
> > > START and END specify the portion of the current buffer to be copied.
>
> > just found the write-file is based on write-region but neither solves
> > my problem.
>
> Kludgy feature: if START is a string, then that string is written
> to the file, instead of any buffer contents, and END is ignored.
> <--------It does not seem to work

Also, I might add that I canot make use of a macro feature inside a
lisp function and therefore, I cant use something like find-file,
unless it is transparent.
From: Rainer Joswig
Subject: Re: How to write a string to a file inside emacs ?
Date: 
Message-ID: <joswig-74B8D6.18453723102007@news-europe.giganews.com>
In article <·······················@e34g2000pro.googlegroups.com>,
 ·········@gmail.com wrote:

Please send Emacs related questions only to an Emacs
newsgroup. comp.lang.lisp and comp.lang.scheme are
not for general questions about Emacs and not
for questions customizing Emacs with Emacs Lisp.

Thanks.

Followup-To set to gnu.emacs.help .


> On Oct 23, 9:30 am, ·········@gmail.com wrote:
> > On Oct 23, 9:26 am, ·········@gmail.com wrote:
> >
> >
> >
> > > Here is the problem:
> >
> > > How would you write a string to a file inside emacs ? There is the
> > > main buffer that you are viewing called file1. Here you run a lisp
> > > function which is supposed to write some text of the file or in a
> > > variable to another file called file2.
> >
> > > I have looked and found this function:
> >
> > > (append-to-file START END FILENAME)
> >
> > > This function is only good enough to copy selected text from file1 to
> > > file2, BUT I want a function that copies value of a string variable
> > > str-var into file2 or some other string. Basically, I want a
> > > generalization/modification of the command "insert" to append which
> > > takes a filename as an argument and appends a given string over there.
> >
> > > I know one dirty workaround is to insert the text in file1, and then
> > > append-to-file into file2 and then remove it from file1.
> >
> > > Is there a faster or cleaner approach ? This has to be done a lot and
> > > one wants something faster than writing, copying and erasing.
> >
> > > append-to-buffer is an interactive compiled Lisp function in `simple'.
> > > (append-to-buffer BUFFER START END)
> >
> > > Append to specified buffer the text of the region.
> > > It is inserted into that buffer before its point.
> >
> > > When calling from a program, give three arguments:
> > > BUFFER (or buffer name), START and END.
> > > START and END specify the portion of the current buffer to be copied.
> >
> > just found the write-file is based on write-region but neither solves
> > my problem.
> 
> Kludgy feature: if START is a string, then that string is written
> to the file, instead of any buffer contents, and END is ignored.
> <--------It does not seem to work
From: Xah Lee
Subject: Re: How to write a string to a file inside emacs ?
Date: 
Message-ID: <1193215783.299038.58650@q3g2000prf.googlegroups.com>
WHAT A MOTHERFUCK!
I got tricked into posting into a group i didn't intend to.

People, if you are going to advice and tweak the newsgroup follow up,
start with motherfucking yourself.

I repost my original message below
-------------------------------

Please ignore Rainer Joswig's advice. He's a Common Lisp fan.

comp.lang.lisp is for all lisps, including emacs lisp.

  Xah
  ···@xahlee.org
  http://xahlee.org/



On Oct 23, 9:45 am, Rainer Joswig wrote:
�
Please send Emacs related questions only to an Emacs
newsgroup. comp.lang.lisp and comp.lang.scheme are
not for general questions about Emacs and not
for questions customizing Emacs with Emacs Lisp.

Thanks.
Followup-To set to gnu.emacs.help .
�
From: George Neuner
Subject: Re: How to write a string to a file inside emacs ?
Date: 
Message-ID: <tgdvh3h0v67hdsmdrni1l8cb18gtubfg5s@4ax.com>
On Wed, 24 Oct 2007 01:49:43 -0700, Xah Lee <···@xahlee.org> wrote:

>WHAT A MOTHERFUCK!
>I got tricked into posting into a group i didn't intend to.
>
>People, if you are going to advice and tweak the newsgroup follow up,
>start with motherfucking yourself.
>
>I repost my original message below
>-------------------------------
>
>Please ignore Rainer Joswig's advice. He's a Common Lisp fan.
>
>comp.lang.lisp is for all lisps, including emacs lisp.
>
>  Xah
>  ···@xahlee.org
>  http://xahlee.org/

WATCH YOUR LANGUAGE!  I'm not going to warn you again.

George
--
for email reply remove "/" from address
From: Rainer Joswig
Subject: Re: How to write a string to a file inside emacs ?
Date: 
Message-ID: <joswig-47A5D5.00161625102007@news-europe.giganews.com>
In article <·······················@q3g2000prf.googlegroups.com>,
 Xah Lee <···@xahlee.org> wrote:

> WHAT A MOTHERFUCK!
> I got tricked into posting into a group i didn't intend to.

Bla bla.

> 
> People, if you are going to advice and tweak the newsgroup follow up,
> start with motherfucking yourself.
> 
> I repost my original message below
> -------------------------------
> 
> Please ignore Rainer Joswig's advice. He's a Common Lisp fan.

Frogshit.

> comp.lang.lisp is for all lisps, including emacs lisp.

If I have a Scheme question, I use comp.lang.scheme.
If I have a Logo question, I use comp.lang.logo.
If I have an Emacs question, I use one of the
multitude of Emacs newsgroups.

Comp.lang.lisp is mostly used for general Lisp discussion.
Specific questions about implementations and their usage
are best asked on their mailing lists or their newsgroups.
Newbies may not know the right place to ask, so
they often get the pointer to the right place.

comp.lang.lisp  is not about customizing GNU Emacs.

If you want to post about customizing Emacs,
do it in an Emacs newsgroup. All the stuff
you have posted is Emacs specific and not of
general interest (image tags in Emacs).
GNU Emacs has a special Lisp dialect for customization
and its own libraries.

If you want to post about a GENERAL Lisp topic (which might
include questions about all Lisp dialects), post in
comp.lang.lisp . But, best post to the most
specific newsgroup to get the most qualified answer.

Your own postings about customizing Emacs are a typical
example for an unwanted cross-posting. Please stop
that. They may be useful for Emacs users, but there
is little general Lisp content.

Should every comp.lang.logo post be cross-posted to comp.lang.lisp,
just because Logo is a Lisp dialect? I'd hope not.

> 
>   Xah
>   ···@xahlee.org
>   http://xahlee.org/
> 
> 
> 
> On Oct 23, 9:45 am, Rainer Joswig wrote:
> ?
> Please send Emacs related questions only to an Emacs
> newsgroup. comp.lang.lisp and comp.lang.scheme are
> not for general questions about Emacs and not
> for questions customizing Emacs with Emacs Lisp.
> 
> Thanks.
> Followup-To set to gnu.emacs.help .
> ?