From: Drew Adams <drew.adams@oracle.com>
To: 16475@debbugs.gnu.org
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) [thread overview]
Message-ID: <8bfbddfb-237e-47b1-aed7-b28fc97d1f92@default> (raw)
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))
(set-window-scroll-bars nil 20 t)
(set-window-scroll-bars nil 1 t)) ; IF TRY ZERO, GET BUG #16474
`((-3 ,(propertize
"%p"
'local-map mode-line-column-line-number-mode-map
'mouse-face 'mode-line-highlight
'help-echo "Buffer position, mouse-1: Line/col menu"))
(line-number-mode
((column-number-mode
(10 ,(propertize
" (%l,%c)"
'face (and (> (current-column)
modelinepos-column-limit)
'modelinepos-column-warning)
'local-map mode-line-column-line-number-mode-map
'mouse-face 'mode-line-highlight
'help-echo "Line and column, mouse-1: Line/col menu"))
(6 ,(propertize
" L%l"
'local-map mode-line-column-line-number-mode-map
'mouse-face 'mode-line-highlight
'help-echo "Line number, mouse-1: Line/col menu"))))
((column-number-mode
(5 ,(propertize
" C%c"
'face (and (> (current-column)
modelinepos-column-limit)
'modelinepos-column-warning)
'local-map mode-line-column-line-number-mode-map
'mouse-face 'mode-line-highlight
'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=/c/Devel/emacs/binary --enable-checking=yes,glyphs
'CFLAGS=-O0 -g3' LDFLAGS=-Lc:/Devel/emacs/lib
CPPFLAGS=-Ic:/Devel/emacs/include'
next reply other threads:[~2014-01-17 4:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-17 4:42 Drew Adams [this message]
2014-01-17 14:35 ` bug#16475: 24.3.50; enhancement request: remove vertical scroll bar automatically when not needed Stefan Monnier
2016-02-12 2:46 ` Keith David Bershatsky
2017-10-25 5:27 ` bug#16475: " Keith David Bershatsky
2017-10-25 7:47 ` martin rudalics
2017-10-25 14:40 ` Eli Zaretskii
2017-10-26 7:56 ` martin rudalics
2017-10-26 15:59 ` Eli Zaretskii
2017-10-27 8:25 ` martin rudalics
2017-10-27 2:44 ` Richard Stallman
2017-10-25 22:25 ` Keith David Bershatsky
2017-10-26 16:30 ` Eli Zaretskii
2017-10-26 16:03 ` Keith David Bershatsky
2017-10-26 17:07 ` Eli Zaretskii
2017-10-27 8:26 ` martin rudalics
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8bfbddfb-237e-47b1-aed7-b28fc97d1f92@default \
--to=drew.adams@oracle.com \
--cc=16475@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).