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


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to