annotate lisp/ruler-mode.el @ 64299:840e01598f66

(custom-initialize-safe-set, custom-initialize-safe-default): Doc fixes.
author Luc Teirlinck <teirllm@auburn.edu>
date Thu, 14 Jul 2005 01:01:37 +0000
parents 6fb026ad601f
children fb2cad4cfb30 f9a65d7ebd29
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
42836
c6bcb27e426f (ruler-mode): New keyword. Fix :version.
Pavel Janík <Pavel@Janik.cz>
parents: 42706
diff changeset
1 ;;; ruler-mode.el --- display a ruler in the header line
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
4
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5 ;; Author: David Ponce <david@dponce.com>
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6 ;; Maintainer: David Ponce <david@dponce.com>
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7 ;; Created: 24 Mar 2001
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
8 ;; Version: 1.6
47183
865837df3fe7 (defgroup ruler-mode): Use `convenience' as parent.
Richard M. Stallman <rms@gnu.org>
parents: 45255
diff changeset
9 ;; Keywords: convenience
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 ;; This program is free software; you can redistribute it and/or
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 ;; modify it under the terms of the GNU General Public License as
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; published by the Free Software Foundation; either version 2, or (at
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16 ;; your option) any later version.
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; This program is distributed in the hope that it will be useful, but
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21 ;; General Public License for more details.
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24 ;; along with this program; see the file COPYING. If not, write to
64091
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63201
diff changeset
25 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63201
diff changeset
26 ;; Boston, MA 02110-1301, USA.
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28 ;;; Commentary:
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30 ;; This library provides a minor mode to display a ruler in the header
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 ;; line. It works only on Emacs 21.
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32 ;;
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
33 ;; You can use the mouse to change the `fill-column' `comment-column',
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
34 ;; `goal-column', `window-margins' and `tab-stop-list' settings:
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35 ;;
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
36 ;; [header-line (shift down-mouse-1)] set left margin end to the ruler
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37 ;; graduation where the mouse pointer is on.
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38 ;;
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
39 ;; [header-line (shift down-mouse-3)] set right margin beginning to
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
40 ;; the ruler graduation where the mouse pointer is on.
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41 ;;
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
42 ;; [header-line down-mouse-2] Drag the `fill-column', `comment-column'
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
43 ;; or `goal-column' to a ruler graduation.
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
44 ;;
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45 ;; [header-line (control down-mouse-1)] add a tab stop to the ruler
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46 ;; graduation where the mouse pointer is on.
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 ;;
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48 ;; [header-line (control down-mouse-3)] remove the tab stop at the
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49 ;; ruler graduation where the mouse pointer is on.
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 ;;
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 ;; [header-line (control down-mouse-2)] or M-x
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 ;; `ruler-mode-toggle-show-tab-stops' toggle showing and visually
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 ;; editing `tab-stop-list' setting. The `ruler-mode-show-tab-stops'
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 ;; option controls if the ruler shows tab stops by default.
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 ;;
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56 ;; In the ruler the character `ruler-mode-current-column-char' shows
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57 ;; the `current-column' location, `ruler-mode-fill-column-char' shows
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
58 ;; the `fill-column' location, `ruler-mode-comment-column-char' shows
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
59 ;; the `comment-column' location, `ruler-mode-goal-column-char' shows
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
60 ;; the `goal-column' and `ruler-mode-tab-stop-char' shows tab stop
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
61 ;; locations. Graduations in `window-margins' and `window-fringes'
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
62 ;; areas are shown with a different foreground color.
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63 ;;
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 ;; It is also possible to customize the following characters:
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65 ;;
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66 ;; - `ruler-mode-basic-graduation-char' character used for basic
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67 ;; graduations ('.' by default).
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 ;; - `ruler-mode-inter-graduation-char' character used for
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 ;; intermediate graduations ('!' by default).
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70 ;;
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71 ;; The following faces are customizable:
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 ;;
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
73 ;; - `ruler-mode-default' the ruler default face.
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
74 ;; - `ruler-mode-fill-column' the face used to highlight the
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75 ;; `fill-column' character.
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
76 ;; - `ruler-mode-comment-column' the face used to highlight the
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
77 ;; `comment-column' character.
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
78 ;; - `ruler-mode-goal-column' the face used to highlight the
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
79 ;; `goal-column' character.
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
80 ;; - `ruler-mode-current-column' the face used to highlight the
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 ;; `current-column' character.
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
82 ;; - `ruler-mode-tab-stop' the face used to highlight tab stop
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 ;; characters.
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
84 ;; - `ruler-mode-margins' the face used to highlight graduations
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
85 ;; in the `window-margins' areas.
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
86 ;; - `ruler-mode-fringes' the face used to highlight graduations
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
87 ;; in the `window-fringes' areas.
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
88 ;; - `ruler-mode-column-number' the face used to highlight the
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
89 ;; numbered graduations.
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 ;;
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
91 ;; `ruler-mode-default' inherits from the built-in `default' face.
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
92 ;; All `ruler-mode' faces inherit from `ruler-mode-default'.
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 ;;
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
94 ;; WARNING: To keep ruler graduations aligned on text columns it is
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95 ;; important to use the same font family and size for ruler and text
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96 ;; areas.
54399
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52889
diff changeset
97 ;;
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
98 ;; You can override the ruler format by defining an appropriate
54399
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52889
diff changeset
99 ;; function as the buffer-local value of `ruler-mode-ruler-function'.
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 ;; Installation
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 ;;
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 ;; To automatically display the ruler in specific major modes use:
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 ;;
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 ;; (add-hook '<major-mode>-hook 'ruler-mode)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106 ;;
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
107
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
108 ;;; History:
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 ;;
41461
5507024cc13c Add pagination.
Richard M. Stallman <rms@gnu.org>
parents: 39731
diff changeset
110
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 ;;; Code:
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 (eval-when-compile
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 (require 'wid-edit))
54399
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52889
diff changeset
114 (require 'scroll-bar)
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52889
diff changeset
115 (require 'fringe)
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
117 (defgroup ruler-mode nil
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
118 "Display a ruler in the header line."
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 54440
diff changeset
119 :version "22.1"
47183
865837df3fe7 (defgroup ruler-mode): Use `convenience' as parent.
Richard M. Stallman <rms@gnu.org>
parents: 45255
diff changeset
120 :group 'convenience)
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
122 (defcustom ruler-mode-show-tab-stops nil
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123 "*If non-nil the ruler shows tab stop positions.
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
124 Also allowing to visually change `tab-stop-list' setting using
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125 <C-down-mouse-1> and <C-down-mouse-3> on the ruler to respectively add
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
126 or remove a tab stop. \\[ruler-mode-toggle-show-tab-stops] or
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 <C-down-mouse-2> on the ruler toggles showing/editing of tab stops."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
128 :group 'ruler-mode
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
129 :type 'boolean)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
130
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 ;; IMPORTANT: This function must be defined before the following
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
132 ;; defcustoms because it is used in their :validate clause.
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 (defun ruler-mode-character-validate (widget)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
134 "Ensure WIDGET value is a valid character value."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135 (save-excursion
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136 (let ((value (widget-value widget)))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
137 (if (char-valid-p value)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
138 nil
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
139 (widget-put widget :error
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
140 (format "Invalid character value: %S" value))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
141 widget))))
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
142
52430
8ab45ba34207 (ruler-mode-fill-column-char)
Dave Love <fx@gnu.org>
parents: 52401
diff changeset
143 (defcustom ruler-mode-fill-column-char (if (char-displayable-p ?¶)
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
144 ?\¶
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
145 ?\|)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
146 "*Character used at the `fill-column' location."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
147 :group 'ruler-mode
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
148 :type '(choice
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
149 (character :tag "Character")
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
150 (integer :tag "Integer char value"
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
151 :validate ruler-mode-character-validate)))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
152
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
153 (defcustom ruler-mode-comment-column-char ?\#
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
154 "*Character used at the `comment-column' location."
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
155 :group 'ruler-mode
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
156 :type '(choice
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
157 (character :tag "Character")
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
158 (integer :tag "Integer char value"
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
159 :validate ruler-mode-character-validate)))
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
160
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
161 (defcustom ruler-mode-goal-column-char ?G
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
162 "*Character used at the `goal-column' location."
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
163 :group 'ruler-mode
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
164 :type '(choice
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
165 (character :tag "Character")
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
166 (integer :tag "Integer char value"
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
167 :validate ruler-mode-character-validate)))
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
168
52430
8ab45ba34207 (ruler-mode-fill-column-char)
Dave Love <fx@gnu.org>
parents: 52401
diff changeset
169 (defcustom ruler-mode-current-column-char (if (char-displayable-p ?¦)
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
170 ?\¦
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
171 ?\@)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
172 "*Character used at the `current-column' location."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
173 :group 'ruler-mode
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
174 :type '(choice
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
175 (character :tag "Character")
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
176 (integer :tag "Integer char value"
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
177 :validate ruler-mode-character-validate)))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
178
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
179 (defcustom ruler-mode-tab-stop-char ?\T
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
180 "*Character used at `tab-stop-list' locations."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
181 :group 'ruler-mode
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
182 :type '(choice
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
183 (character :tag "Character")
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
184 (integer :tag "Integer char value"
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
185 :validate ruler-mode-character-validate)))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
186
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
187 (defcustom ruler-mode-basic-graduation-char ?\.
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
188 "*Character used for basic graduations."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
189 :group 'ruler-mode
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
190 :type '(choice
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
191 (character :tag "Character")
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
192 (integer :tag "Integer char value"
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
193 :validate ruler-mode-character-validate)))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
194
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
195 (defcustom ruler-mode-inter-graduation-char ?\!
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
196 "*Character used for intermediate graduations."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
197 :group 'ruler-mode
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
198 :type '(choice
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
199 (character :tag "Character")
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
200 (integer :tag "Integer char value"
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
201 :validate ruler-mode-character-validate)))
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
202
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
203 (defcustom ruler-mode-set-goal-column-ding-flag t
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
204 "*Non-nil means do `ding' when `goal-column' is set."
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
205 :group 'ruler-mode
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
206 :type 'boolean)
41461
5507024cc13c Add pagination.
Richard M. Stallman <rms@gnu.org>
parents: 39731
diff changeset
207
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
208 (defface ruler-mode-default
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
209 '((((type tty))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
210 (:inherit default
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
211 :background "grey64"
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
212 :foreground "grey50"
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
213 ))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
214 (t
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
215 (:inherit default
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
216 :background "grey76"
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
217 :foreground "grey64"
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
218 :box (:color "grey76"
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
219 :line-width 1
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
220 :style released-button)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
221 )))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
222 "Default face used by the ruler."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
223 :group 'ruler-mode)
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
224 ;; backward-compatibility alias
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
225 (put 'ruler-mode-default-face 'face-alias 'ruler-mode-default)
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
226
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
227 (defface ruler-mode-pad
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
228 '((((type tty))
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
229 (:inherit ruler-mode-default
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
230 :background "grey50"
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
231 ))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
232 (t
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
233 (:inherit ruler-mode-default
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
234 :background "grey64"
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
235 )))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
236 "Face used to pad inactive ruler areas."
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
237 :group 'ruler-mode)
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
238 ;; backward-compatibility alias
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
239 (put 'ruler-mode-pad-face 'face-alias 'ruler-mode-pad)
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
240
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
241 (defface ruler-mode-margins
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
242 '((t
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
243 (:inherit ruler-mode-default
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
244 :foreground "white"
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
245 )))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
246 "Face used to highlight margin areas."
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
247 :group 'ruler-mode)
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
248 ;; backward-compatibility alias
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
249 (put 'ruler-mode-margins-face 'face-alias 'ruler-mode-margins)
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
250
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
251 (defface ruler-mode-fringes
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
252 '((t
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
253 (:inherit ruler-mode-default
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
254 :foreground "green"
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
255 )))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
256 "Face used to highlight fringes areas."
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
257 :group 'ruler-mode)
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
258 ;; backward-compatibility alias
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
259 (put 'ruler-mode-fringes-face 'face-alias 'ruler-mode-fringes)
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
260
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
261 (defface ruler-mode-column-number
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
262 '((t
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
263 (:inherit ruler-mode-default
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
264 :foreground "black"
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
265 )))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
266 "Face used to highlight number graduations."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
267 :group 'ruler-mode)
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
268 ;; backward-compatibility alias
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
269 (put 'ruler-mode-column-number-face 'face-alias 'ruler-mode-column-number)
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
270
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
271 (defface ruler-mode-fill-column
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
272 '((t
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
273 (:inherit ruler-mode-default
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
274 :foreground "red"
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
275 )))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
276 "Face used to highlight the fill column character."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
277 :group 'ruler-mode)
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
278 ;; backward-compatibility alias
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
279 (put 'ruler-mode-fill-column-face 'face-alias 'ruler-mode-fill-column)
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
280
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
281 (defface ruler-mode-comment-column
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
282 '((t
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
283 (:inherit ruler-mode-default
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
284 :foreground "red"
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
285 )))
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
286 "Face used to highlight the comment column character."
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
287 :group 'ruler-mode)
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
288 ;; backward-compatibility alias
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
289 (put 'ruler-mode-comment-column-face 'face-alias 'ruler-mode-comment-column)
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
290
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
291 (defface ruler-mode-goal-column
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
292 '((t
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
293 (:inherit ruler-mode-default
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
294 :foreground "red"
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
295 )))
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
296 "Face used to highlight the goal column character."
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
297 :group 'ruler-mode)
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
298 ;; backward-compatibility alias
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
299 (put 'ruler-mode-goal-column-face 'face-alias 'ruler-mode-goal-column)
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
300
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
301 (defface ruler-mode-tab-stop
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
302 '((t
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
303 (:inherit ruler-mode-default
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
304 :foreground "steelblue"
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
305 )))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
306 "Face used to highlight tab stop characters."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
307 :group 'ruler-mode)
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
308 ;; backward-compatibility alias
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
309 (put 'ruler-mode-tab-stop-face 'face-alias 'ruler-mode-tab-stop)
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
310
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
311 (defface ruler-mode-current-column
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
312 '((t
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
313 (:inherit ruler-mode-default
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
314 :weight bold
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
315 :foreground "yellow"
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
316 )))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
317 "Face used to highlight the `current-column' character."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
318 :group 'ruler-mode)
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
319 ;; backward-compatibility alias
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
320 (put 'ruler-mode-current-column-face 'face-alias 'ruler-mode-current-column)
41461
5507024cc13c Add pagination.
Richard M. Stallman <rms@gnu.org>
parents: 39731
diff changeset
321
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
322
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
323 (defsubst ruler-mode-full-window-width ()
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
324 "Return the full width of the selected window."
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
325 (let ((edges (window-edges)))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
326 (- (nth 2 edges) (nth 0 edges))))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
327
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
328 (defsubst ruler-mode-window-col (n)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
329 "Return a column number relative to the selected window.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
330 N is a column number relative to selected frame."
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
331 (- n
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
332 (car (window-edges))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
333 (or (car (window-margins)) 0)
54401
7f6dab15e141 2004-03-15 David Ponce <david@dponce.com>
Masatake YAMATO <jet@gyve.org>
parents: 54399
diff changeset
334 (fringe-columns 'left)
7f6dab15e141 2004-03-15 David Ponce <david@dponce.com>
Masatake YAMATO <jet@gyve.org>
parents: 54399
diff changeset
335 (scroll-bar-columns 'left)))
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
336
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
337 (defun ruler-mode-mouse-set-left-margin (start-event)
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
338 "Set left margin end to the graduation where the mouse pointer is on.
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
339 START-EVENT is the mouse click event."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
340 (interactive "e")
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
341 (let* ((start (event-start start-event))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
342 (end (event-end start-event))
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
343 col w lm rm)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
344 (when (eq start end) ;; mouse click
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
345 (save-selected-window
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
346 (select-window (posn-window start))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
347 (setq col (- (car (posn-col-row start)) (car (window-edges))
54401
7f6dab15e141 2004-03-15 David Ponce <david@dponce.com>
Masatake YAMATO <jet@gyve.org>
parents: 54399
diff changeset
348 (scroll-bar-columns 'left))
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
349 w (- (ruler-mode-full-window-width)
54401
7f6dab15e141 2004-03-15 David Ponce <david@dponce.com>
Masatake YAMATO <jet@gyve.org>
parents: 54399
diff changeset
350 (scroll-bar-columns 'left)
7f6dab15e141 2004-03-15 David Ponce <david@dponce.com>
Masatake YAMATO <jet@gyve.org>
parents: 54399
diff changeset
351 (scroll-bar-columns 'right)))
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
352 (when (and (>= col 0) (< col w))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
353 (setq lm (window-margins)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
354 rm (or (cdr lm) 0)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
355 lm (or (car lm) 0))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
356 (message "Left margin set to %d (was %d)" col lm)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
357 (set-window-margins nil col rm))))))
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
358
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
359 (defun ruler-mode-mouse-set-right-margin (start-event)
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
360 "Set right margin beginning to the graduation where the mouse pointer is on.
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
361 START-EVENT is the mouse click event."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
362 (interactive "e")
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
363 (let* ((start (event-start start-event))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
364 (end (event-end start-event))
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
365 col w lm rm)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
366 (when (eq start end) ;; mouse click
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
367 (save-selected-window
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
368 (select-window (posn-window start))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
369 (setq col (- (car (posn-col-row start)) (car (window-edges))
54401
7f6dab15e141 2004-03-15 David Ponce <david@dponce.com>
Masatake YAMATO <jet@gyve.org>
parents: 54399
diff changeset
370 (scroll-bar-columns 'left))
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
371 w (- (ruler-mode-full-window-width)
54401
7f6dab15e141 2004-03-15 David Ponce <david@dponce.com>
Masatake YAMATO <jet@gyve.org>
parents: 54399
diff changeset
372 (scroll-bar-columns 'left)
7f6dab15e141 2004-03-15 David Ponce <david@dponce.com>
Masatake YAMATO <jet@gyve.org>
parents: 54399
diff changeset
373 (scroll-bar-columns 'right)))
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
374 (when (and (>= col 0) (< col w))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
375 (setq lm (window-margins)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
376 rm (or (cdr lm) 0)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
377 lm (or (car lm) 0)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
378 col (- w col 1))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
379 (message "Right margin set to %d (was %d)" col rm)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
380 (set-window-margins nil lm col))))))
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
381
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
382 (defvar ruler-mode-dragged-symbol nil
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
383 "Column symbol dragged in the ruler.
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
384 That is `fill-column', `comment-column', `goal-column', or nil when
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
385 nothing is dragged.")
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
386
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
387 (defun ruler-mode-mouse-grab-any-column (start-event)
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
388 "Drag a column symbol on the ruler.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
389 Start dragging on mouse down event START-EVENT, and update the column
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
390 symbol value with the current value of the ruler graduation while
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
391 dragging. See also the variable `ruler-mode-dragged-symbol'."
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
392 (interactive "e")
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
393 (setq ruler-mode-dragged-symbol nil)
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
394 (let* ((start (event-start start-event))
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
395 col newc oldc)
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
396 (save-selected-window
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
397 (select-window (posn-window start))
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
398 (setq col (ruler-mode-window-col (car (posn-col-row start)))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
399 newc (+ col (window-hscroll)))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
400 (and
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
401 (>= col 0) (< col (window-width))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
402 (cond
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
403
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
404 ;; Handle the fill column.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
405 ((eq newc fill-column)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
406 (setq oldc fill-column
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
407 ruler-mode-dragged-symbol 'fill-column)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
408 t) ;; Start dragging
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
409
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
410 ;; Handle the comment column.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
411 ((eq newc comment-column)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
412 (setq oldc comment-column
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
413 ruler-mode-dragged-symbol 'comment-column)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
414 t) ;; Start dragging
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
415
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
416 ;; Handle the goal column.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
417 ;; A. On mouse down on the goal column character on the ruler,
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
418 ;; update the `goal-column' value while dragging.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
419 ;; B. If `goal-column' is nil, set the goal column where the
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
420 ;; mouse is clicked.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
421 ;; C. On mouse click on the goal column character on the
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
422 ;; ruler, unset the goal column.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
423 ((eq newc goal-column) ; A. Drag the goal column.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
424 (setq oldc goal-column
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
425 ruler-mode-dragged-symbol 'goal-column)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
426 t) ;; Start dragging
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
427
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
428 ((null goal-column) ; B. Set the goal column.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
429 (setq oldc goal-column
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
430 goal-column newc)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
431 ;; mouse-2 coming AFTER drag-mouse-2 invokes `ding'. This
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
432 ;; `ding' flushes the next messages about setting goal
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
433 ;; column. So here I force fetch the event(mouse-2) and
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
434 ;; throw away.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
435 (read-event)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
436 ;; Ding BEFORE `message' is OK.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
437 (when ruler-mode-set-goal-column-ding-flag
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
438 (ding))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
439 (message "Goal column set to %d (click on %s again to unset it)"
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
440 newc
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
441 (propertize (char-to-string ruler-mode-goal-column-char)
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
442 'face 'ruler-mode-goal-column))
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
443 nil) ;; Don't start dragging.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
444 )
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
445 (if (eq 'click (ruler-mode-mouse-drag-any-column-iteration
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
446 (posn-window start)))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
447 (when (eq 'goal-column ruler-mode-dragged-symbol)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
448 ;; C. Unset the goal column.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
449 (set-goal-column t))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
450 ;; At end of dragging, report the updated column symbol.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
451 (message "%s is set to %d (was %d)"
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
452 ruler-mode-dragged-symbol
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
453 (symbol-value ruler-mode-dragged-symbol)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
454 oldc))))))
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
455
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
456 (defun ruler-mode-mouse-drag-any-column-iteration (window)
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
457 "Update the ruler while dragging the mouse.
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
458 WINDOW is the window where occurred the last down-mouse event.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
459 Return the symbol `drag' if the mouse has been dragged, or `click' if
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
460 the mouse has been clicked."
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
461 (let ((drags 0)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
462 event)
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
463 (track-mouse
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
464 (while (mouse-movement-p (setq event (read-event)))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
465 (setq drags (1+ drags))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
466 (when (eq window (posn-window (event-end event)))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
467 (ruler-mode-mouse-drag-any-column event)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
468 (force-mode-line-update))))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
469 (if (and (zerop drags) (eq 'click (car (event-modifiers event))))
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
470 'click
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
471 'drag)))
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
472
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
473 (defun ruler-mode-mouse-drag-any-column (start-event)
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
474 "Update the value of the symbol dragged on the ruler.
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
475 Called on each mouse motion event START-EVENT."
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
476 (let* ((start (event-start start-event))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
477 (end (event-end start-event))
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
478 col newc)
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
479 (save-selected-window
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
480 (select-window (posn-window start))
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
481 (setq col (ruler-mode-window-col (car (posn-col-row end)))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
482 newc (+ col (window-hscroll)))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
483 (when (and (>= col 0) (< col (window-width)))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
484 (set ruler-mode-dragged-symbol newc)))))
41461
5507024cc13c Add pagination.
Richard M. Stallman <rms@gnu.org>
parents: 39731
diff changeset
485
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
486 (defun ruler-mode-mouse-add-tab-stop (start-event)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
487 "Add a tab stop to the graduation where the mouse pointer is on.
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
488 START-EVENT is the mouse click event."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
489 (interactive "e")
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
490 (when ruler-mode-show-tab-stops
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
491 (let* ((start (event-start start-event))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
492 (end (event-end start-event))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
493 col ts)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
494 (when (eq start end) ;; mouse click
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
495 (save-selected-window
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
496 (select-window (posn-window start))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
497 (setq col (ruler-mode-window-col (car (posn-col-row start)))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
498 ts (+ col (window-hscroll)))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
499 (and (>= col 0) (< col (window-width))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
500 (not (member ts tab-stop-list))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
501 (progn
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
502 (message "Tab stop set to %d" ts)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
503 (setq tab-stop-list (sort (cons ts tab-stop-list)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
504 #'<)))))))))
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
505
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
506 (defun ruler-mode-mouse-del-tab-stop (start-event)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
507 "Delete tab stop at the graduation where the mouse pointer is on.
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
508 START-EVENT is the mouse click event."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
509 (interactive "e")
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
510 (when ruler-mode-show-tab-stops
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
511 (let* ((start (event-start start-event))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
512 (end (event-end start-event))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
513 col ts)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
514 (when (eq start end) ;; mouse click
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
515 (save-selected-window
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
516 (select-window (posn-window start))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
517 (setq col (ruler-mode-window-col (car (posn-col-row start)))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
518 ts (+ col (window-hscroll)))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
519 (and (>= col 0) (< col (window-width))
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
520 (member ts tab-stop-list)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
521 (progn
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
522 (message "Tab stop at %d deleted" ts)
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
523 (setq tab-stop-list (delete ts tab-stop-list)))))))))
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
524
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
525 (defun ruler-mode-toggle-show-tab-stops ()
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
526 "Toggle showing of tab stops on the ruler."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
527 (interactive)
41461
5507024cc13c Add pagination.
Richard M. Stallman <rms@gnu.org>
parents: 39731
diff changeset
528 (setq ruler-mode-show-tab-stops (not ruler-mode-show-tab-stops))
5507024cc13c Add pagination.
Richard M. Stallman <rms@gnu.org>
parents: 39731
diff changeset
529 (force-mode-line-update))
5507024cc13c Add pagination.
Richard M. Stallman <rms@gnu.org>
parents: 39731
diff changeset
530
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
531 (defvar ruler-mode-map
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
532 (let ((km (make-sparse-keymap)))
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
533 (define-key km [header-line down-mouse-1]
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
534 #'ignore)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
535 (define-key km [header-line down-mouse-3]
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
536 #'ignore)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
537 (define-key km [header-line down-mouse-2]
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
538 #'ruler-mode-mouse-grab-any-column)
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
539 (define-key km [header-line (shift down-mouse-1)]
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
540 #'ruler-mode-mouse-set-left-margin)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
541 (define-key km [header-line (shift down-mouse-3)]
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
542 #'ruler-mode-mouse-set-right-margin)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
543 (define-key km [header-line (control down-mouse-1)]
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
544 #'ruler-mode-mouse-add-tab-stop)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
545 (define-key km [header-line (control down-mouse-3)]
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
546 #'ruler-mode-mouse-del-tab-stop)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
547 (define-key km [header-line (control down-mouse-2)]
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
548 #'ruler-mode-toggle-show-tab-stops)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
549 km)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
550 "Keymap for ruler minor mode.")
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
551
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
552 (defvar ruler-mode-header-line-format-old nil
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
553 "Hold previous value of `header-line-format'.")
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
554
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
555 (defvar ruler-mode-ruler-function 'ruler-mode-ruler
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
556 "Function to call to return ruler header line format.
54399
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52889
diff changeset
557 This variable is expected to be made buffer-local by modes.")
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52889
diff changeset
558
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
559 (defconst ruler-mode-header-line-format
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
560 '(:eval (funcall ruler-mode-ruler-function))
54399
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52889
diff changeset
561 "`header-line-format' used in ruler mode.
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
562 Call `ruler-mode-ruler-function' to compute the ruler value.")
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
563
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
564 ;;;###autoload
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
565 (define-minor-mode ruler-mode
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
566 "Display a ruler in the header line if ARG > 0."
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
567 nil nil
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
568 ruler-mode-map
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
569 :group 'ruler-mode
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
570 (if ruler-mode
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
571 (progn
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
572 ;; When `ruler-mode' is on save previous header line format
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
573 ;; and install the ruler header line format.
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
574 (when (local-variable-p 'header-line-format)
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
575 (set (make-local-variable 'ruler-mode-header-line-format-old)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
576 header-line-format))
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
577 (setq header-line-format ruler-mode-header-line-format)
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
578 (add-hook 'post-command-hook 'force-mode-line-update nil t))
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
579 ;; When `ruler-mode' is off restore previous header line format if
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
580 ;; the current one is the ruler header line format.
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
581 (when (eq header-line-format ruler-mode-header-line-format)
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
582 (kill-local-variable 'header-line-format)
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
583 (when (local-variable-p 'ruler-mode-header-line-format-old)
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
584 (setq header-line-format ruler-mode-header-line-format-old)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
585 (kill-local-variable 'ruler-mode-header-line-format-old)))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
586 (remove-hook 'post-command-hook 'force-mode-line-update t)))
41461
5507024cc13c Add pagination.
Richard M. Stallman <rms@gnu.org>
parents: 39731
diff changeset
587
42706
be541feb06cc Fix typo.
Pavel Janík <Pavel@Janik.cz>
parents: 42020
diff changeset
588 ;; Add ruler-mode to the minor mode menu in the mode line
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
589 (define-key mode-line-mode-menu [ruler-mode]
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
590 `(menu-item "Ruler" ruler-mode
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
591 :button (:toggle . ruler-mode)))
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
592
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
593 (defconst ruler-mode-ruler-help-echo
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
594 "\
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
595 S-mouse-1/3: set L/R margin, \
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
596 mouse-2: set goal column, \
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
597 C-mouse-2: show tabs"
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
598 "Help string shown when mouse is over the ruler.
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
599 `ruler-mode-show-tab-stops' is nil.")
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
600
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
601 (defconst ruler-mode-ruler-help-echo-when-goal-column
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
602 "\
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
603 S-mouse-1/3: set L/R margin, \
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
604 C-mouse-2: show tabs"
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
605 "Help string shown when mouse is over the ruler.
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
606 `goal-column' is set and `ruler-mode-show-tab-stops' is nil.")
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
607
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
608 (defconst ruler-mode-ruler-help-echo-when-tab-stops
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
609 "\
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
610 C-mouse1/3: set/unset tab, \
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
611 C-mouse-2: hide tabs"
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
612 "Help string shown when mouse is over the ruler.
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
613 `ruler-mode-show-tab-stops' is non-nil.")
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
614
49195
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
615 (defconst ruler-mode-fill-column-help-echo
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
616 "drag-mouse-2: set fill column"
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
617 "Help string shown when mouse is on the fill column character.")
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
618
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
619 (defconst ruler-mode-comment-column-help-echo
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
620 "drag-mouse-2: set comment column"
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
621 "Help string shown when mouse is on the comment column character.")
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
622
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
623 (defconst ruler-mode-goal-column-help-echo
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
624 "\
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
625 drag-mouse-2: set goal column, \
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
626 mouse-2: unset goal column"
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
627 "Help string shown when mouse is on the goal column character.")
c297d31ef382 (ruler-mode-comment-column-char, ruler-mode-goal-column-char)
Juanma Barranquero <lekktu@gmail.com>
parents: 47425
diff changeset
628
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
629 (defconst ruler-mode-margin-help-echo
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
630 "%s margin %S"
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
631 "Help string shown when mouse is over a margin area.")
42020
6e891121e1cc (ruler-mode-extra-left-cols): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 42003
diff changeset
632
51389
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
633 (defconst ruler-mode-fringe-help-echo
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
634 "%s fringe %S"
a8b686f386db Version 1.6
Juanma Barranquero <lekktu@gmail.com>
parents: 49769
diff changeset
635 "Help string shown when mouse is over a fringe area.")
52889
615ebe291578 (ruler-mode-left-fringe-cols): Add new optional
Richard M. Stallman <rms@gnu.org>
parents: 52430
diff changeset
636
615ebe291578 (ruler-mode-left-fringe-cols): Add new optional
Richard M. Stallman <rms@gnu.org>
parents: 52430
diff changeset
637 (defsubst ruler-mode-space (width &rest props)
615ebe291578 (ruler-mode-left-fringe-cols): Add new optional
Richard M. Stallman <rms@gnu.org>
parents: 52430
diff changeset
638 "Return a single space string of WIDTH times the normal character width.
615ebe291578 (ruler-mode-left-fringe-cols): Add new optional
Richard M. Stallman <rms@gnu.org>
parents: 52430
diff changeset
639 Optional argument PROPS specifies other text properties to apply."
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
640 (apply 'propertize " " 'display (list 'space :width width) props))
41461
5507024cc13c Add pagination.
Richard M. Stallman <rms@gnu.org>
parents: 39731
diff changeset
641
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
642 (defun ruler-mode-ruler ()
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
643 "Compute and return an header line ruler."
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
644 (let* ((w (window-width))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
645 (m (window-margins))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
646 (f (window-fringes))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
647 (i 0)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
648 (j (window-hscroll))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
649 ;; Setup the scrollbar, fringes, and margins areas.
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
650 (lf (ruler-mode-space
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
651 'left-fringe
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
652 'face 'ruler-mode-fringes
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
653 'help-echo (format ruler-mode-fringe-help-echo
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
654 "Left" (or (car f) 0))))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
655 (rf (ruler-mode-space
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
656 'right-fringe
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
657 'face 'ruler-mode-fringes
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
658 'help-echo (format ruler-mode-fringe-help-echo
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
659 "Right" (or (cadr f) 0))))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
660 (lm (ruler-mode-space
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
661 'left-margin
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
662 'face 'ruler-mode-margins
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
663 'help-echo (format ruler-mode-margin-help-echo
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
664 "Left" (or (car m) 0))))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
665 (rm (ruler-mode-space
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
666 'right-margin
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
667 'face 'ruler-mode-margins
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
668 'help-echo (format ruler-mode-margin-help-echo
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
669 "Right" (or (cdr m) 0))))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
670 (sb (ruler-mode-space
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
671 'scroll-bar
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
672 'face 'ruler-mode-pad))
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
673 ;; Remember the scrollbar vertical type.
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
674 (sbvt (car (window-current-scroll-bars)))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
675 ;; Create an "clean" ruler.
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
676 (ruler
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
677 (propertize
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
678 (make-string w ruler-mode-basic-graduation-char)
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
679 'face 'ruler-mode-default
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
680 'local-map ruler-mode-map
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
681 'help-echo (cond
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
682 (ruler-mode-show-tab-stops
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
683 ruler-mode-ruler-help-echo-when-tab-stops)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
684 (goal-column
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
685 ruler-mode-ruler-help-echo-when-goal-column)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
686 (ruler-mode-ruler-help-echo))))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
687 k c)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
688 ;; Setup the active area.
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
689 (while (< i w)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
690 ;; Graduations.
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
691 (cond
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
692 ;; Show a number graduation.
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
693 ((= (mod j 10) 0)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
694 (setq c (number-to-string (/ j 10))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
695 m (length c)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
696 k i)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
697 (put-text-property
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
698 i (1+ i) 'face 'ruler-mode-column-number
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
699 ruler)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
700 (while (and (> m 0) (>= k 0))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
701 (aset ruler k (aref c (setq m (1- m))))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
702 (setq k (1- k))))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
703 ;; Show an intermediate graduation.
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
704 ((= (mod j 5) 0)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
705 (aset ruler i ruler-mode-inter-graduation-char)))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
706 ;; Special columns.
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
707 (cond
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
708 ;; Show the `current-column' marker.
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
709 ((= j (current-column))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
710 (aset ruler i ruler-mode-current-column-char)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
711 (put-text-property
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
712 i (1+ i) 'face 'ruler-mode-current-column
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
713 ruler))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
714 ;; Show the `goal-column' marker.
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
715 ((and goal-column (= j goal-column))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
716 (aset ruler i ruler-mode-goal-column-char)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
717 (put-text-property
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
718 i (1+ i) 'face 'ruler-mode-goal-column
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
719 ruler)
62651
8d965863dd8c Supprot mouse-face on mode-line.
Masatake YAMATO <jet@gyve.org>
parents: 59996
diff changeset
720 (put-text-property
8d965863dd8c Supprot mouse-face on mode-line.
Masatake YAMATO <jet@gyve.org>
parents: 59996
diff changeset
721 i (1+ i) 'mouse-face 'mode-line-highlight
8d965863dd8c Supprot mouse-face on mode-line.
Masatake YAMATO <jet@gyve.org>
parents: 59996
diff changeset
722 ruler)
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
723 (put-text-property
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
724 i (1+ i) 'help-echo ruler-mode-goal-column-help-echo
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
725 ruler))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
726 ;; Show the `comment-column' marker.
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
727 ((= j comment-column)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
728 (aset ruler i ruler-mode-comment-column-char)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
729 (put-text-property
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
730 i (1+ i) 'face 'ruler-mode-comment-column
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
731 ruler)
62651
8d965863dd8c Supprot mouse-face on mode-line.
Masatake YAMATO <jet@gyve.org>
parents: 59996
diff changeset
732 (put-text-property
8d965863dd8c Supprot mouse-face on mode-line.
Masatake YAMATO <jet@gyve.org>
parents: 59996
diff changeset
733 i (1+ i) 'mouse-face 'mode-line-highlight
8d965863dd8c Supprot mouse-face on mode-line.
Masatake YAMATO <jet@gyve.org>
parents: 59996
diff changeset
734 ruler)
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
735 (put-text-property
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
736 i (1+ i) 'help-echo ruler-mode-comment-column-help-echo
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
737 ruler))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
738 ;; Show the `fill-column' marker.
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
739 ((= j fill-column)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
740 (aset ruler i ruler-mode-fill-column-char)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
741 (put-text-property
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
742 i (1+ i) 'face 'ruler-mode-fill-column
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
743 ruler)
62651
8d965863dd8c Supprot mouse-face on mode-line.
Masatake YAMATO <jet@gyve.org>
parents: 59996
diff changeset
744 (put-text-property
8d965863dd8c Supprot mouse-face on mode-line.
Masatake YAMATO <jet@gyve.org>
parents: 59996
diff changeset
745 i (1+ i) 'mouse-face 'mode-line-highlight
8d965863dd8c Supprot mouse-face on mode-line.
Masatake YAMATO <jet@gyve.org>
parents: 59996
diff changeset
746 ruler)
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
747 (put-text-property
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
748 i (1+ i) 'help-echo ruler-mode-fill-column-help-echo
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
749 ruler))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
750 ;; Show the `tab-stop-list' markers.
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
751 ((and ruler-mode-show-tab-stops (member j tab-stop-list))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
752 (aset ruler i ruler-mode-tab-stop-char)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
753 (put-text-property
63201
c1af317747bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents: 62651
diff changeset
754 i (1+ i) 'face 'ruler-mode-tab-stop
54440
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
755 ruler)))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
756 (setq i (1+ i)
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
757 j (1+ j)))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
758 ;; Return the ruler propertized string. Using list here,
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
759 ;; instead of concat visually separate the different areas.
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
760 (if (nth 2 (window-fringes))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
761 ;; fringes outside margins.
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
762 (list "" (and (eq 'left sbvt) sb) lf lm
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
763 ruler rm rf (and (eq 'right sbvt) sb))
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
764 ;; fringes inside margins.
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
765 (list "" (and (eq 'left sbvt) sb) lm lf
aabf30299e6c From David Ponce <david@dponce.com>
Kim F. Storm <storm@cua.dk>
parents: 54401
diff changeset
766 ruler rf rm (and (eq 'right sbvt) sb)))))
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
767
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
768 (provide 'ruler-mode)
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
769
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
770 ;; Local Variables:
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
771 ;; coding: iso-latin-1
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
772 ;; End:
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
773
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51389
diff changeset
774 ;;; arch-tag: b2f24546-5605-44c4-b67b-c9a4eeba3ee8
39731
0fbd04880396 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
775 ;;; ruler-mode.el ends here