EmacsWiki: The Fringe (original) (raw)

The fringe is a thin strip down the left and/or right edge of a window. They can contain glyphs to indicate various things (usually things associated with the same line). For example, they can show where a buffer line has been wrapped over multiple window lines. The ‘fringe’ face controls their appearance (e.g. color).

You can toggle display of fringes on all frames using ‘M-x fringe-mode’ (starting with Emacs 22). You can also set frame parameter ‘left-fringe’ or ‘right-fringe’ to 0, to turn off display of that fringe.

Discussion

How does one programmatically put pointers or similar into the fringe? I know gnus does it, but I couldn’t find out where. Also, I couldn’t find any documentation for this behaviour in the EmacsLispReference. – AndreasFuchs

The variables of interest are overlay-arrow-position and overlay-arrow-string. In the top level of the EmacsLispReference there is also a node called “Overlay Arrow” that describes this. – SatyakiDas

Is there any documentation at all for using the fringe programmatically? User documentation (fringe off and on) is there, but I am missing documentation about having it do anything for me, like in the gnus Summary buffer --AndreasFuchs

Personally I really like the fringe, with ‘default-indicate-empty-lines’ set to t it becomes very handy in most buffers. As to the question of patching emacs to remove the fringe, it is my understanding that it will be an optional feature in the next non-bugfix release (or, if you want it now, you can pull the latest sources from EmacsFromCVS). – DavePearson

Turning off the fringe was the first thing I did. Because I use OneOnOneEmacs I never have wrapped lines anyway (frames fit their buffers), so fringe is just wasted real estate. – DrewAdams

Is there a way to get the “\” end-of-line behavior in X? The little bars on the left and right with arrows showing where text overflows the width of the window are nice, but they take up too much space. – DanDebertin

While it’s not really an answer to your question, you can make the fringes smaller (like what calling it interactively and telling it to be “minimal” does) with (set-fringe-mode ‘(1 . 1)) which makes the fringe 1px large on each side - enough to see wraps, but small enough to not waste screen real estate. --JohanBusk

Here’s a primitive example of using the fringe to show the location of the mark, by simply setting ‘overlay-arrow-position’ to a marker that is at the beginning of the line for the mark.

(defvar ash-mark-bol (save-excursion (goto-char (or (mark) (point))) (forward-line 0) (point-marker)) "Marker from beginning-of-line' for for mark'.")

(defun ash-mark-hook-fun () "Run with `activate-mark-hook'." (let ((mark-bol-posn (save-excursion (goto-char (mark)) (forward-line 0) (point)))) (if (markerp ash-mark-bol) (set-marker ash-mark-bol mark-bol-posn) (setq ash-mark-bol (save-excursion (goto-char mark-bol-posn) (point-marker))))))

(add-to-list 'activate-mark-hook 'ash-mark-hook-fun) (setq overlay-arrow-position ash-mark-bol)

This will, however, show an arrow in the fringe and confuse users of various Emacs debugging modes.

See also, RFringe, which displays a dash in the fringe to indicate a buffer-relative position. --DinoChiesa, 5 April 2011


CategoryDisplay CategoryGlossary