From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#16475: 24.3.50; enhancement request: remove vertical scroll bar automatically when not needed Date: Thu, 16 Jan 2014 20:42:17 -0800 (PST) Message-ID: <8bfbddfb-237e-47b1-aed7-b28fc97d1f92@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1389933795 1725 80.91.229.3 (17 Jan 2014 04:43:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Jan 2014 04:43:15 +0000 (UTC) To: 16475@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 17 05:43:22 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W41H7-0003X0-IA for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Jan 2014 05:43:21 +0100 Original-Received: from localhost ([::1]:36181 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W41H7-00077f-4i for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 Jan 2014 23:43:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W41Gw-00077L-LH for bug-gnu-emacs@gnu.org; Thu, 16 Jan 2014 23:43:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W41Go-0003tm-70 for bug-gnu-emacs@gnu.org; Thu, 16 Jan 2014 23:43:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40299) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W41Go-0003tf-3E for bug-gnu-emacs@gnu.org; Thu, 16 Jan 2014 23:43:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W41Gn-00057W-Pf for bug-gnu-emacs@gnu.org; Thu, 16 Jan 2014 23:43:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Jan 2014 04:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16475 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138993376919662 (code B ref -1); Fri, 17 Jan 2014 04:43:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Jan 2014 04:42:49 +0000 Original-Received: from localhost ([127.0.0.1]:54318 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W41Ga-000573-3H for submit@debbugs.gnu.org; Thu, 16 Jan 2014 23:42:48 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:55500) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W41GX-00056u-Ez for submit@debbugs.gnu.org; Thu, 16 Jan 2014 23:42:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W41GO-0003mP-PK for submit@debbugs.gnu.org; Thu, 16 Jan 2014 23:42:45 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:36012) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W41GO-0003mL-N2 for submit@debbugs.gnu.org; Thu, 16 Jan 2014 23:42:36 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W41GH-00074V-5a for bug-gnu-emacs@gnu.org; Thu, 16 Jan 2014 23:42:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W41G9-0003gl-J6 for bug-gnu-emacs@gnu.org; Thu, 16 Jan 2014 23:42:29 -0500 Original-Received: from userp1040.oracle.com ([156.151.31.81]:22771) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W41G9-0003gh-Bh for bug-gnu-emacs@gnu.org; Thu, 16 Jan 2014 23:42:21 -0500 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s0H4gJcG014877 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 17 Jan 2014 04:42:20 GMT Original-Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s0H4gIRm003104 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 17 Jan 2014 04:42:19 GMT Original-Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s0H4gIZb004360 for ; Fri, 17 Jan 2014 04:42:18 GMT X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6680.5000 (x86)] X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:83620 Archived-At: This was either reported as a bug/enhancement request long ago, or else it was discussed in emacs-devel long ago. I don't recall. I seem to remember, though, that the answer was that this couldn't be done, at least on MS Windows. I don't recall the particulars, so forgive me if I misunderstood or don't remember right. Anyway, while fiddling a bit, in response to this request on StackOverflow: http://stackoverflow.com/questions/21175099/how-to-automatically-add-remove= -scroll-bars-on-the-fly I found something that seems to work OK. I do not claim that this is a good way to implement the feature - at all! But it perhaps shows that something could maybe be done for this. I repeat here what I tried, but again, I am not proposing that a solution would be along these lines. Just asking that you maybe think a bit more about whether it is feasible to come up with a satisfactory solution. One thing I notice is that if you shrink the text by scaling it that does not seem to be taken into account by the code I tried: even if all of the text is easily displayed in the window (because it is small), the scroll bar does not seem to disappear. Anyway, this is the code I tried, which seems to "work": (setq-default mode-line-position '(:eval (progn (if (> (count-lines (point-min) (point-max)) (window-height)) =09 (set-window-scroll-bars nil 20 t) (set-window-scroll-bars nil 1 t)) ; IF TRY ZERO, GET BUG #16474 `((-3 ,(propertize =09 "%p" =09 'local-map mode-line-column-line-number-mode-map =09 'mouse-face 'mode-line-highlight =09 'help-echo "Buffer position, mouse-1: Line/col menu")) (line-number-mode =09((column-number-mode =09 (10 ,(propertize =09=09" (%l,%c)" =09=09'face (and (> (current-column) =09=09=09 modelinepos-column-limit) =09=09=09 'modelinepos-column-warning) =09=09'local-map mode-line-column-line-number-mode-map =09=09'mouse-face 'mode-line-highlight =09=09'help-echo "Line and column, mouse-1: Line/col menu")) =09 (6 ,(propertize =09 " L%l" =09 'local-map mode-line-column-line-number-mode-map =09 'mouse-face 'mode-line-highlight =09 'help-echo "Line number, mouse-1: Line/col menu")))) =09((column-number-mode =09 (5 ,(propertize =09 " C%c" =09 'face (and (> (current-column) =09=09=09 modelinepos-column-limit) =09=09=09 'modelinepos-column-warning) =09 'local-map mode-line-column-line-number-mode-map =09 'mouse-face 'mode-line-highlight =09 'help-echo "Column number, mouse-1: Line/col menu"))))))))) [BTW, another thing I noticed, after scaling the text smaller in a buffer that was shown in two windows of the same frame, one above the other: After evaluating the above code, the mode lines disappeared temporarily. I grabbed the area that should have been the mode line of the top window and dragged it up a bit, and the mode lines showed up again. Seems like some redisplay was not happening immediately or something.] In GNU Emacs 24.3.50.1 (i686-pc-mingw32) of 2014-01-07 on ODIEONE Bzr revision: 115916 bzg@gnu.org-20140107233629-du2solx6tmxnx0np Windowing system distributor `Microsoft Corp.', version 6.1.7601 Configured using: `configure --prefix=3D/c/Devel/emacs/binary --enable-checking=3Dyes,glyphs 'CFLAGS=3D-O0 -g3' LDFLAGS=3D-Lc:/Devel/emacs/lib CPPFLAGS=3D-Ic:/Devel/emacs/include'