unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan <monnier@iro.umontreal.ca>
Subject: Re: Suspicious code in gnus-read-descriptions-file
Date: Wed, 23 Mar 2005 07:53:32 -0500	[thread overview]
Message-ID: <m1br9aplv6.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87eke71cnj.fsf@Jesper-Harders-Computer.local> (Jesper Harder's message of "Wed, 23 Mar 2005 00:17:29 +0100")

>> (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	other threads:[~2005-03-23 12:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-22 18:51 Suspicious code in gnus-read-descriptions-file Stefan Monnier
2005-03-22 21:53 ` Simon Josefsson
2005-03-22 22:28   ` David Kastrup
2005-03-22 23:17 ` Jesper Harder
2005-03-23 12:53   ` Stefan [this message]
2005-03-24 14:07     ` Jesper Harder

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=m1br9aplv6.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).