3

From my understanding, Emacs creates a region my setting a mark and then anything between 'mark' and 'point' is the current region. I'm wondering if there is a way to create a region with only marks, freeing up point so I can put my cursor wherever I want and still have a particular region highlighted.

If I am misunderstanding how Emacs works, please let me know.

1 Answer 1

6

(You say "a region", not "the region", so a guess is that you do not really mean the Emacs region.)


If your question is really about the Emacs region then the answer is no. Point (the cursor position) is always at one end of the region, and mark is always at the other end.

See the Emacs manual, node Mark for more information. [I found that node by going to the manual (C-h r) and then asking it to look up region in the index, by using i region).]


If your question is really about just highlighting a sequence of characters then the answer is yes, you can do that, without point and mark needing to be at the ends of the highlighted text. Here are some alternatives:

  1. You can use the secondary selection to highlight a char sequence. And, like the region, you can then yank (aka paste) that selected text anywhere.

    The vanilla way to select the text for the secondary selection is to drag the second mouse button (<mouse-2>). But you can also assign keyboard keys to select and paste the secondary-selection text. If you use library second-sel.el then you get this plus additional secondary-selection features.

  2. There is at most one secondary selection at any given time. But you can highlight multiple sequences of characters and then use those highlighted sequences in various ways. Library Highlight is specifically for this. It gives you many ways to highlight such sequences (including dragging with the mouse, like using a highlighter pen) and many ways to use them.

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.