unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#10960: linum-mode does not work properly when changing font size
@ 2012-03-06 16:27 Le Wang
  2012-03-06 17:07 ` Glenn Morris
  0 siblings, 1 reply; 18+ messages in thread
From: Le Wang @ 2012-03-06 16:27 UTC (permalink / raw)
  To: 10960

[-- Attachment #1: Type: text/plain, Size: 343 bytes --]

Here is the stackoverflow question:

http://stackoverflow.com/questions/9304192/emacs-linum-mode-and-size-of-font-unreadable-line-numbers

Here is another question with a hacky solution

http://unix.stackexchange.com/questions/29786/font-size-issues-with-emacs-in-linum-mode/30087#30087

I can repro this with recent builds of Emacs24

-- 
Le

[-- Attachment #2: Type: text/html, Size: 626 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-06 16:27 bug#10960: linum-mode does not work properly when changing font size Le Wang
@ 2012-03-06 17:07 ` Glenn Morris
  2012-03-06 18:11   ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Glenn Morris @ 2012-03-06 17:07 UTC (permalink / raw)
  To: Le Wang; +Cc: 10960

Le Wang wrote:

> Here is the stackoverflow question:
>
> http://stackoverflow.com/questions/9304192/emacs-linum-mode-and-size-of-font-unreadable-line-numbers

Here is the existing Emacs report

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=1255





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-06 17:07 ` Glenn Morris
@ 2012-03-06 18:11   ` Eli Zaretskii
  2012-03-06 21:05     ` Juanma Barranquero
  2012-03-10  9:59     ` Eli Zaretskii
  0 siblings, 2 replies; 18+ messages in thread
From: Eli Zaretskii @ 2012-03-06 18:11 UTC (permalink / raw)
  To: Glenn Morris, Stefan Monnier; +Cc: 10960, l26wang

> From: Glenn Morris <rgm@gnu.org>
> Date: Tue, 06 Mar 2012 12:07:37 -0500
> Cc: 10960@debbugs.gnu.org
> 
> Le Wang wrote:
> 
> > Here is the stackoverflow question:
> >
> > http://stackoverflow.com/questions/9304192/emacs-linum-mode-and-size-of-font-unreadable-line-numbers
> 
> Here is the existing Emacs report
> 
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=1255

I don't understand Stefan's response in that bug: what effect exactly
are text-scale-* functions supposed to produce?  Should the text in
the margins be enlarged to the same size as the text in the "text
area" of the window, or should the text in the margins retain its
original size?

And whichever of these two is TRT, why is this considered to be a
problem in linum-mode, and not in the infrastructure (a.k.a. the
display engine)?





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-06 18:11   ` Eli Zaretskii
@ 2012-03-06 21:05     ` Juanma Barranquero
  2012-03-10  9:59     ` Eli Zaretskii
  1 sibling, 0 replies; 18+ messages in thread
From: Juanma Barranquero @ 2012-03-06 21:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 10960, l26wang

On Tue, Mar 6, 2012 at 19:11, Eli Zaretskii <eliz@gnu.org> wrote:

> I don't understand Stefan's response in that bug

I didn't either at the time, nor do I now...

    Juanma





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-06 18:11   ` Eli Zaretskii
  2012-03-06 21:05     ` Juanma Barranquero
@ 2012-03-10  9:59     ` Eli Zaretskii
  2012-03-10 14:38       ` Stefan Monnier
  1 sibling, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2012-03-10  9:59 UTC (permalink / raw)
  To: monnier; +Cc: 10960, l26wang


Ping!  Stefan, could you please explain your response?

> Date: Tue, 06 Mar 2012 20:11:43 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 10960@debbugs.gnu.org, l26wang@gmail.com
> 
> > From: Glenn Morris <rgm@gnu.org>
> > Date: Tue, 06 Mar 2012 12:07:37 -0500
> > Cc: 10960@debbugs.gnu.org
> > 
> > Le Wang wrote:
> > 
> > > Here is the stackoverflow question:
> > >
> > > http://stackoverflow.com/questions/9304192/emacs-linum-mode-and-size-of-font-unreadable-line-numbers
> > 
> > Here is the existing Emacs report
> > 
> > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=1255
> 
> I don't understand Stefan's response in that bug: what effect exactly
> are text-scale-* functions supposed to produce?  Should the text in
> the margins be enlarged to the same size as the text in the "text
> area" of the window, or should the text in the margins retain its
> original size?
> 
> And whichever of these two is TRT, why is this considered to be a
> problem in linum-mode, and not in the infrastructure (a.k.a. the
> display engine)?
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-10  9:59     ` Eli Zaretskii
@ 2012-03-10 14:38       ` Stefan Monnier
  2012-03-10 15:06         ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Stefan Monnier @ 2012-03-10 14:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 10960, l26wang

> Ping!  Stefan, could you please explain your response?

I'm not sure what to explain about it.

>> I don't understand Stefan's response in that bug: what effect exactly
>> are text-scale-* functions supposed to produce?  Should the text in

Increase the size of the text, without increasing the size of the text
area.


        Stefan





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-10 14:38       ` Stefan Monnier
@ 2012-03-10 15:06         ` Eli Zaretskii
  2012-03-10 15:38           ` Juanma Barranquero
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2012-03-10 15:06 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 10960, l26wang

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: rgm@gnu.org,  10960@debbugs.gnu.org,  l26wang@gmail.com
> Date: Sat, 10 Mar 2012 09:38:57 -0500
> 
> > Ping!  Stefan, could you please explain your response?
> 
> I'm not sure what to explain about it.
> 
> >> I don't understand Stefan's response in that bug: what effect exactly
> >> are text-scale-* functions supposed to produce?  Should the text in
> 
> Increase the size of the text, without increasing the size of the text
> area.

OK, let me ask specific questions then:

 . should the font of the text shown in the margin area change to the
   same size as the font of the text shown in the text area?

 . if the answer to the previous question is YES, then should Emacs
   automatically make sure the margin areas adjust their pixel width
   to keep the same number of character cells as specified by the
   set-window-margins command?





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-10 15:06         ` Eli Zaretskii
@ 2012-03-10 15:38           ` Juanma Barranquero
  2012-03-10 17:18             ` Eli Zaretskii
  2012-03-10 18:28             ` Stefan Monnier
  0 siblings, 2 replies; 18+ messages in thread
From: Juanma Barranquero @ 2012-03-10 15:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 10960, l26wang

On Sat, Mar 10, 2012 at 16:06, Eli Zaretskii <eliz@gnu.org> wrote:

> OK, let me ask specific questions then:

In the thread of bug#1255 Stefan already answered what amounts to YES, NO.

The problem with that answer is that it is maximally unhelpful. Every
package that wants to use the margin will have to be defensively coded
against text-scale-*.

    Juanma





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-10 15:38           ` Juanma Barranquero
@ 2012-03-10 17:18             ` Eli Zaretskii
  2012-03-10 18:28             ` Stefan Monnier
  1 sibling, 0 replies; 18+ messages in thread
From: Eli Zaretskii @ 2012-03-10 17:18 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 10960, l26wang

> From: Juanma Barranquero <lekktu@gmail.com>
> Date: Sat, 10 Mar 2012 16:38:14 +0100
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, 10960@debbugs.gnu.org, l26wang@gmail.com
> 
> On Sat, Mar 10, 2012 at 16:06, Eli Zaretskii <eliz@gnu.org> wrote:
> 
> > OK, let me ask specific questions then:
> 
> In the thread of bug#1255 Stefan already answered what amounts to YES, NO.

Maybe I misunderstood, but that's not what I read there.

> The problem with that answer is that it is maximally unhelpful. Every
> package that wants to use the margin will have to be defensively coded
> against text-scale-*.

If every application that uses display margins will have to do that,
Emacs should do that automatically, IMO.  What would be the reasons
not to?





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-10 15:38           ` Juanma Barranquero
  2012-03-10 17:18             ` Eli Zaretskii
@ 2012-03-10 18:28             ` Stefan Monnier
  2012-03-10 21:50               ` Eli Zaretskii
  2012-03-11 16:01               ` Juanma Barranquero
  1 sibling, 2 replies; 18+ messages in thread
From: Stefan Monnier @ 2012-03-10 18:28 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 10960, l26wang

>> OK, let me ask specific questions then:
> In the thread of bug#1255 Stefan already answered what amounts to YES, NO.

Indeed.

> The problem with that answer is that it is maximally unhelpful.  Every
> package that wants to use the margin will have to be defensively coded
> against text-scale-*.

You mean, that text-scale-* makes the problem more common significant?
Maybe so, yes.  But I don't think that just special-handling
text-scale-* would be a good solution.  We need some more general way to
adjust the size of the margin to the size of the images&text displayed
there, so as to handle non-default faces, proportional text, ...


        Stefan





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-10 18:28             ` Stefan Monnier
@ 2012-03-10 21:50               ` Eli Zaretskii
  2012-03-11  1:36                 ` Stefan Monnier
  2012-03-11 16:01               ` Juanma Barranquero
  1 sibling, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2012-03-10 21:50 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: lekktu, 10960, l26wang

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Eli Zaretskii <eliz@gnu.org>,  10960@debbugs.gnu.org,  l26wang@gmail.com
> Date: Sat, 10 Mar 2012 13:28:52 -0500
> 
> > The problem with that answer is that it is maximally unhelpful.  Every
> > package that wants to use the margin will have to be defensively coded
> > against text-scale-*.
> 
> You mean, that text-scale-* makes the problem more common significant?
> Maybe so, yes.  But I don't think that just special-handling
> text-scale-* would be a good solution.

Special-casing it was not what I had in mind.

> We need some more general way to adjust the size of the margin to
> the size of the images&text displayed there, so as to handle
> non-default faces, proportional text, ...

It all boils down to calculating the size of the margins in pixels.
The key to that is window_box_width, which uses
WINDOW_FRAME_COLUMN_WIDTH to convert columns into pixels, and
WINDOW_FRAME_COLUMN_WIDTH returns the "canonical" width of a column,
which is an average width of the default face's font.

So all it takes is to make that calculation aware of face remapping,
images displayed in the margin, etc.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-10 21:50               ` Eli Zaretskii
@ 2012-03-11  1:36                 ` Stefan Monnier
  2012-03-11  3:57                   ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Stefan Monnier @ 2012-03-11  1:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: lekktu, 10960, l26wang

>> You mean, that text-scale-* makes the problem more common significant?
>> Maybe so, yes.  But I don't think that just special-handling
>> text-scale-* would be a good solution.
> Special-casing it was not what I had in mind.

Actually, what you propose does just that.

>> We need some more general way to adjust the size of the margin to
>> the size of the images&text displayed there, so as to handle
>> non-default faces, proportional text, ...

> It all boils down to calculating the size of the margins in pixels.
> The key to that is window_box_width, which uses
> WINDOW_FRAME_COLUMN_WIDTH to convert columns into pixels, and
> WINDOW_FRAME_COLUMN_WIDTH returns the "canonical" width of a column,
> which is an average width of the default face's font.
> So all it takes is to make that calculation aware of face remapping,
> images displayed in the margin, etc.

OK, so rather than special casing text-scale-* you suggest to special
case frame-remapping: same problem.  It still won't account for
non-default faces, proportional fonts, and other display features,


        Stefan





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-11  1:36                 ` Stefan Monnier
@ 2012-03-11  3:57                   ` Eli Zaretskii
  2012-03-11 14:37                     ` Stefan Monnier
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2012-03-11  3:57 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: lekktu, 10960, l26wang

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: lekktu@gmail.com,  10960@debbugs.gnu.org,  l26wang@gmail.com
> Date: Sat, 10 Mar 2012 20:36:29 -0500
> 
> >> You mean, that text-scale-* makes the problem more common significant?
> >> Maybe so, yes.  But I don't think that just special-handling
> >> text-scale-* would be a good solution.
> > Special-casing it was not what I had in mind.
> 
> Actually, what you propose does just that.

Please explain where do you see any special-casing.  I'm beginning to
think I cannot understand written English or write clearly in it.

> > It all boils down to calculating the size of the margins in pixels.
> > The key to that is window_box_width, which uses
> > WINDOW_FRAME_COLUMN_WIDTH to convert columns into pixels, and
> > WINDOW_FRAME_COLUMN_WIDTH returns the "canonical" width of a column,
> > which is an average width of the default face's font.
> > So all it takes is to make that calculation aware of face remapping,
> > images displayed in the margin, etc.
> 
> OK, so rather than special casing text-scale-* you suggest to special
> case frame-remapping

Where and how did you manage to read something like that into what I
said?





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-11  3:57                   ` Eli Zaretskii
@ 2012-03-11 14:37                     ` Stefan Monnier
  2012-03-11 17:14                       ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Stefan Monnier @ 2012-03-11 14:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: lekktu, 10960, l26wang

>> > It all boils down to calculating the size of the margins in pixels.
>> > The key to that is window_box_width, which uses
>> > WINDOW_FRAME_COLUMN_WIDTH to convert columns into pixels, and
>> > WINDOW_FRAME_COLUMN_WIDTH returns the "canonical" width of a column,
>> > which is an average width of the default face's font.
>> > So all it takes is to make that calculation aware of face remapping,
>> > images displayed in the margin, etc.
>> OK, so rather than special casing text-scale-* you suggest to special
>> case frame-remapping
> Where and how did you manage to read something like that into what I
> said?

I guess I did not understand what you suggest, then.
Could you explain some more?
The way I see it, set-window-margins can only set the margin's size
either to "no margin" or to a fixed size given as an integer.  So you'd
have to let the Elisp code somehow figure out the *display* size of the
margin's text (either in pixels or in char-cell-equivalent), and I don't
know of any way Elisp can do that currently.


        Stefan





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-10 18:28             ` Stefan Monnier
  2012-03-10 21:50               ` Eli Zaretskii
@ 2012-03-11 16:01               ` Juanma Barranquero
  1 sibling, 0 replies; 18+ messages in thread
From: Juanma Barranquero @ 2012-03-11 16:01 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 10960, l26wang

On Sat, Mar 10, 2012 at 19:28, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> We need some more general way to
> adjust the size of the margin to the size of the images&text displayed
> there, so as to handle non-default faces, proportional text, ...

OK, but that's a long way from your earlier answer in bug#1255: "So,
yes, the problem lies somewhat in linum-mode which should resize the
margin accordingly, tho it's far from easy for it to do so (and it can
only do it in increments of the base default font size)." We need a
way to adjust the size of the margin, but linum-mode et al. should do
nothing more** that set a margin width (in character cells); any
subsequent width change should be transparent for it/them.

**In fact, I don't see a way for two packages to coordinate uses of
the margin (let's suppose I write a package which uses the margin to
mark bookmarked places and I also want to use linum in the same
buffer); but that's unrelated to margin auto-resizing.

    Juanma





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-11 14:37                     ` Stefan Monnier
@ 2012-03-11 17:14                       ` Eli Zaretskii
  2012-03-12  1:54                         ` Stefan Monnier
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2012-03-11 17:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: lekktu, 10960, l26wang

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: lekktu@gmail.com,  10960@debbugs.gnu.org,  l26wang@gmail.com
> Date: Sun, 11 Mar 2012 10:37:45 -0400
> 
> The way I see it, set-window-margins can only set the margin's size
> either to "no margin" or to a fixed size given as an integer.

That's correct, but all set-window-margins does is set two attributes
of the window object.  How to use that is entirely up to the display
engine.

When the time comes to display the window, the margins come into play
through the pixel coordinates where we draw the fringe bitmap.  The
code which computes those coordinates eventually calls
window_box_left_offset or window_box_right_offset, which call
window_box_width.  The latter is the single place in the code, AFAICS,
that converts the margin width from character cell units to pixel
units.

> So you'd have to let the Elisp code somehow figure out the *display*
> size of the margin's text (either in pixels or in
> char-cell-equivalent), and I don't know of any way Elisp can do that
> currently.

I didn't suggest to do this in Lisp.  (I don't think Lisp programs
should control the display at this low level.)  What I suggested is to
modify the calculation of the fringe pixel position based on how many
pixels are actually needed for the glyphs (character glyphs, stretch
glyphs, image glyphs, etc.) displayed in the fringe.  Isn't that what
you wanted?





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-11 17:14                       ` Eli Zaretskii
@ 2012-03-12  1:54                         ` Stefan Monnier
  2012-03-13 19:35                           ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Stefan Monnier @ 2012-03-12  1:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: lekktu, 10960, l26wang

> I didn't suggest to do this in Lisp.  (I don't think Lisp programs
> should control the display at this low level.)  What I suggested is to
> modify the calculation of the fringe pixel position based on how many
> pixels are actually needed for the glyphs (character glyphs, stretch
> glyphs, image glyphs, etc.) displayed in the fringe.  Isn't that what
> you wanted?

If we can do that, it's great, yes.


        Stefan





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#10960: linum-mode does not work properly when changing font size
  2012-03-12  1:54                         ` Stefan Monnier
@ 2012-03-13 19:35                           ` Eli Zaretskii
  0 siblings, 0 replies; 18+ messages in thread
From: Eli Zaretskii @ 2012-03-13 19:35 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: lekktu, 10960, l26wang

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: lekktu@gmail.com,  10960@debbugs.gnu.org,  l26wang@gmail.com
> Date: Sun, 11 Mar 2012 21:54:09 -0400
> 
> > I didn't suggest to do this in Lisp.  (I don't think Lisp programs
> > should control the display at this low level.)  What I suggested is to
> > modify the calculation of the fringe pixel position based on how many
> > pixels are actually needed for the glyphs (character glyphs, stretch
> > glyphs, image glyphs, etc.) displayed in the fringe.  Isn't that what
> > you wanted?
> 
> If we can do that, it's great, yes.

I'll see what this would take when I have time.  I'm afraid we will
have to leave for post-24.1, though, as the changes will probably be
non-trivial enough.





^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2012-03-13 19:35 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-06 16:27 bug#10960: linum-mode does not work properly when changing font size Le Wang
2012-03-06 17:07 ` Glenn Morris
2012-03-06 18:11   ` Eli Zaretskii
2012-03-06 21:05     ` Juanma Barranquero
2012-03-10  9:59     ` Eli Zaretskii
2012-03-10 14:38       ` Stefan Monnier
2012-03-10 15:06         ` Eli Zaretskii
2012-03-10 15:38           ` Juanma Barranquero
2012-03-10 17:18             ` Eli Zaretskii
2012-03-10 18:28             ` Stefan Monnier
2012-03-10 21:50               ` Eli Zaretskii
2012-03-11  1:36                 ` Stefan Monnier
2012-03-11  3:57                   ` Eli Zaretskii
2012-03-11 14:37                     ` Stefan Monnier
2012-03-11 17:14                       ` Eli Zaretskii
2012-03-12  1:54                         ` Stefan Monnier
2012-03-13 19:35                           ` Eli Zaretskii
2012-03-11 16:01               ` Juanma Barranquero

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).