How to make emacs stop trapping Scroll Lock?

1

I am using a Linux machine with a KVM switch at work, and I commonly use emacs while switching between that machine and my other machine. I typically use the keyboard shortcut to swap between machines on the KVM, which is the key sequence: Scroll Lock, Scroll Lock, Up or Down. If I have an emacs window on top on Linux and hit these buttons, it will trap the Scroll Lock key presses and trigger a system beep from the CPU speaker. The KVM still switches, but on occasion, after the switch, it will register Scroll Lock as being stuck pressed, and so I'll be treated to an earful of system beeping. I have to switch back to the computer to get it to stop.

Is there something I can put in the .emacs file that will prevent the program from beeping when I hit Scroll Lock with the window on top?

Ben Richards

Posted 2011-08-29T23:44:51.277

Reputation: 11 662

Answers

2

This looks like what you're looking for here

either this

(global-set-key (kbd "<Scroll_Lock>") 'ignore)

or this

(global-set-key [scroll-lock] 'ignore)

Depending on the version of emacs

OldWolf

Posted 2011-08-29T23:44:51.277

Reputation: 2 293

Wow, I tried doing a web search but came up dry. That's incredibly specific to my situation. Thanks! I'll try it at work tomorrow and see if it works. – Ben Richards – 2011-08-30T00:17:14.110

Neither of those keybindings worked, so I used the method described in the FAQ here to find it: http://xahlee.org/emacs/keyboard_shortcuts.html. I had to use the first form that you listed, but substitute <Scroll_Lock> with <key-20>. But now it is properly ignored! Thanks!

– Ben Richards – 2011-08-30T17:53:09.460