I have been noticing two rather "strange" text elements in Emacs which occur when I copy text. I am certain they signify something/have a special formatting purpose, but I am unable to find anything on the web. The first one is a blue dash and the second one a purple box. Since images are more illuminating here, I have created a screenshot: bizarre text elements

Please forgive me my terrible editing skills.

Does anyone know whether it is possible to find all of these elements (they are recurring) by way of search/replace-string to eliminate them effectively? Otherwiese I cannot include them in LaTeX documents.



@kaushalmodi gave a good answer for finding out what those characters (or even what those display artifacts) are.

If that indicates that they are indeed characters (and not just display artifacts), then you can use command query-replace or replace-string to replace them: just copy the character that you want to replace (select it, then use M-w), and paste (use C-y) to the first prompt of the search-and-replace function. Paste or type the character that you want to replace it with to the second prompt (for the replacement text).

For example, if the character is, say, a Unicode em-dash character (Unicode code point U+2014), then you might want to replace it with an ordinary hyphen character.

If the character is, say, an em dash, then when you put the cursor in front of it and hit C-u C-x = you will see something like this near the bottom of buffer *Help*:

Character code properties: customize what to show
  name: EM DASH
  general-category: Pd (Punctuation, Dash)
  decomposition: (8212) ('—')
  • thank you for your kind help. I have used your suggested method and indeed found out that the bluhe hyphen are "soft hyphen" meanwhile the purple boxes appear to be "No-Break Spaces". Unfortunately, I cannot single them out it seems. If I select one of these and put them into the search/replace query, curiously emacs is unable to find it. For instance, if I copy the short dash and then search it, it finds all sorts of dashes, except for the short dash. Same for the No-Break Space. – miri sueß Jul 7 '15 at 7:17
  • OK, scratch that, the mistake was on my side I mis-copied, it works now, exactly the way you suggested it. Thanks for that! – miri sueß Jul 7 '15 at 10:24

You can figure out what a character is by placing the point on that character and doing M-x describe-character or C-u C-x = (default binding).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.