help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `save-excursion' defeated by `set-buffer'


From: Uday Reddy
Subject: Re: `save-excursion' defeated by `set-buffer'
Date: Sun, 13 Mar 2011 15:05:54 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9

On 3/3/2011 4:58 AM, Le Wang wrote:

Either the compiler warning or the manual is wrong
(http://www.gnu.org/software/emacs/elisp/html_node/Current-Buffer.html):

    Therefore, you should normally use |set-buffer| within a
    |save-current-buffer| or |_save-excursion_| (see Excursions
    
<http://www.gnu.org/software/emacs/elisp/html_node/Excursions.html#Excursions>)
    form that will restore the current buffer when your function is
    done. Here, as an example, is a simplified version of the command
    |append-to-buffer|:

That is a fair point. It seems that this section of the manual hasn't been edited for a long time. I am submitting some changes now.

Notice, however, that the section on save-excursion at

http://www.gnu.org/software/emacs/elisp/html_node/Excursions.html#Excursions
says:

      When only the identity of the current buffer needs to be saved
      and restored, it is preferable to use save-current-buffer instead.

Cheers,
Uday


reply via email to

[Prev in Thread] Current Thread [Next in Thread]