When I'm using remote X forwarding to run X toolkit emacs and I press C-SPC and move the cursor around, things get very slow. The emacs profiler says all the time is spent in line-move-visual, but I don't think that's it. I think it's an issue with the highlighting being expressed inefficiently at the X layer because it only happens when remoting.

transient-mark-mode help says it uses the region face to decide the color:

Transient Mark mode is a global minor mode. When enabled, the region is highlighted with the region face whenever the mark is active.

But it doesn't indicate there's any way to toggle the rendering. My thinking is I want to throttle how quickly it will highlight (e.g. wait for 50ms of idleness) since usually I'm highlighting several lines or characters and all the intermediate renderings are going to be short lived.

Is there any way to do this? I assume I have to keep the mode active to not affect editing.

  • This slowdown may not be Emacs-related. Try enabling compression in your forwarded connection. If you're using ssh, that's the -C option
    – izkon
    Nov 15, 2020 at 6:29

1 Answer 1


The problem is that in transient mark mode every time you move the cursor at all emacs transmits the entire contents of what you have highlighted in order to put it in the X server clipboard! You can disable the behavior with this:

(setq select-active-regions nil)

Note this prevents pasting based on middle clicking. Ideally this behavior would be better throttled, or the clipboard could be updated incrementally (not sure if the X protocol supports that).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.