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: Fri, 18 Jul 2008 13:32:26 +1200 Message-ID: <18559.62122.772406.76782@kahikatea.snap.net.nz> References: <200807170135.53892.juanma_bellon@yahoo.es> <200807180154.59785.juanma_bellon@yahoo.es> <18559.58408.326814.857256@kahikatea.snap.net.nz> <200807180308.34236.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 1216344788 3184 80.91.229.12 (18 Jul 2008 01:33:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 18 Jul 2008 01:33:08 +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 Fri Jul 18 03:33:55 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 1KJer2-0003RM-4v for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Jul 2008 03:33:52 +0200 Original-Received: from localhost ([127.0.0.1]:36249 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJeq6-0002ml-QL for geh-help-gnu-emacs@m.gmane.org; Thu, 17 Jul 2008 21:32:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KJepq-0002mY-LS for help-gnu-emacs@gnu.org; Thu, 17 Jul 2008 21:32:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KJepp-0002mM-7T for help-gnu-emacs@gnu.org; Thu, 17 Jul 2008 21:32:38 -0400 Original-Received: from [199.232.76.173] (port=40421 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJepo-0002mJ-Vw for help-gnu-emacs@gnu.org; Thu, 17 Jul 2008 21:32:37 -0400 Original-Received: from viper.snap.net.nz ([202.37.101.25]:50314) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KJepn-0006iq-IW for help-gnu-emacs@gnu.org; Thu, 17 Jul 2008 21:32:37 -0400 Original-Received: from kahikatea.snap.net.nz (227.61.255.123.dynamic.snap.net.nz [123.255.61.227]) by viper.snap.net.nz (Postfix) with ESMTP id 1F4682F4A46; Fri, 18 Jul 2008 13:32:31 +1200 (NZST) Original-Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id 0AA198FC6D; Fri, 18 Jul 2008 13:32:27 +1200 (NZST) In-Reply-To: <200807180308.34236.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:55689 Archived-At: > > What is it you are trying to do? If your changes are of general interest, > > maybe we could include them in Emacs. > > I want to turn on a minor mode for source code files visited during > debugging. I want to make them read-only and have many commands bound to > single keys (I use View mode in addition to my minor mode). 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. >... > Then I have this in my .emacs: > > (autoload 'source-guding-mode "source-guding.el") > (defadvice gdb-find-file-hook (after activate-guding activate) > (source-guding-mode 1)) 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. 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. -- Nick http://www.inet.net.nz/~nickrob