emacs-devel
[Top][All Lists]
Advanced

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

Re: Suspicious code in gnus-read-descriptions-file


From: Stefan
Subject: Re: Suspicious code in gnus-read-descriptions-file
Date: Wed, 23 Mar 2005 07:53:32 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin)

>> (defun gnus-parse-active ()
>> "Parse active info in the nntp server buffer."
>> -  (save-excursion
>> -    (set-buffer nntp-server-buffer)
>> +  (with-current-buffer nntp-server-buffer
>> (goto-char (point-min))

> Are you sure that not saving (and restoring) point in
> nntp-server-buffer doesn't make a difference?

  (save-excursion (set-buffer FOO) BAR)

saves point in the current buffer, not in FOO (unless FOO is already the
current buffer before the set-buffer call).
If you want to save point in FOO, then you need an extra save-excursion.

> But if point /is/ changed, I've often found it pretty hard to be
> absolutely sure if saving point is actually intended and required.

There's indeed the possibility that the code is usually called with
nntp-server-buffer already the current buffer and point in
nntp-server-buffer needs to be saved.  In that case I'd argue that the
current code is buggy (either it should not have the set-buffer, or it
should do the save-excursion after the set-buffer).


        Stefan




reply via email to

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