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-mode | Non-nil if Ruler mode is enabled. |
ruler-mode-basic-graduation-char | Character used for basic graduations. |
ruler-mode-comment-column-char | Character used at the ‘comment-column’ location. |
ruler-mode-comment-column-help-echo | Help string shown when mouse is on the comment column character. |
ruler-mode-current-column-char | Character used at the ‘current-column’ location. |
ruler-mode-dragged-symbol | Column symbol dragged in the ruler. |
ruler-mode-fill-column-char | Character used at the ‘fill-column’ location. |
ruler-mode-fill-column-help-echo | Help string shown when mouse is on the fill column character. |
ruler-mode-fringe-help-echo | Help string shown when mouse is over a fringe area. |
ruler-mode-goal-column-char | Character used at the ‘goal-column’ location. |
ruler-mode-goal-column-help-echo | Help 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-old | Hold previous value of ‘header-line-format’. |
ruler-mode-hook | Hook run after entering or leaving ‘ruler-mode’. |
ruler-mode-inter-graduation-char | Character used for intermediate graduations. |
ruler-mode-map | Keymap for ‘ruler-mode’. |
ruler-mode-margin-help-echo | Help string shown when mouse is over a margin area. |
ruler-mode-ruler-function | Function to call to return ruler header line format. |
ruler-mode-ruler-help-echo | Help string shown when mouse is over the ruler. |
ruler-mode-ruler-help-echo-when-goal-column | Help string shown when mouse is over the ruler. |
ruler-mode-ruler-help-echo-when-tab-stops | Help string shown when mouse is over the ruler. |
ruler-mode-set-goal-column-ding-flag | Non-nil means do ‘ding’ when ‘goal-column’ is set. |
ruler-mode-show-tab-stops | If non-nil the ruler shows tab stop positions. |
ruler-mode-tab-stop-char | Character 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-number | Face used to highlight number graduations. |
ruler-mode-comment-column | Face used to highlight the comment column character. |
ruler-mode-current-column | Face used to highlight the ‘current-column’ character. |
ruler-mode-default | Default face used by the ruler. |
ruler-mode-fill-column | Face used to highlight the fill column character. |
ruler-mode-fringes | Face used to highlight fringes areas. |
ruler-mode-goal-column | Face used to highlight the goal column character. |
ruler-mode-margins | Face used to highlight margin areas. |
ruler-mode-pad | Face used to pad inactive ruler areas. |
ruler-mode-tab-stop | Face used to highlight tab stop characters. |