Question

I was wondering how to implement a command on a region when highlighted if it starts with Ctrl+C when Cua bindings are on.

For example, I want to highlight like four lines of text in LaTeX mode and run the command Ctrl+C Ctrl+f Ctrl+b which changes the text to bold or italics. With cua bindings on it copies the region immediately, is there a way to select region after the mark has been set and say run the commmand on this region to operate correctly in this case. If you just run the command straight after setting the mark it puts the command in place not on the region.

Not sure if this is possible but I like the cua binding and only do the above occasionally but was just wondering or if the easiest thing is removing the cua binding.

Note: I realized with the below set that it works correctly because it doesn't deactivate the region with a copy and actually continues commands and doesn't stop at Ctrl+C like with it turned off. Is it possible to do something similar without setting keep region after copy?

(setq cua-keep-region-after-copy t) 
Was it helpful?

Solution 2

This has to due with the speed you press another key after pressing a cua key binding. If highlighted any you press a key binding with a cua binded key really fast it will activate the command on the region. I think the default is like 0.2 seconds or something relatively fast. The variable that changes this if you want to set it longer or slower:

cua-prefix-override-inhibit-delay:

If non-nil, time in seconds to delay before overriding prefix key. If there is additional input within this time, the prefix key is used as a normal prefix key. So typing a key sequence quickly will inhibit overriding the prefix key. As a special case, if the prefix keys repeated within this time, the first prefix key is discarded, so typing a prefix key twice in quick succession will also inhibit overriding the prefix key. If the value is nil, use a shifted prefix key to inhibit the override.

OTHER TIPS

You can use cua-exchange-point-and-mark with a prefix argument like this:

[cursor]this is a simple test in latex-mode

C-space (set the mark)

C-e (goes to the end of the line)

this is a simple test in latex-mode[cursor]

C-c (copy the text)

C-uC-xC-x (exchanges point at mark and activates the mark)

C-cC-fC-b

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top