From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] find-file-noselect-1 Date: Sat, 12 Feb 2005 11:50:46 -0500 Message-ID: <87vf8x67yl.fsf-monnier+emacs@gnu.org> References: <16907.50624.707323.36975@farnswood.snap.net.nz> <16908.7466.270296.502380@farnswood.snap.net.nz> <16908.8338.858602.199031@farnswood.snap.net.nz> <16909.56012.478599.348349@farnswood.snap.net.nz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1108228606 3495 80.91.229.2 (12 Feb 2005 17:16:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 12 Feb 2005 17:16:46 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 12 18:16:45 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D00rf-0007fV-Kt for ged-emacs-devel@m.gmane.org; Sat, 12 Feb 2005 18:15:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D016q-0004J5-3Y for ged-emacs-devel@m.gmane.org; Sat, 12 Feb 2005 12:31:08 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D013a-0002V3-SH for emacs-devel@gnu.org; Sat, 12 Feb 2005 12:27:47 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D013Y-0002U8-Bg for emacs-devel@gnu.org; Sat, 12 Feb 2005 12:27:45 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D00zB-0001gs-HB for emacs-devel@gnu.org; Sat, 12 Feb 2005 12:23:13 -0500 Original-Received: from [209.226.175.93] (helo=tomts36-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D00Ts-0001eI-9M; Sat, 12 Feb 2005 11:50:52 -0500 Original-Received: from alfajor ([65.92.240.235]) by tomts36-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050212165047.QQKX1694.tomts36-srv.bellnexxia.net@alfajor>; Sat, 12 Feb 2005 11:50:47 -0500 Original-Received: by alfajor (Postfix, from userid 1000) id B099AD73CC; Sat, 12 Feb 2005 11:50:46 -0500 (EST) Original-To: Nick Roberts In-Reply-To: <16909.56012.478599.348349@farnswood.snap.net.nz> (Nick Roberts's message of "Sat, 12 Feb 2005 23:30:36 +1300") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: main.gmane.org gmane.emacs.devel:33300 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:33300 >> + (defun gdb-set-gud-minor-mode (file) >> + "Set gud-minor-mode from find-file if appropriate." >> + (goto-char (point-min)) >> + (unless (search-forward "No source file named " nil t) >> + (with-current-buffer >> + (find-file-noselect file) >> >> Why call find-file-noselect there? If this is meant to operate on the >> file that was just visited, it already has a buffer, and it is the >> current buffer when gdb-find-file-hook runs. Why not just use >> that buffer? > That might have been true but I'm now using this function to address Kim's > point about enabling gud-minor-mode for existing buffers. I don't understand this explanation. In the case where you're enabling gud-minor-mode in existing buffers, the buffers also already exist so you shouldn't call find-file-noselect (which may cause new files to be visited). Maybe you want something like find-buffer-visiting, but even that sounds doubtful because it seems that you always know the buffer before you even know the file name. Stefan