summaryrefslogtreecommitdiff
path: root/lisp/ruler-mode.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2001-12-14 07:54:28 +0000
committerRichard M. Stallman <rms@gnu.org>2001-12-14 07:54:28 +0000
commitbebb2253f617b3142f381ca96b98e5af87f030bd (patch)
tree3705c3ac7070d0d19833e098045c921191d6c602 /lisp/ruler-mode.el
parent446dd922aac1d51548a868971fdc77f6b0591fc7 (diff)
downloademacs-bebb2253f617b3142f381ca96b98e5af87f030bd.tar.gz
(ruler-mode-extra-left-cols): Removed.
(ruler-mode-left-fringe-cols): New macro. (ruler-mode-right-fringe-cols): New macro. (ruler-mode-left-scroll-bar-cols): New macro. (ruler-mode-right-scroll-bar-cols): New macro. (ruler-mode-ruler): Use above new macros.
Diffstat (limited to 'lisp/ruler-mode.el')
-rw-r--r--lisp/ruler-mode.el45
1 files changed, 29 insertions, 16 deletions
diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el
index 9d86074a0f0..21c7b691190 100644
--- a/lisp/ruler-mode.el
+++ b/lisp/ruler-mode.el
@@ -438,24 +438,35 @@ C-mouse-2: hide tabs"
"Right margin %S"
"Help string shown when mouse is over the right margin area.")
-(defun ruler-mode-extra-left-cols ()
- "Return number of extra columns on the left side of selected frame.
-That is the number of columns occupied by the left fringe area and
-vertical scrollbar on the left side of the selected frame."
- (let ((w (frame-first-window))
- (xy (cons 0 0)))
- (with-current-buffer (window-buffer w)
- (let (header-line-format)
- (while (not (listp (coordinates-in-window-p xy w)))
- (setcar xy (1+ (car xy))))
- (car xy)))))
+(defmacro ruler-mode-left-fringe-cols ()
+ "Return the width, measured in columns, of the left fringe area."
+ '(round (or (frame-parameter nil 'left-fringe) 0)
+ (frame-char-width)))
+
+(defmacro ruler-mode-right-fringe-cols ()
+ "Return the width, measured in columns, of the right fringe area."
+ '(round (or (frame-parameter nil 'right-fringe) 0)
+ (frame-char-width)))
+
+(defmacro ruler-mode-left-scroll-bar-cols ()
+ "Return the width, measured in columns, of the left vertical scrollbar."
+ '(if (eq (frame-parameter nil 'vertical-scroll-bars) 'left)
+ (round (or (frame-parameter nil 'scroll-bar-width) 0)
+ (frame-char-width))
+ 0))
+
+(defmacro ruler-mode-right-scroll-bar-cols ()
+ "Return the width, measured in columns, of the right vertical scrollbar."
+ '(if (eq (frame-parameter nil 'vertical-scroll-bars) 'right)
+ (round (or (frame-parameter nil 'scroll-bar-width) 0)
+ (frame-char-width))
+ 0))
(defun ruler-mode-ruler ()
"Return a string ruler."
(if ruler-mode
- (let* ((j (ruler-mode-extra-left-cols))
- (k (/ (or (frame-parameter nil 'right-fringe) 0)
- (frame-char-width)))
+ (let* ((j (+ (ruler-mode-left-fringe-cols)
+ (ruler-mode-left-scroll-bar-cols)))
(w (+ (window-width) j))
(m (window-margins))
(l (or (car m) 0))
@@ -466,8 +477,10 @@ vertical scrollbar on the left side of the selected frame."
;; unit graduations
(make-string w ruler-mode-basic-graduation-char)
;; extra space to fill the header line
- (make-string k ?\ )))
- c)
+ (make-string (+ (ruler-mode-right-fringe-cols)
+ (ruler-mode-right-scroll-bar-cols))
+ ?\ )))
+ c k)
;; Setup default face and help echo.
(put-text-property 0 (length ruler)