From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: `save-excursion' defeated by `set-buffer' Date: Tue, 15 Mar 2011 13:42:40 -0400 Organization: A noiseless patient Spider Message-ID: References: <4D792D16.1080900@easy-emacs.de> <87pqpwr8ay.fsf@fencepost.gnu.org> <87d3lwr56j.fsf@fencepost.gnu.org> <4d7b8ea3$0$23760$14726298@news.sunsite.dk> <87k4g4pdi3.fsf@fencepost.gnu.org> <4d7c2ea3$0$23757$14726298@news.sunsite.dk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1300214475 11060 80.91.229.12 (15 Mar 2011 18:41:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 15 Mar 2011 18:41:15 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 15 19:41:11 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PzZB3-0002S7-Ie for geh-help-gnu-emacs@m.gmane.org; Tue, 15 Mar 2011 19:41:05 +0100 Original-Received: from localhost ([127.0.0.1]:52726 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzZB3-0006am-1t for geh-help-gnu-emacs@m.gmane.org; Tue, 15 Mar 2011 14:41:05 -0400 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-2.dfn.de!news.dfn.de!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 15 Injection-Info: mx01.eternal-september.org; posting-host="A9flrrT75AwIbB1zb+Al+Q"; logging-data="26198"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+jB/kg87zjfnCCtmJauU+i" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:15J8fo8MfuAsD+VPS9BrJRkhe8w= sha1:eUGJzWkFnxABhEn9cknK2LacooI= Original-Xref: usenet.stanford.edu gnu.emacs.help:185992 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:80138 Archived-At: >> So the warning was introduced to help Elisp coders improve their code. >> That's what byte-compiler warnings are for. > It's hard to tell what's wrong with the code based on this warning, > though. (It says save-excursion is "defeated", but buffer, point, and > mark still seem to be getting restored. So what's the hidden danger?) > Maybe it should specifially say something like, "save-excursion + > set-buffer could possibly be replaced by with-current-buffer." Indeed, I've changed it yesterday (or so) in Emacs trunk to drop the "defeat" verbiage and just recommend to replace it with with-current-buffer, based on Uday's earlier suggestion. Stefan