From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Nick Roberts Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] find-file-noselect-1 Date: Sat, 12 Feb 2005 23:30:36 +1300 Message-ID: <16909.56012.478599.348349@farnswood.snap.net.nz> 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> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1108208174 19327 80.91.229.2 (12 Feb 2005 11:36:14 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 12 Feb 2005 11:36:14 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 12 12:36:13 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1CzvZ5-0007JM-Ef for ged-emacs-devel@m.gmane.org; Sat, 12 Feb 2005 12:35:55 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Czvnl-0002dd-FC for ged-emacs-devel@m.gmane.org; Sat, 12 Feb 2005 06:51:05 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CzuvL-00022r-VP for emacs-devel@gnu.org; Sat, 12 Feb 2005 05:54:52 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CzuvG-00022J-Mf for emacs-devel@gnu.org; Sat, 12 Feb 2005 05:54:47 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CzutP-0001od-JQ for emacs-devel@gnu.org; Sat, 12 Feb 2005 05:52:52 -0500 Original-Received: from [202.37.101.8] (helo=viper.snap.net.nz) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CzuYY-0001Ff-5f; Sat, 12 Feb 2005 05:31:18 -0500 Original-Received: from farnswood.snap.net.nz (p67-tnt1.snap.net.nz [202.124.110.67]) by viper.snap.net.nz (Postfix) with ESMTP id 02A1138ADC3; Sat, 12 Feb 2005 23:31:13 +1300 (NZDT) Original-Received: by farnswood.snap.net.nz (Postfix, from userid 501) id F3E89628AB; Sat, 12 Feb 2005 10:30:36 +0000 (GMT) Original-To: rms@gnu.org In-Reply-To: X-Mailer: VM 6.97 under Emacs 21.2.1 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:33288 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:33288 > I suggest you change the progn to condition-case so as to catch any > errors that happen in gdb-enqueue-input. And if it does ever catch an > error, it could set gud-comint-buffer to nil so it won't do anything > on future calls to find-file. That should make it safe. (defun gdb-find-file-hook () (if (and (boundp 'gud-comint-buffer) ;; in case gud or gdb-ui is just loaded. gud-comint-buffer (buffer-name gud-comint-buffer) (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))) (condition-case nil (gdb-enqueue-input (list (concat "list " (file-name-nondirectory buffer-file-name) ":1\n") `(lambda () (gdb-set-gud-minor-mode ,buffer-file-name))))) (error nil))) Is this what you mean? I don't think that gud-comint-buffer should be set to nil because that would prevent the GDB session from recovering. > > + (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. > + (save-current-buffer > > What's the reason for that? The contents don't change buffers. This was just a legacy from earlier code. I've removed it. Since the changes are all in gdb-ui.el, I feel more comfortable installing them. However, having asked for people's opinion, I'll wait for some approval before doing this. Nick