Answering my own question: it can be added in gdb-ui.el. The following patch
is only for gdb-ui.el, but it adds a function to find-file-hook. I guess it
could still break find-file, if its not right.
Bugs are always a risk--but is there any reason to think bugs are likely
in this patch?
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-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?
+ (save-current-buffer
What's the reason for that? The contents don't change buffers.
_______________________________________________
Emacs-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-devel