all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: pjb@informatimago.com (Pascal J. Bourguignon)
To: help-gnu-emacs@gnu.org
Subject: Re: Adding `#' at each new line with text until the end of the file
Date: Thu, 20 May 2010 15:18:36 +0200	[thread overview]
Message-ID: <lz7hmyu2xf.fsf@informatimago.com> (raw)
In-Reply-To: 87sk5neuwz.fsf@merciadriluca-station.MERCIADRILUCA

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?

\f
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


  reply	other threads:[~2010-05-20 13:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-17 16:05 Adding `#' at each new line with text until the end of the file Merciadri Luca
2010-05-17 18:26 ` Pascal J. Bourguignon
2010-05-17 20:11   ` Merciadri Luca
     [not found]     ` <87zkzyjkcb.fsf@kuiper.lan.informatimago.com>
2010-05-18 10:09       ` Merciadri Luca
2010-05-18 12:06         ` Pascal J. Bourguignon
2010-05-18 16:47           ` Merciadri Luca
2010-05-18 20:27             ` Pascal J. Bourguignon
2010-05-19 16:08               ` Merciadri Luca
2010-05-20 13:18                 ` Pascal J. Bourguignon [this message]
2010-05-20 18:09                   ` Merciadri Luca
2010-05-20 19:05                 ` Andreas Politz

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=lz7hmyu2xf.fsf@informatimago.com \
    --to=pjb@informatimago.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.