aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2001-12-14 07:54:28 +0000
committerRichard M. Stallman2001-12-14 07:54:28 +0000
commitbebb2253f617b3142f381ca96b98e5af87f030bd (patch)
tree3705c3ac7070d0d19833e098045c921191d6c602
parent446dd922aac1d51548a868971fdc77f6b0591fc7 (diff)
downloademacs-bebb2253f617b3142f381ca96b98e5af87f030bd.tar.gz
emacs-bebb2253f617b3142f381ca96b98e5af87f030bd.zip
(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.
-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"
438 "Right margin %S" 438 "Right margin %S"
439 "Help string shown when mouse is over the right margin area.") 439 "Help string shown when mouse is over the right margin area.")
440 440
441(defun ruler-mode-extra-left-cols () 441(defmacro ruler-mode-left-fringe-cols ()
442 "Return number of extra columns on the left side of selected frame. 442 "Return the width, measured in columns, of the left fringe area."
443That is the number of columns occupied by the left fringe area and 443 '(round (or (frame-parameter nil 'left-fringe) 0)
444vertical scrollbar on the left side of the selected frame." 444 (frame-char-width)))
445 (let ((w (frame-first-window)) 445
446 (xy (cons 0 0))) 446(defmacro ruler-mode-right-fringe-cols ()
447 (with-current-buffer (window-buffer w) 447 "Return the width, measured in columns, of the right fringe area."
448 (let (header-line-format) 448 '(round (or (frame-parameter nil 'right-fringe) 0)
449 (while (not (listp (coordinates-in-window-p xy w))) 449 (frame-char-width)))
450 (setcar xy (1+ (car xy)))) 450
451 (car xy))))) 451(defmacro ruler-mode-left-scroll-bar-cols ()
452 "Return the width, measured in columns, of the left vertical scrollbar."
453 '(if (eq (frame-parameter nil 'vertical-scroll-bars) 'left)
454 (round (or (frame-parameter nil 'scroll-bar-width) 0)
455 (frame-char-width))
456 0))
457
458(defmacro ruler-mode-right-scroll-bar-cols ()
459 "Return the width, measured in columns, of the right vertical scrollbar."
460 '(if (eq (frame-parameter nil 'vertical-scroll-bars) 'right)
461 (round (or (frame-parameter nil 'scroll-bar-width) 0)
462 (frame-char-width))
463 0))
452 464
453(defun ruler-mode-ruler () 465(defun ruler-mode-ruler ()
454 "Return a string ruler." 466 "Return a string ruler."
455 (if ruler-mode 467 (if ruler-mode
456 (let* ((j (ruler-mode-extra-left-cols)) 468 (let* ((j (+ (ruler-mode-left-fringe-cols)
457 (k (/ (or (frame-parameter nil 'right-fringe) 0) 469 (ruler-mode-left-scroll-bar-cols)))
458 (frame-char-width)))
459 (w (+ (window-width) j)) 470 (w (+ (window-width) j))
460 (m (window-margins)) 471 (m (window-margins))
461 (l (or (car m) 0)) 472 (l (or (car m) 0))
@@ -466,8 +477,10 @@ vertical scrollbar on the left side of the selected frame."
466 ;; unit graduations 477 ;; unit graduations
467 (make-string w ruler-mode-basic-graduation-char) 478 (make-string w ruler-mode-basic-graduation-char)
468 ;; extra space to fill the header line 479 ;; extra space to fill the header line
469 (make-string k ?\ ))) 480 (make-string (+ (ruler-mode-right-fringe-cols)
470 c) 481 (ruler-mode-right-scroll-bar-cols))
482 ?\ )))
483 c k)
471 484
472 ;; Setup default face and help echo. 485 ;; Setup default face and help echo.
473 (put-text-property 0 (length ruler) 486 (put-text-property 0 (length ruler)