From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nick Roberts Newsgroups: gmane.emacs.help Subject: Re: Mode for files visited by GUD Date: Sat, 19 Jul 2008 14:20:06 +1200 Message-ID: <18561.20310.520758.573075@kahikatea.snap.net.nz> References: <200807170135.53892.juanma_bellon@yahoo.es> <200807180308.34236.juanma_bellon@yahoo.es> <18559.62122.772406.76782@kahikatea.snap.net.nz> <200807190340.43137.juanma_bellon@yahoo.es> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1216435336 2395 80.91.229.12 (19 Jul 2008 02:42:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 19 Jul 2008 02:42:16 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Juanma Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jul 19 04:43:03 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KK2PW-00032A-A6 for geh-help-gnu-emacs@m.gmane.org; Sat, 19 Jul 2008 04:43:02 +0200 Original-Received: from localhost ([127.0.0.1]:53126 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KK2Od-0008Cg-6a for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Jul 2008 22:42:07 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KK2OM-0008BW-Ua for help-gnu-emacs@gnu.org; Fri, 18 Jul 2008 22:41:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KK2OI-00087P-8w for help-gnu-emacs@gnu.org; Fri, 18 Jul 2008 22:41:50 -0400 Original-Received: from [199.232.76.173] (port=55176 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KK2OI-00087I-6A for help-gnu-emacs@gnu.org; Fri, 18 Jul 2008 22:41:46 -0400 Original-Received: from viper.snap.net.nz ([202.37.101.25]:54098) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KK2OH-0005BH-Bv for help-gnu-emacs@gnu.org; Fri, 18 Jul 2008 22:41:45 -0400 Original-Received: from kahikatea.snap.net.nz (229.63.255.123.dynamic.snap.net.nz [123.255.63.229]) by viper.snap.net.nz (Postfix) with ESMTP id 7E7AD2F55A5; Sat, 19 Jul 2008 14:20:15 +1200 (NZST) Original-Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id 67EA08FC6D; Sat, 19 Jul 2008 14:20:07 +1200 (NZST) In-Reply-To: <200807190340.43137.juanma_bellon@yahoo.es> X-Mailer: VM 7.19 under Emacs 22.2.50.3 X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:55724 Archived-At: > > A file called gdbsrc.el used to do something like this in XEmacs and I > > considered it for a while. I think it's the wrong approcah because > > generally in a debug session you end up wanting to edit your code. > > But there is nothing wrong with it. Sure, you end up editing, but that > happens at the *end*, first you have to quit debugging to do anything useful > with the editing task. It's best not to quit debugging and just recompile. That way you keep the shell history as well as GDB's breakpoints, although some may have moved. > Besides, I make 'q' exit the read-only modes; it > can't get much easier than that; and while I'm just doing "next", "step" and > friends, I can do it with 'n', 's' and so on, and if I need to select a > piece of code (e.g., for evaluating), I don't have to switch to another > window, and back: I'm there. Then presumably you need to remember to turn it on again when you debug. I find the tool bar useful for repetitive commands except that it doesn't work properly with GTK. In this case, in the GUD buffer works well. > > This way, as you say, source-guding-mode is evaluated for all files. > > gdb-find-file-hook is also evaluated for all files but it doesn't do > > anything if gud-minor-mode is not 'gdba or 'gdbmi. > > IMHO, it breaks the principle of least astonishment. At least I was > astonished :-) gdb-find-file-hook is an internal function not intended for general use. It's role is too specialised for it's own hook variable. > So I could do this, right?: > > (defadvice gdb-find-file-hook (after activate-guding activate) > (and gud-minor-mode > (memq gud-minor-mode '(gdba gdbmi)) > (source-guding-mode 1))) Something like that should work but not for existing buffers which hold source files. > > Since you probably want to set source-guding-mode for existing buffers too > > it may be best to advise gdb-init-buffer. This function only gets called > > for GDB related buffers. > > I haven't found such function with [C-h f]. In which version was it > introduced? Yes, it's only in the CVS repository. -- Nick http://www.inet.net.nz/~nickrob