Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide/change Emacs fringe bent arrows due to word wrapping?

I would like to change (or hide entirely) the "bent arrow" character that appears in the Emacs fringe (both on the left and right hand side). I'm using Emacs 24 on a Mac, installed via homebrew. I find it to be visually distracting. A smaller character, like a center dot, might work well.

For context, this is an official description of the small bent arrows (from http://www.gnu.org/software/emacs/manual/html_node/emacs/Continuation-Lines.html):

Sometimes, a line of text in the buffer—a logical line—is too long to fit in the window, and Emacs displays it as two or more screen lines. This is called line wrapping or continuation, and the long logical line is called a continued line. On a graphical display, Emacs indicates line wrapping with small bent arrows in the left and right window fringes. On a text terminal, Emacs indicates line wrapping by displaying a ‘\’ character at the right margin.

The Emacs LineWrap Wiki page does not address my question.

The best information I've found so far is contained in this StackOverflow answer:

When word-wrap is set to nil in a text terminal (-nw) Emacs, the backslash character appears on the right margin.

When word-wrap is set to t in a text terminal Emacs, the backslash character is not shown. Setting visual-line-mode also sets word-wrap to true.

This does not apply when Emacs is running as a GUI window: the small bent arrow appears on the right margin regardless of the value of word-wrap.

Is hiding or changing the bent arrows possible? If not, an answer that says, more or less, "I've looked at X and concluded that it is impossible" is ok too.

Update: Although it is not a terrible work-around, changing the fringes is not what I'm looking for: I want to customize the "bent arrow" character or bitmap.

like image 207
David J. Avatar asked Mar 18 '23 23:03

David J.


1 Answers

First, some quick context. From Emacs Fringe Bitmaps: "Fringe indicators are tiny icons displayed in the window fringe to indicate truncated or continued lines, buffer boundaries, etc."

You cannot replace the curly arrow with arbitrary text. According to lunaryorn's answer to "Is It Possible To Replace Fringe Bitmaps With Text in Emacs?":

No, it is not. Fringe “bitmaps” are really bitmaps, that is vectors of 0/1 bits, overlayed over the fringe. There is no way to directly render arbitrary unicode characters onto the fringe. [...] What you can do, is to render a unicode character into a 0/1 bitmap yourself.

Like it says, you can change the bitmap. Fringe Bitmaps contains a list of fringe bitmaps; left-curly-arrow and right-curly-arrow are the ones relevant for this question.

Here is what I drew up. Adjust to your liking. Put this in your Emacs init file.

(define-fringe-bitmap 'right-curly-arrow
  [#b00000000
   #b00000000
   #b00000000
   #b00000000
   #b01110000
   #b00010000
   #b00010000
   #b00000000])
(define-fringe-bitmap 'left-curly-arrow
  [#b00000000
   #b00001000
   #b00001000
   #b00001110
   #b00000000
   #b00000000
   #b00000000
   #b00000000])

More documentation is available at Customizing Bitmaps, including set-fringe-bitmap-face which "sets the face for the fringe. If face is nil, it selects the fringe face. The bitmap's face controls the color to draw it in".

like image 88
David J. Avatar answered Mar 23 '23 03:03

David J.