Ads by Google

Saturday, August 23, 2008

Understanding Emacs Mark and Point

Another terminology which brings some form of confusion to newbies is the term Mark and Point used in the manual and in descriptions of Emacs editing actions. Truth to be told, I too just had a fuzzy idea what mark was all about when I first started and took point to be where ever the cursor was currently.

Well, point is exactly that; it is the current position of the cursor on your Emacs buffer. And it's there in the Emacs Tutorial too.

The location of the cursor in the text is also called "point". To paraphrase, the cursor shows on the screen where point is located in the text.

So, what is mark, then?

Mark is the equivalent of dropping anchor or "marking" the start of a position in a buffer. One marks a position in the buffer and then moves the cursor to another point, delimiting a region. Thus, mark is primarily used to delineate a contiguous region of text in conjunction with point. The text between the mark and the point is the region where one can operate Emacs commands if needed.

Is there an order to mark and point?

No, from the manual

The ends of the region are always point and the mark. It doesn't matter which of them was put in its current place first, or which one comes earlier in the text--the region starts from point or the mark (whichever comes first), and ends at point or the mark (whichever comes last). Every time you move point, or set the mark in a new place, the region changes.

Now, I suggest you hit the manual link above to know everything one needs to know about mark, mark ring and traversing marks.

No comments: