emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug? the position of scroll-bar


From: Kim F. Storm
Subject: Re: bug? the position of scroll-bar
Date: 21 Sep 2003 02:02:29 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Masatake YAMATO <address@hidden> writes:

> After evaluating (scroll-bar-mode) twice, 
> both (nth 2 (window-scroll-bars)) and (frame-parameter nil 
> 'vertical-scroll-bars)
> return t. So I cannot know the position of scroll-bar(left or right). I think
> this is a bug.

A short-coming at least :-)   A value of t means to use the system default
setting.

In any case, I have installed a fix that should help you.

It adds a new built-in variable
        default-frame-scroll-bars
which reflects the default position on various window systems
(e.g. right on Windows, and left on X).

So if frame-parameter returns neither left, nor right, nor nil, you
can consult default-frame-scroll-bars to know what the actual setting
is.  

But I also modified M-x scroll-bar-mode to use this to pass on the
proper setting in case it toggles scroll-bars on (rather than pass the
value t), so normally you can now trust the value of frame-parameter
as specified below to return the actual setting.


Finally, I clarified the doc string of window-scroll-bars to explain
that the scroll-bar type may be 't' in which case the window uses the
frame's current setting.


Maybe we need to add helper functions like these to hide the somewhat
tricky relationship between windows, frames, and system defaults:

(defun frame-current-scroll-bars (&optional frame)
   (let ((type (frame-parameter frame 'vertical-scroll-bars)))
      (if (or (null type) (eq type 'left) (eq type 'right))
          type
        default-frame-scroll-bars)))

and

(defun window-current-scroll-bars (&optional window)
  (let ((type (nth 2 (window-scroll-bars window))))
    (if (eq type t)
        (frame-current-scroll-bars (window-frame (or window (selected-window))))
      type)))



> 
> `ruler-mode-left-scroll-bar-cols' in ruler-mode.el expects either (nth
> 2 (window-scroll-bars)) or (frame-parameter nil 'vertical-scroll-bars)
> returns 'left or 'right if scroll bar is displayed. 
> 
> emacs -q
> 
> (progn 
>   (scroll-bar-mode)                   ; disable
>   (scroll-bar-mode)                   ; enable
>   (cons (nth 2 (window-scroll-bars))
>       (frame-parameter nil 'vertical-scroll-bars)))
> => (t . t)
> 
> Masatake YAMATO
> 
> 
> _______________________________________________
> Emacs-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/emacs-devel
> 

-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

[Prev in Thread] Current Thread [Next in Thread]