File: ruler-mode.el.html

This library provides a minor mode to display a ruler in the header line.

You can use the mouse to change the fill-column comment-column, goal-column, window-margins and tab-stop-list settings:

[header-line (shift down-mouse-1)] set left margin end to the ruler
graduation where the mouse pointer is on.

[header-line (shift down-mouse-3)] set right margin beginning to
the ruler graduation where the mouse pointer is on.

[header-line down-mouse-2] Drag the fill-column, comment-column
or goal-column to a ruler graduation.

[header-line (control down-mouse-1)] add a tab stop to the ruler
graduation where the mouse pointer is on.

[header-line (control down-mouse-3)] remove the tab stop at the
ruler graduation where the mouse pointer is on.

[header-line (control down-mouse-2)] or M-x
ruler-mode-toggle-show-tab-stops toggle showing and visually editing tab-stop-list setting. The ruler-mode-show-tab-stops option controls if the ruler shows tab stops by default.

In the ruler the character ruler-mode-current-column-char shows the current-column location, ruler-mode-fill-column-char shows the fill-column location, ruler-mode-comment-column-char shows the comment-column location, ruler-mode-goal-column-char shows the goal-column and ruler-mode-tab-stop-char shows tab stop locations. Graduations in window-margins and window-fringes areas are shown with a different foreground color.

It is also possible to customize the following characters:

- ruler-mode-basic-graduation-char character used for basic
  graduations ('.' by default).
- ruler-mode-inter-graduation-char character used for
  intermediate graduations ('!' by default).

The following faces are customizable:

- ruler-mode-default the ruler default face.
- ruler-mode-fill-column the face used to highlight the
  fill-column character.
- ruler-mode-comment-column the face used to highlight the
  comment-column character.
- ruler-mode-goal-column the face used to highlight the
  goal-column character.
- ruler-mode-current-column the face used to highlight the
  current-column character.
- ruler-mode-tab-stop the face used to highlight tab stop
  characters.
- ruler-mode-margins the face used to highlight graduations
  in the window-margins areas.
- ruler-mode-fringes the face used to highlight graduations
  in the window-fringes areas.
- ruler-mode-column-number the face used to highlight the
  numbered graduations.

ruler-mode-default inherits from the built-in default face. All ruler-mode(var)/ruler-mode(fun) faces inherit from ruler-mode-default.

WARNING: To keep ruler graduations aligned on text columns it is important to use the same font family and size for ruler and text areas.

You can override the ruler format by defining an appropriate function as the buffer-local value of ruler-mode-ruler-function.

Installation

To automatically display the ruler in specific major modes use:

   (add-hook '<major-mode>-hook 'ruler-mode)

Defined variables (24)

ruler-modeNon-nil if Ruler mode is enabled.
ruler-mode-basic-graduation-charCharacter used for basic graduations.
ruler-mode-comment-column-charCharacter used at the ‘comment-column’ location.
ruler-mode-comment-column-help-echoHelp string shown when mouse is on the comment column character.
ruler-mode-current-column-charCharacter used at the ‘current-column’ location.
ruler-mode-dragged-symbolColumn symbol dragged in the ruler.
ruler-mode-fill-column-charCharacter used at the ‘fill-column’ location.
ruler-mode-fill-column-help-echoHelp string shown when mouse is on the fill column character.
ruler-mode-fringe-help-echoHelp string shown when mouse is over a fringe area.
ruler-mode-goal-column-charCharacter used at the ‘goal-column’ location.
ruler-mode-goal-column-help-echoHelp string shown when mouse is on the goal column character.
ruler-mode-header-line-format‘header-line-format’ used in ruler mode.
ruler-mode-header-line-format-oldHold previous value of ‘header-line-format’.
ruler-mode-hookHook run after entering or leaving ‘ruler-mode’.
ruler-mode-inter-graduation-charCharacter used for intermediate graduations.
ruler-mode-mapKeymap for ‘ruler-mode’.
ruler-mode-margin-help-echoHelp string shown when mouse is over a margin area.
ruler-mode-ruler-functionFunction to call to return ruler header line format.
ruler-mode-ruler-help-echoHelp string shown when mouse is over the ruler.
ruler-mode-ruler-help-echo-when-goal-columnHelp string shown when mouse is over the ruler.
ruler-mode-ruler-help-echo-when-tab-stopsHelp string shown when mouse is over the ruler.
ruler-mode-set-goal-column-ding-flagNon-nil means do ‘ding’ when ‘goal-column’ is set.
ruler-mode-show-tab-stopsIf non-nil the ruler shows tab stop positions.
ruler-mode-tab-stop-charCharacter used at ‘tab-stop-list’ locations.

Defined functions (18)

ruler--save-header-line-format()
ruler-mode(&optional ARG)
ruler-mode-character-validate(WIDGET)
ruler-mode-full-window-width()
ruler-mode-mouse-add-tab-stop(START-EVENT)
ruler-mode-mouse-del-tab-stop(START-EVENT)
ruler-mode-mouse-drag-any-column(START-EVENT)
ruler-mode-mouse-drag-any-column-iteration(WINDOW)
ruler-mode-mouse-grab-any-column(START-EVENT)
ruler-mode-mouse-set-left-margin(START-EVENT)
ruler-mode-mouse-set-right-margin(START-EVENT)
ruler-mode-ruler()
ruler-mode-space(WIDTH &rest PROPS)
ruler-mode-text-scaled-width(WIDTH)
ruler-mode-text-scaled-window-hscroll()
ruler-mode-text-scaled-window-width()
ruler-mode-toggle-show-tab-stops()
ruler-mode-window-col(EVENT)

Defined faces (10)

ruler-mode-column-numberFace used to highlight number graduations.
ruler-mode-comment-columnFace used to highlight the comment column character.
ruler-mode-current-columnFace used to highlight the ‘current-column’ character.
ruler-mode-defaultDefault face used by the ruler.
ruler-mode-fill-columnFace used to highlight the fill column character.
ruler-mode-fringesFace used to highlight fringes areas.
ruler-mode-goal-columnFace used to highlight the goal column character.
ruler-mode-marginsFace used to highlight margin areas.
ruler-mode-padFace used to pad inactive ruler areas.
ruler-mode-tab-stopFace used to highlight tab stop characters.