help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Mode for files visited by GUD


From: Nick Roberts
Subject: Re: Mode for files visited by GUD
Date: Fri, 18 Jul 2008 12:30:32 +1200

 > >  > Is there any mode (and it's hook) run when GUD visits a source code file
 > >  > during debugging?
 > > 
 > > gdb-find-file-hook is run when GUD visits a source code file.  You could
 > > advise that function
 > 
 > Great, it worked.
 > 
 > This is sort of peculiar way to do it. I mean, hooks are normally variables,
 > and one uses add-hook with them. But in this case it is a function,

You're probably right but others do it too, e.g., vc-find-file-hook.  I find
it an easy way to remember what hook the function is associated with.

 > documented on a user level, while the variable was not. Maybe the variable
 > was created by my mistake only, as I hooked my function on it?

What variable?  There is no variable gdb-find-file-hook and the variable
find-file-hook is documented in the Elisp manual.

 > So, yes, I can advice that function, but, anything against using a hook
 > variable instead?

I'm not sure what you mean.  gdb-find-file-hook is added to find-file-hook
which _is_ a hook variable

 > Another question: is there an "exit hook", for the time when debugging goes
 > into a different file? I guess it doesn't make a lot of sense, but I'm 
 > curious.

You could possibly watch the value of gdb-source-window, or, at the right time,
compare gud-last-frame to gud-last-last-frame.

 > > or create your own hook using find-file-hook (see the Elisp manual).
 > 
 > I'm also curious about this. What did you mean? Why should I create my own
 > hook instead of hooking my minor mode or function into that existing hook?
 > And how can I tell if the file is being found by GUD and not by user request?

Advising functions has it's own problems as described in the Elisp manual.

What is it you are trying to do?  If your changes are of general interest,
maybe we could include them in Emacs.

-- 
Nick                                           http://www.inet.net.nz/~nickrob




reply via email to

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