简体   繁体   中英

Is there a way to set mark and then have characters typed included in the region?

I'm wondering if there is a way in Emacs, that allows the user to call set mark(C-SPC) and then continue typing(and have everything typed included in the region) and then copy(Mw) the typed text?

I guess I'm looking for a way to type text and copy the text in one step.

I hope this makes sense.

C-SPC , type some text, Mw will copy the text you just typed. In Emacs, the region is the area between the mark and the point, it doesn't need to be visible.

The answer by @xuchunyang is almost correct. And by default it is correct.

But there is actually a user option that controls the behavior, mark-even-if-inactive . By default it is t , but if it's value is nil then you will need to use Cx Cx (twice, if you want to put point back where it was), in order to activate the region, before you can use Mw to copy its text to the kill-ring . Ch v mark-even-if-inactive tells you:

mark-even-if-inactive is a variable defined in C source code .

Its value is t

Documentation:

Non- nil means you can use the mark even when inactive.

This option makes a difference in Transient Mark mode. When the option is non- nil , deactivation of the mark turns off region highlighting, but commands that use the mark behave as if the mark were still active.

You can customize this variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM