From: gnuist006@gmail.com
To: help-gnu-emacs@gnu.org
Subject: Re: How to write a string to a file inside emacs ?
Date: Tue, 23 Oct 2007 17:00:00 -0000 [thread overview]
Message-ID: <1193158800.876570.255450@q5g2000prf.googlegroups.com> (raw)
In-Reply-To: <joswig-74B8D6.18453723102007@news-europe.giganews.com>
Sure, lets everyone do it. thx for pointing it out.
On Oct 23, 9:45 am, Rainer Joswig <jos...@lisp.de> wrote:
> In article <1193157722.974559.53...@e34g2000pro.googlegroups.com>,
>
> gnuist...@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, gnuist...@gmail.com wrote:
> > > On Oct 23, 9:26 am, gnuist...@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
next prev parent reply other threads:[~2007-10-23 17:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-23 16:26 How to write a string to a file inside emacs ? gnuist006
2007-10-23 16:30 ` gnuist006
2007-10-23 16:42 ` gnuist006
2007-10-23 16:45 ` Rainer Joswig
2007-10-23 17:00 ` gnuist006 [this message]
2007-10-24 8:45 ` Xah Lee
2007-10-24 8:49 ` Xah Lee
2007-10-24 11:05 ` Bastien
2007-10-24 21:17 ` George Neuner
2007-10-24 22:16 ` Rainer Joswig
2007-10-23 17:05 ` gnuist006
2007-10-24 1:00 ` Stefan Monnier
2007-10-24 3:17 ` gnuist006
2007-10-24 14:15 ` Stefan Monnier
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1193158800.876570.255450@q5g2000prf.googlegroups.com \
--to=gnuist006@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.
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).