From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: gnuist006@gmail.com Newsgroups: gmane.emacs.help Subject: Re: How to write a string to a file inside emacs ? Date: Tue, 23 Oct 2007 17:00:00 -0000 Organization: http://groups.google.com Message-ID: <1193158800.876570.255450@q5g2000prf.googlegroups.com> References: <1193156806.446070.169910@i38g2000prf.googlegroups.com> <1193157022.502345.219810@k35g2000prh.googlegroups.com> <1193157722.974559.53510@e34g2000pro.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: ger.gmane.org 1193161475 21921 80.91.229.12 (23 Oct 2007 17:44:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Oct 2007 17:44:35 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 23 19:44:37 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IkNno-0000jI-Gn for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Oct 2007 19:44:28 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IkNng-0003kf-FX for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Oct 2007 13:44:20 -0400 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!q5g2000prf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 60 Original-NNTP-Posting-Host: 75.28.129.58 Original-X-Trace: posting.google.com 1193158801 25539 127.0.0.1 (23 Oct 2007 17:00:01 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 23 Oct 2007 17:00:01 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1.8) Gecko/20071008 Firefox/2.0.0.8,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: q5g2000prf.googlegroups.com; posting-host=75.28.129.58; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Original-Xref: shelby.stanford.edu gnu.emacs.help:153237 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:48724 Archived-At: Sure, lets everyone do it. thx for pointing it out. On Oct 23, 9:45 am, Rainer Joswig 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