12

How can we format cursors and marks in examples? I recently answered How to add a prefix to every line?, which illustrated rectangular sections. To make it clearer, I needed to show where the mark and cursor are when you run a command.

I just did it using * for the mark and for the cursor. I'm not entirely happy with it though: * might be ambiguous, and I'm not sure how well renders on other people's machines.

So, is there some good typographical convention to use for cursors and marks?

  • How about this? 【 – Luke Sep 23 '14 at 21:27
  • 4
    The Emacs manual uses -!- to represent the point, but it's constrained by ASCII, I think a non-ASCII character would be better to avoid potential confusion. There's no standard way to represent the mark, and here too a non-ASCII character would be better. – Gilles Sep 23 '14 at 21:48
  • 2
    I can tell you that solid block just rendered as a blank space on my phone. – Malabarba Sep 24 '14 at 8:19
  • 1
    Any Unicode char you choose will also conflict with the same char as part of the text you are trying to represent. IOW, it suffers from the same problem as the -!- used conventionally in Emacs doc. But OK, yes, if you pick a rarely used char then things are less ambiguous. Maybe a Unicode Hello Kitty character or something. ;-) – Drew Sep 26 '14 at 4:14
  • 2
    @Drew: Finally, a use for the 'MAN IN BUSINESS SUIT LEVITATING': 🕴. A shame my current font doesn't support it yet. – Tikhon Jelvis Sep 26 '14 at 4:15
  • @TikhonJelvis: Damn! I had to check it for myself. Codepoint 128372. I doubted you for a second. I too don't yet have a font that shows it/him. – Drew Sep 26 '14 at 4:19
4

I'd use for the point. I never came across a device that could not render it. I have no idea about the mark, though.

I don't think though, that it is really important to agree on a specific character for point or mark. Rather, choose an unambiguous character for the specific code example, and explain it in free text, as in this example:


(defun foo ()
  "bar"
  (if !foo bar_ (error "No foo")))

! signifies the position of the mark, and _ the position of point. In transient mark mode, the region will now extend from ! to _, highlighting foo bar.


Imho this is sufficiently clear.

  • 1
    I can confirm that first char you suggested doesn't render on chrome for android. – Malabarba Sep 24 '14 at 11:02
  • I think ! and _, or ! and §, are unique enough in terms of elisp code. Regardless, we'll always have to explain it plain text anyway, we can't assume some random stranger who lands here will know our conventions. – Malabarba Sep 24 '14 at 11:07
  • 1
    Never mind rendering. How do you type that character? – asmeurer Sep 24 '14 at 19:45
  • 2
    Use the same conventions as are used in Emacs Info. Half of what we are trying to do is get users to be familiar with the conventions of Emacs. Why introduce yet another convention instead of just using the same one Emacs uses to communicate with its users? – Drew Sep 26 '14 at 4:16
  • @Drew ... I sort of thought "introducing yet another convention instead of just using the same one Emacs uses" was the ur-convention of good Emacs use. – purple_arrows Oct 5 '14 at 18:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .