From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: Adding `#' at each new line with text until the end of the file Date: Thu, 20 May 2010 15:18:36 +0200 Organization: Informatimago Message-ID: References: <87k4r24iq3.fsf@merciadriluca-station.MERCIADRILUCA> <87bpcel6zj.fsf@kuiper.lan.informatimago.com> <878w7is2yy.fsf@merciadriluca-station.MERCIADRILUCA> <87zkzyjkcb.fsf@kuiper.lan.informatimago.com> <87aarx4j3i.fsf@merciadriluca-station.MERCIADRILUCA> <87mxvx2m2w.fsf@merciadriluca-station.MERCIADRILUCA> <87pr0tlzuz.fsf@kuiper.lan.informatimago.com> <87sk5neuwz.fsf@merciadriluca-station.MERCIADRILUCA> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1291833224 18909 80.91.229.12 (8 Dec 2010 18:33:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Dec 2010 18:33:44 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 08 19:33:40 2010 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.69) (envelope-from ) id 1PQOpg-00067Y-3C for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 19:33:40 +0100 Original-Received: from localhost ([127.0.0.1]:39805 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQOpf-0004T6-BX for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 13:33:39 -0500 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 62 Original-X-Trace: individual.net Njk03rTj1foqSlpI2nDiwAQMHSp8cgNYvphI1Bpg3ElVl5uYzP Cancel-Lock: sha1:ODdkZTYzMWVmNjJjOWZiOGJlODNmNmM5ZTI4NzA2OTM5MGI2ZTVkNw== sha1:OTMgnKH4FYP30BNGfWlrhC7sLLM= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.101 (Gnus v5.10.10) Emacs/23.1 (darwin) Original-Xref: usenet.stanford.edu gnu.emacs.help:178298 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:75798 Archived-At: Merciadri Luca writes: > pjb@informatimago.com (Pascal J. Bourguignon) writes: > >> Merciadri Luca writes: >> >>> pjb@informatimago.com (Pascal J. Bourguignon) writes: >>> >>>>> Sure, but, as I explained in my previous message, it does not even >>>>> modify the Sayings file. Why? >>>> >>>> Because you didn't instruct the program to modify the file. >>>> Read the documentation of insert, for example. Does it mention files? >>>> What does insert modify? >>> Insert modifies the current buffer, according to the manual. Or >>> find-file loads its arg into a buffer. So, if find-file loads its arg >>> into the *current* buffer, insert should modify the current buffer, >>> that is, `Sayings'. >> >> (list >> (progn (find-file "/tmp/Sayings") >> (buffer-name (current-buffer))) >> (progn (find-file "/mnt/Sayings") >> (buffer-name (current-buffer)))) >> --> ("Sayings" "Sayings<2>") >> >> Here you have two files, named "/tmp/Sayings" and "/mnt/Sayings", and >> when opening them at the same time, we get "Sayings" and "Sayings<2>" >> as buffer names. >> >> Clearly, the buffer names are not entirely independant from the file >> names, but it should be obvious from the example, that there's two >> name spaces and two different kind of entities. A buffer named "X" is >> not a file name "X". >> >> So to repeat what you wrote above: >> >> - find-file (or find-file-noselect) loads the contents of a _file_ >> into a _buffer_. >> >> - insert modifies the contents of a _buffer_. >> >> When you do only these to action what happens to the _file_? > Nothing, actually. That's the problem. Yes. That's because you haven't said something. What should you say to have the file modified in any way? Something like: - save the buffer to the file, keeping a backup of the old file. or, in emacs lisp: (save-buffer 1) Remember: Computers only do what you tell them to do! ;-) -- __Pascal Bourguignon__ http://www.informatimago.com