[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: completion buffer - unsuitable column width

From: Jonathan Rockway
Subject: Re: completion buffer - unsuitable column width
Date: Tue, 03 Mar 2009 10:33:17 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.90 (gnu/linux)

* On Mon, Mar 02 2009, Stefan Monnier wrote:
>>         (window (get-buffer-window (current-buffer) 0))
>>         (wwidth (if window (1- (window-width window)) 79))
>> ...
>> In my case, I use face-remapping-alist to assign different faces for the
>> frame default face and the buffer default face.  This causes  "window-width"
>> to return a figure that does not indicate how much text  can be fit in one
>> line in that window.
>> I don't know how to fix this given that there seems to be no way to
>> calculate the (average) character width of text with a given face.
> That's unfortunate, indeed.

This has been bugging me for a while, as there appears to be no way for
lisp code to determine how many pixels wide a string/font pair will
render to.  (I tried a hack involving redisplay and count-screen-lines,
and it works, but is generally horrible, and it only answers the
question "will this line render to more than one screen-line".  I guess
you can just resize the buffer until it wraps, though.  Like I said,
though, this is a horrible hack :)

Anyway, since it appears that the code exists in the font-backend to do
this properly (and some parts of emacs *do* do it properly)... would it
be worthwhile to bind these C functions to Lisp?  I have never worked on
the C parts of emacs... but since this is bugging someone other than me,
it might be worthwhile.


Jonathan Rockway

print just => another => perl => hacker => if $,=$"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]