[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adding `#' at each new line with text until the end of the file
From: |
Pascal J. Bourguignon |
Subject: |
Re: Adding `#' at each new line with text until the end of the file |
Date: |
Wed, 08 Dec 2010 15:09:12 -0000 |
User-agent: |
Gnus/5.101 (Gnus v5.10.10) Emacs/23.1 (darwin) |
Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> writes:
> pjb@informatimago.com (Pascal J. Bourguignon) writes:
>
>> Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> 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
- Adding `#' at each new line with text until the end of the file, Merciadri Luca, 2010/12/08
- Re: Adding `#' at each new line with text until the end of the file, Pascal J. Bourguignon, 2010/12/08
- Re: Adding `#' at each new line with text until the end of the file, Merciadri Luca, 2010/12/08
- Message not available
- Re: Adding `#' at each new line with text until the end of the file, Merciadri Luca, 2010/12/08
- Re: Adding `#' at each new line with text until the end of the file, Pascal J. Bourguignon, 2010/12/08
- Re: Adding `#' at each new line with text until the end of the file, Merciadri Luca, 2010/12/08
- Re: Adding `#' at each new line with text until the end of the file, Pascal J. Bourguignon, 2010/12/08
- Re: Adding `#' at each new line with text until the end of the file, Merciadri Luca, 2010/12/08
- Re: Adding `#' at each new line with text until the end of the file,
Pascal J. Bourguignon <=
- Re: Adding `#' at each new line with text until the end of the file, Merciadri Luca, 2010/12/08
- Re: Adding `#' at each new line with text until the end of the file, Andreas Politz, 2010/12/08