Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

I was using thisthis to implement line duplication in emacs and decided to bind it to C-c d and it works without problems

What would be cooler though is if I can use C-c d do duplicate a line and then be able to make further duplications of this line by simply typing d. If I want 4 duplications, then the call would be C-c d, d, d, d.

What's the best way to achieve this? I assumed it would be activating a minor mode with C-c d that, when it starts, duplicates a line and then has the duplicate-line function bound to "d" in it's keymap.

The problem with this is that you have to disable the minor mode when a key is pressed that is not in it's keymap. Can this be done?

Or am I approaching this problem completely wrong?

I was using this to implement line duplication in emacs and decided to bind it to C-c d and it works without problems

What would be cooler though is if I can use C-c d do duplicate a line and then be able to make further duplications of this line by simply typing d. If I want 4 duplications, then the call would be C-c d, d, d, d.

What's the best way to achieve this? I assumed it would be activating a minor mode with C-c d that, when it starts, duplicates a line and then has the duplicate-line function bound to "d" in it's keymap.

The problem with this is that you have to disable the minor mode when a key is pressed that is not in it's keymap. Can this be done?

Or am I approaching this problem completely wrong?

I was using this to implement line duplication in emacs and decided to bind it to C-c d and it works without problems

What would be cooler though is if I can use C-c d do duplicate a line and then be able to make further duplications of this line by simply typing d. If I want 4 duplications, then the call would be C-c d, d, d, d.

What's the best way to achieve this? I assumed it would be activating a minor mode with C-c d that, when it starts, duplicates a line and then has the duplicate-line function bound to "d" in it's keymap.

The problem with this is that you have to disable the minor mode when a key is pressed that is not in it's keymap. Can this be done?

Or am I approaching this problem completely wrong?

Source Link
flooose
  • 521
  • 6
  • 16

Disable minor mode when keys not in it's keymap are pressed

I was using this to implement line duplication in emacs and decided to bind it to C-c d and it works without problems

What would be cooler though is if I can use C-c d do duplicate a line and then be able to make further duplications of this line by simply typing d. If I want 4 duplications, then the call would be C-c d, d, d, d.

What's the best way to achieve this? I assumed it would be activating a minor mode with C-c d that, when it starts, duplicates a line and then has the duplicate-line function bound to "d" in it's keymap.

The problem with this is that you have to disable the minor mode when a key is pressed that is not in it's keymap. Can this be done?

Or am I approaching this problem completely wrong?