* bug#7782: 24.0.50; 24.0.50: set-scroll-bar-mode missing under non-GUI environments
@ 2011-01-04 8:21 Tim Cross
2011-01-10 22:58 ` Glenn Morris
0 siblings, 1 reply; 10+ messages in thread
From: Tim Cross @ 2011-01-04 8:21 UTC (permalink / raw)
To: 7782
According to the documentation for scroll-bar-mode, the way to
set/change scroll-bar settings from within elisp code is to use the
set-scroll-bar-mode function. However, this function is only defined
when run under graphic capable environments, such as X, but not in other
environments such as the Linux console.
This means that if you don't want your elisp or .emacs to raise an
error, you also need to wrap calls to this function inside something
like (when display-graphic-p ...). This is not required for other
display related functions that depend on an environment requiring
support for graphics i.e. tool-bar-mode.
For consistency and to help reduce environment related bugs, I would
like to request a feature enhancement whereby set-scroll-bar-mode is
defined in all environmennts, even if it is just a stub / do nothing
operation in environments that do not support scroll bars.
thanks,
Tim
In GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.22.0)
of 2011-01-04 on puma
Windowing system distributor `The X.Org Foundation', version 11.0.10900000
configured using `configure '--prefix=/usr/local''
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#7782: 24.0.50; 24.0.50: set-scroll-bar-mode missing under non-GUI environments
2011-01-04 8:21 bug#7782: 24.0.50; 24.0.50: set-scroll-bar-mode missing under non-GUI environments Tim Cross
@ 2011-01-10 22:58 ` Glenn Morris
2011-01-10 23:45 ` Stefan Monnier
2011-01-15 23:31 ` Tim Cross
0 siblings, 2 replies; 10+ messages in thread
From: Glenn Morris @ 2011-01-10 22:58 UTC (permalink / raw)
To: Tim Cross; +Cc: 7782
Tim Cross wrote:
> According to the documentation for scroll-bar-mode, the way to
> set/change scroll-bar settings from within elisp code is to use the
> set-scroll-bar-mode function. However, this function is only defined
> when run under graphic capable environments, such as X, but not in other
> environments such as the Linux console.
>
> This means that if you don't want your elisp or .emacs to raise an
> error, you also need to wrap calls to this function inside something
> like (when display-graphic-p ...). This is not required for other
> display related functions that depend on an environment requiring
> support for graphics i.e. tool-bar-mode.
It's not clear to me whether you mean --without-x builds or --with-x
builds started with -nw (or both), but in either case:
In a with-x build:
emacs -Q -nw
C-h f tool-bar-mode
tool-bar-mode is an interactive compiled Lisp function in `tool-bar.el'.
C-h f set-scroll-bar-mode
set-scroll-bar-mode is a compiled Lisp function in `scroll-bar.el'.
(tool-bar-mode 1) ; no error
(set-scroll-bar-mode 'left) ; no error
In a without-x build, neither tool-bar-mode nor set-scroll-bar-mode is
defined.
Thus, I see no inconsistency here and don't understand your request.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#7782: 24.0.50; 24.0.50: set-scroll-bar-mode missing under non-GUI environments
2011-01-10 22:58 ` Glenn Morris
@ 2011-01-10 23:45 ` Stefan Monnier
2011-01-13 9:45 ` David De La Harpe Golden
2021-12-04 20:29 ` Lars Ingebrigtsen
2011-01-15 23:31 ` Tim Cross
1 sibling, 2 replies; 10+ messages in thread
From: Stefan Monnier @ 2011-01-10 23:45 UTC (permalink / raw)
To: Glenn Morris; +Cc: Tim Cross, 7782
> In a without-x build, neither tool-bar-mode nor set-scroll-bar-mode is
> defined.
That's the problem. I know Emacs has many such things already, but
I think these are all bugs: I think we should adopt a convention that
functions/variables should either be specific to one particular kind of
display, or be display-independent. Since (set-)scroll-bar-mode is not
specific to one particular kind of display (it is shared by w32, X11,
and ns), it should exist independently from any particular display.
Similarly, if a function doesn't signal an error when run in -nw, it
should generally work just as well in --without-x.
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#7782: 24.0.50; 24.0.50: set-scroll-bar-mode missing under non-GUI environments
2011-01-10 23:45 ` Stefan Monnier
@ 2011-01-13 9:45 ` David De La Harpe Golden
2011-01-13 12:20 ` Eli Zaretskii
2021-12-04 20:29 ` Lars Ingebrigtsen
1 sibling, 1 reply; 10+ messages in thread
From: David De La Harpe Golden @ 2011-01-13 9:45 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Tim Cross, 7782
On 10/01/11 23:45, Stefan Monnier wrote:
> Since (set-)scroll-bar-mode is not
> specific to one particular kind of display (it is shared by w32, X11,
> and ns), it should exist independently from any particular display.
Plus there's no real reason in principle we couldn't draw text-mode
scroll bars on text terminals too, like old msdos borland ides etc.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#7782: 24.0.50; 24.0.50: set-scroll-bar-mode missing under non-GUI environments
2011-01-13 9:45 ` David De La Harpe Golden
@ 2011-01-13 12:20 ` Eli Zaretskii
0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2011-01-13 12:20 UTC (permalink / raw)
To: David De La Harpe Golden; +Cc: theophilusx, 7782
> Date: Thu, 13 Jan 2011 09:45:26 +0000
> From: David De La Harpe Golden <david@harpegolden.net>
> Cc: Tim Cross <theophilusx@gmail.com>, 7782@debbugs.gnu.org
>
> On 10/01/11 23:45, Stefan Monnier wrote:
>
> > Since (set-)scroll-bar-mode is not
> > specific to one particular kind of display (it is shared by w32, X11,
> > and ns), it should exist independently from any particular display.
>
> Plus there's no real reason in principle we couldn't draw text-mode
> scroll bars on text terminals too, like old msdos borland ides etc.
There's one valid reason, as usual: someone should write the code.
Volunteers are welcome (no, I don't).
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#7782: 24.0.50; 24.0.50: set-scroll-bar-mode missing under non-GUI environments
2011-01-10 22:58 ` Glenn Morris
2011-01-10 23:45 ` Stefan Monnier
@ 2011-01-15 23:31 ` Tim Cross
1 sibling, 0 replies; 10+ messages in thread
From: Tim Cross @ 2011-01-15 23:31 UTC (permalink / raw)
To: Glenn Morris
[-- Attachment #1: Type: text/plain, Size: 3711 bytes --]
On Tue, Jan 11, 2011 at 9:58 AM, Glenn Morris <rgm@gnu.org> wrote:
> Tim Cross wrote:
>
> > According to the documentation for scroll-bar-mode, the way to
> > set/change scroll-bar settings from within elisp code is to use the
> > set-scroll-bar-mode function. However, this function is only defined
> > when run under graphic capable environments, such as X, but not in other
> > environments such as the Linux console.
> >
> > This means that if you don't want your elisp or .emacs to raise an
> > error, you also need to wrap calls to this function inside something
> > like (when display-graphic-p ...). This is not required for other
> > display related functions that depend on an environment requiring
> > support for graphics i.e. tool-bar-mode.
>
> It's not clear to me whether you mean --without-x builds or --with-x
> builds started with -nw (or both), but in either case:
>
> In a with-x build:
> emacs -Q -nw
>
> C-h f tool-bar-mode
> tool-bar-mode is an interactive compiled Lisp function in `tool-bar.el'.
>
> C-h f set-scroll-bar-mode
> set-scroll-bar-mode is a compiled Lisp function in `scroll-bar.el'.
>
> (tool-bar-mode 1) ; no error
>
> (set-scroll-bar-mode 'left) ; no error
>
>
> In a without-x build, neither tool-bar-mode nor set-scroll-bar-mode is
> defined.
>
> Thus, I see no inconsistency here and don't understand your request.
>
OK, I just tried to re-create the error I was getting and now it isn't
occurring. I have updated emacs since logging the report, but cannot see
anything obvious in the change log that would explain the difference, so not
sure. For the record, here is what I did originally and which does not
repeat the problem now.
1. Built emacs under X with the GTK libs (emacs from bzr 24.0.50).
2. Login under the Linux console and run emacs --debug-init
Originally, I got a backtrace with a void function error for
set-scroll-bar-mode. Fixed this by putting the call inside a when block
which tested for a window-syste of X. However, noticed that this was not an
issue with tool-bar-mode. I could place a direct top-level call to
tool-bar-mode in my .emacs without needing to wrap it in a test. This was
the original inconsistency I observed. i.e. tool-bar-mode was defined but
set-scroll-bar-mode was not when running an emacs built with X under a Linux
console (not an xterm or X console).
C-h f tool-bar-mode returns docs on that function as would be expected.
C-h f set-scroll-bar-mode fails saying the function is not defined.
After removing the when block from my .emacs and just having a top level
call to set-scrolll-bar-mode and restarting emacs just now, I no longer get
the error and backtrace. C-h f returns info on both functions.
I cannot see anything in the change log which would explain why it was not
working and now is, so I guess I must have screwed up somewhere. Sorry for
the noise.
The main reason for the report was I figured we should have consistency -
either *all* graphics display related functions are always defined i.e. as
tool-bar-mode appears to be or *all* of them are defined only for
environments where they maie sense, such as X, but above all, avoid
situations where some appear to be defined and some do not.
Personally, I think they should all be defined regardless of the
environment, even if in many environments, they are just function stubs that
don't actually do anything. This avoids having to remember to put such code
inside tests and to somehow know which such functions are defined in which
environments. For the envrionments I've tested, this does not appear to be
the case for tool-bar-mode and set-scroll-bar-mode, so all appears to be
fine for at least these two cases.
thanks,
Tim
[-- Attachment #2: Type: text/html, Size: 4405 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#7782: 24.0.50; 24.0.50: set-scroll-bar-mode missing under non-GUI environments
2011-01-10 23:45 ` Stefan Monnier
2011-01-13 9:45 ` David De La Harpe Golden
@ 2021-12-04 20:29 ` Lars Ingebrigtsen
2021-12-29 3:05 ` Stefan Kangas
1 sibling, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-04 20:29 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Glenn Morris, Tim Cross, 7782
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> In a without-x build, neither tool-bar-mode nor set-scroll-bar-mode is
>> defined.
>
> That's the problem. I know Emacs has many such things already, but
> I think these are all bugs: I think we should adopt a convention that
> functions/variables should either be specific to one particular kind of
> display, or be display-independent. Since (set-)scroll-bar-mode is not
> specific to one particular kind of display (it is shared by w32, X11,
> and ns), it should exist independently from any particular display.
I think that makes sense conceptually, but I think that people that do
a --without-x build do so for a particular reason: They want to have as
lean an Emacs as possible. (Otherwise -- why bother?)
So we could certainly do this (and similarly for a bunch of other
stuff):
diff --git a/lisp/loadup.el b/lisp/loadup.el
index ed1570e778..b7e63cc656 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -260,8 +260,7 @@
(load "jit-lock")
(load "mouse")
-(if (boundp 'x-toolkit-scroll-bars)
- (load "scroll-bar"))
+(load "scroll-bar")
(load "select")
(load "emacs-lisp/timer")
(load "emacs-lisp/easymenu")
But I'm not sure we'd be doing anybody any favours.
Does anybody have an opinion here?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply related [flat|nested] 10+ messages in thread
* bug#7782: 24.0.50; 24.0.50: set-scroll-bar-mode missing under non-GUI environments
2021-12-04 20:29 ` Lars Ingebrigtsen
@ 2021-12-29 3:05 ` Stefan Kangas
2021-12-29 14:49 ` Lars Ingebrigtsen
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Kangas @ 2021-12-29 3:05 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: Glenn Morris, Tim Cross, Stefan Monnier, 7782
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>>> In a without-x build, neither tool-bar-mode nor set-scroll-bar-mode is
>>> defined.
>>
>> That's the problem. I know Emacs has many such things already, but
>> I think these are all bugs: I think we should adopt a convention that
>> functions/variables should either be specific to one particular kind of
>> display, or be display-independent. Since (set-)scroll-bar-mode is not
>> specific to one particular kind of display (it is shared by w32, X11,
>> and ns), it should exist independently from any particular display.
>
> I think that makes sense conceptually, but I think that people that do
> a --without-x build do so for a particular reason: They want to have as
> lean an Emacs as possible. (Otherwise -- why bother?)
[snip]
> Does anybody have an opinion here?
How many kilobytes does not preloading it save? It might be that the
savings are so small that the code simplification is more worthwhile.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#7782: 24.0.50; 24.0.50: set-scroll-bar-mode missing under non-GUI environments
2021-12-29 3:05 ` Stefan Kangas
@ 2021-12-29 14:49 ` Lars Ingebrigtsen
2022-01-22 14:26 ` Lars Ingebrigtsen
0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-29 14:49 UTC (permalink / raw)
To: Stefan Kangas; +Cc: Glenn Morris, Tim Cross, Stefan Monnier, 7782
Stefan Kangas <stefan@marxist.se> writes:
> How many kilobytes does not preloading it save? It might be that the
> savings are so small that the code simplification is more worthwhile.
I think it's less a matter of kilobytes, but more a sense of
"cleanliness" that some people want to achieve. On the other hand,
there's not really much to win to cater to that feeling, so perhaps we
should always define functions like that.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#7782: 24.0.50; 24.0.50: set-scroll-bar-mode missing under non-GUI environments
2021-12-29 14:49 ` Lars Ingebrigtsen
@ 2022-01-22 14:26 ` Lars Ingebrigtsen
0 siblings, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-22 14:26 UTC (permalink / raw)
To: Stefan Kangas; +Cc: Glenn Morris, Tim Cross, Stefan Monnier, 7782
Lars Ingebrigtsen <larsi@gnus.org> writes:
> I think it's less a matter of kilobytes, but more a sense of
> "cleanliness" that some people want to achieve. On the other hand,
> there's not really much to win to cater to that feeling, so perhaps we
> should always define functions like that.
Nobody seemed to have a strong opinion one way or another, but
pre-loading these things in all configurations may lead to regressions
for people (they may be doing (fboundp 'scroll-bar-scale) etc to see
whether we're in a non-X build), so I think it makes more sense to
change nothing here, and I'm therefore closing this bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-01-22 14:26 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-04 8:21 bug#7782: 24.0.50; 24.0.50: set-scroll-bar-mode missing under non-GUI environments Tim Cross
2011-01-10 22:58 ` Glenn Morris
2011-01-10 23:45 ` Stefan Monnier
2011-01-13 9:45 ` David De La Harpe Golden
2011-01-13 12:20 ` Eli Zaretskii
2021-12-04 20:29 ` Lars Ingebrigtsen
2021-12-29 3:05 ` Stefan Kangas
2021-12-29 14:49 ` Lars Ingebrigtsen
2022-01-22 14:26 ` Lars Ingebrigtsen
2011-01-15 23:31 ` Tim Cross
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.