emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] find-file-noselect-1


From: Stefan Monnier
Subject: Re: [PATCH] find-file-noselect-1
Date: Sat, 12 Feb 2005 11:50:46 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

>> + (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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]