From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: bug? the position of scroll-bar Date: 21 Sep 2003 02:02:29 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <20030917.204830.74744537.jet@gyve.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1064103212 11039 80.91.224.253 (21 Sep 2003 00:13:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 21 Sep 2003 00:13:32 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Sep 21 02:13:30 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A0rr0-0005Bb-00 for ; Sun, 21 Sep 2003 02:13:30 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1A0rw7-0001Kr-00 for ; Sun, 21 Sep 2003 02:18:48 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 1A0rhH-000633-BK for emacs-devel@quimby.gnus.org; Sat, 20 Sep 2003 20:03:27 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.22) id 1A0rgh-00062t-69 for emacs-devel@gnu.org; Sat, 20 Sep 2003 20:02:51 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.22) id 1A0rgf-00062i-BO for emacs-devel@gnu.org; Sat, 20 Sep 2003 20:02:49 -0400 Original-Received: from [193.162.153.3] (helo=pfepb.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.22) id 1A0rgf-00062b-1K for emacs-devel@gnu.org; Sat, 20 Sep 2003 20:02:49 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx3.adsl-dhcp.tele.dk [80.62.38.68]) by pfepb.post.tele.dk (Postfix) with SMTP id 2FA145EE100; Sun, 21 Sep 2003 02:02:46 +0200 (CEST) Original-To: Masatake YAMATO In-Reply-To: <20030917.204830.74744537.jet@gyve.org> Original-Lines: 76 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:16518 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:16518 Masatake YAMATO 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 > Emacs-devel@gnu.org > http://mail.gnu.org/mailman/listinfo/emacs-devel > -- Kim F. Storm http://www.cua.dk