Toggling the same key combination between two options
  Home FAQ Contact Sign in
gnu.emacs.help only
 
Advanced search
POPULAR GROUPS

more...

gnu.emacs.help Profile…
 Up
Toggling the same key combination between two options         


Author: etay.meiri
Date: Sep 11, 2008 11:15

Hi,

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?

Thanks a lot,

-Etay
8 Comments
Re: Toggling the same key combination between two options         


Author: Pascal J. Bourguignon
Date: Sep 11, 2008 11:44

etay.meiri@gmail.com writes:
> Hi,
>
> 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?
Show full article (1.29Kb)
no comments
Re: Toggling the same key combination between two options         


Author: etay.meiri
Date: Sep 11, 2008 12:27

Thanks a lot, Pascal.
The function you provided works well for the example with the F12.
However, when I go into gud-mode and hit F9 (which is configured using
(local-set-toggling-key (kbd "") 'gud-break 'gud-remove)) it tells
me that F9 is undefined. I tried changing 'local-set-key' to 'define-
key gud-mode-map' but it did not work.

Any idea?

Thanks,

-Etay

On Sep 11, 9:44 pm, p...@informatimago.com (Pascal J. Bourguignon)
wrote:
> etay.me...@gmail.com writes:
>> Hi,
>
>> I have F8 and F9 mapped to gud-remove and gud-break (respectively) in
>> gud-mode...
Show full article (1.89Kb)
no comments
Re: Toggling the same key combination between two options         


Author: Scott Frazer
Date: Sep 11, 2008 13:25

Pascal J. Bourguignon wrote:
> etay.meiri@gmail.com writes:
>
>> Hi,
>>
>> 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?
>
> (defun local-set-toggling-key (key cmd1 cmd2)
> (interactive "KSet key locally:
> CSet key %%s locally to command:
> CToggling key %%s locally to command: ")
> (let ((on (gensym))
> (off (gensym)))
> (setf (symbol-function on)
> `(lambda () ...
Show full article (1.68Kb)
no comments
Re: Toggling the same key combination between two options         


Author: Nick Roberts
Date: Sep 12, 2008 07:23

> 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)
Show full article (1.26Kb)
no comments
Re: Toggling the same key combination between two options         


Author: E.L.K.
Date: Sep 12, 2008 15:06

> 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?

IIRC, there is function, called gdb-toggle-breakpoint, which can
be what you need.

But it will work only with gdb, I think.

--
E.L.K.
Saturday, 13 of September, 2008, 1:04

зы. C_U_L8r!
no comments
Re: Toggling the same key combination between two options         


Author: Lennart Borgman (gmail)
Date: Sep 12, 2008 15:12

E.L.K. wrote:
> IIRC, there is function, called gdb-toggle-breakpoint, which can
> be what you need.
>
> But it will work only with gdb, I think.

Sounds like an oversigt. Maybe you can report it as a bug?
no comments
Re: Toggling the same key combination between two options         


Author: Nick Roberts
Date: Sep 12, 2008 15:51

>> 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?
>
> IIRC, there is function, called gdb-toggle-breakpoint, which can
> be what you need.

This function doesn't set/clear breakoints but enables/disables them. It
also works from the breakpoints buffer, not the source buffer.

no comments
gdb-toggle-breakpoint [was Re: Toggling the same key combination between two options]         


Author: Nick Roberts
Date: Sep 12, 2008 15:53

Lennart Borgman (gmail) writes:
> E.L.K. wrote:
>> IIRC, there is function, called gdb-toggle-breakpoint, which can
>> be what you need.
>>
>> But it will work only with gdb, I think.
>
> Sounds like an oversigt. Maybe you can report it as a bug?

Please don't report it as a bug. It seems entirely reasonable to me
that gdb-toggle-breakpoint should only work with gdb.

no comments