From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Newsgroups: gmane.emacs.devel Subject: Re: switch-to-buffer: for interactive use only Date: Thu, 07 Jul 2011 11:19:53 +0200 Message-ID: <87d3hmcurq.fsf@gmail.com> References: <0aiprg76eu.fsf@fencepost.gnu.org> <87hb6zt8rg.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1310033131 5158 80.91.229.12 (7 Jul 2011 10:05:31 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 7 Jul 2011 10:05:31 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 07 12:05:27 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QelSY-0007Gc-Go for ged-emacs-devel@m.gmane.org; Thu, 07 Jul 2011 12:05:26 +0200 Original-Received: from localhost ([::1]:58212 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QelSX-0000uD-Ox for ged-emacs-devel@m.gmane.org; Thu, 07 Jul 2011 06:05:25 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:46522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qekog-0001QH-Jd for emacs-devel@gnu.org; Thu, 07 Jul 2011 05:24:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qekoe-0001U7-Ua for emacs-devel@gnu.org; Thu, 07 Jul 2011 05:24:14 -0400 Original-Received: from mail-fx0-f52.google.com ([209.85.161.52]:35645) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qekoe-0001U1-IG for emacs-devel@gnu.org; Thu, 07 Jul 2011 05:24:12 -0400 Original-Received: by fxd18 with SMTP id 18so851271fxd.39 for ; Thu, 07 Jul 2011 02:24:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; bh=+Pc/rJy+fQ+2btSg0JMW7Yr9fO0ewZwlsaT/eR4k2To=; b=J4xOKBFEyFmxLz6SfvdJVdO5bqkt6BxS15VX32xOassX/iHjQdbnBKa+waAuXsyom2 I6YGXJHPOpURueXwMbEgXAhaFxWP9QKBz2DHPkJuU2sgvDTHArPlpQ1lZSCnLdEDOs2B Uz43oU6OV1kJ4oWobZcPaOjpmeM4l2FGdV9OQ= Original-Received: by 10.223.58.147 with SMTP id g19mr85326fah.72.1310030650732; Thu, 07 Jul 2011 02:24:10 -0700 (PDT) Original-Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id g12sm2195879fai.32.2011.07.07.02.24.08 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 07 Jul 2011 02:24:09 -0700 (PDT) In-Reply-To: <87hb6zt8rg.fsf@stupidchicken.com> (Chong Yidong's message of "Wed, 06 Jul 2011 17:10:59 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.52 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:141723 Archived-At: Chong Yidong writes: > Stefan Monnier writes: > >>> Was it really necessary to mark switch-to-buffer "for interactive use >>> only"? It's a pretty basic command that was used in ~ 800 places in the >>> Emacs 23.3 sources. >> >> Most of those calls were bugs waiting to catch you in Emacs<23 ("you" >> being typically a user like myself who uses dedicated windows and/or >> minibuffer-only frames). > > How would you change this? > > (defun unbury-buffer () > "Switch to the last buffer in the buffer list." > (interactive) > (switch-to-buffer (last-buffer))) FWIW, I don't have an opinion on whether marking `switch-to-buffer' interactive-only makes sense or not, but I don't think the above is a valid argument either way -- the fact that a function is marked interactive only (and a compiler warning is produced) does IMO not mean there are no valid uses from Lisp code -- there are cases where the interactive behaviour is precisely what you want, and the function above is one such example. It's similar to using commands like `next-line' or `beginning-of-buffer' from another command that e.g. functions as a dispatcher among multiple commands or only slightly modifies the interactive behaviour (e.g. by fixing one of the arguments, as is the case with your function). =C5=A0t=C4=9Bp=C3=A1n