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: Toggling the same key combination between two options Date: Sat, 13 Sep 2008 02:23:28 +1200 Message-ID: <18634.31584.699029.301395@kahikatea.snap.net.nz> References: 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 1221229565 20003 80.91.229.12 (12 Sep 2008 14:26:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Sep 2008 14:26:05 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: etay.meiri@gmail.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Sep 12 16:26:59 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 1Ke9bu-000550-Pi for geh-help-gnu-emacs@m.gmane.org; Fri, 12 Sep 2008 16:26:59 +0200 Original-Received: from localhost ([127.0.0.1]:44400 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ke9au-00077q-8e for geh-help-gnu-emacs@m.gmane.org; Fri, 12 Sep 2008 10:25:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ke9Yn-0006XG-NG for help-gnu-emacs@gnu.org; Fri, 12 Sep 2008 10:23:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ke9Ym-0006Wb-6p for help-gnu-emacs@gnu.org; Fri, 12 Sep 2008 10:23:45 -0400 Original-Received: from [199.232.76.173] (port=46236 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ke9Yl-0006WV-Ve for help-gnu-emacs@gnu.org; Fri, 12 Sep 2008 10:23:44 -0400 Original-Received: from viper.snap.net.nz ([202.37.101.25]:41995) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ke9Yl-00082b-Rh for help-gnu-emacs@gnu.org; Fri, 12 Sep 2008 10:23:44 -0400 Original-Received: from kahikatea.snap.net.nz (240.61.255.123.dynamic.snap.net.nz [123.255.61.240]) by viper.snap.net.nz (Postfix) with ESMTP id D11533DA7F7; Sat, 13 Sep 2008 02:23:33 +1200 (NZST) Original-Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id 0E88A8FC6D; Sat, 13 Sep 2008 02:23:29 +1200 (NZST) Original-Newsgroups: gnu.emacs.help In-Reply-To: X-Mailer: VM 7.19 under Emacs 22.3.1 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:57478 Archived-At: > I have F8 and F9 mapped to gud-remove and gud-break (respectively) in > gud-mode. > I'd like to mimic the behaviour of Visual Studio where F9 toggles > between setting and removing the breakpoint. Is it possible to > configure emacs so that it will toggle between the two bindings every > time the key is pressed? Assuming that you're using Emacs 22.1 or later you can do this by clicking on the fringe/margin using mouse-1 (gdb-mouse-set-clear-breakpoint). If you really want to use F9, e.g., from a console, you can adapt this function: (define-key gud-minor-mode-map [f9] 'gdb-set-clear-breakpoint) (defun gdb-set-clear-breakpoint () (interactive) (if (or (buffer-file-name) (eq major-mode 'gdb-assembler-mode)) (if (or (let ((start (- (line-beginning-position) 1)) (end (+ (line-end-position) 1))) (catch 'breakpoint (dolist (overlay (overlays-in start end)) (if (overlay-get overlay 'put-break) (throw 'breakpoint t))))) (eq (car (fringe-bitmaps-at-pos)) 'breakpoint)) (gud-remove nil) (gud-break nil)))) which will set or clear the breakpoint on the line at point (the location of the active cursor). -- Nick http://www.inet.net.nz/~nickrob