all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
To: Juanma <juanma_bellon@yahoo.es>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Mode for files visited by GUD
Date: Sat, 19 Jul 2008 14:20:06 +1200	[thread overview]
Message-ID: <18561.20310.520758.573075@kahikatea.snap.net.nz> (raw)
In-Reply-To: <200807190340.43137.juanma_bellon@yahoo.es>

 > > 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, <RET> 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




      reply	other threads:[~2008-07-19  2:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-16 23:35 Mode for files visited by GUD Juanma
2008-07-17  0:13 ` Nick Roberts
2008-07-17 23:54   ` Juanma
2008-07-18  0:21     ` Juanma
2008-07-18  0:30     ` Nick Roberts
2008-07-18  1:08       ` Juanma
2008-07-18  1:32         ` Nick Roberts
2008-07-19  1:40           ` Juanma
2008-07-19  2:20             ` Nick Roberts [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18561.20310.520758.573075@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=help-gnu-emacs@gnu.org \
    --cc=juanma_bellon@yahoo.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.