unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Jonathan Rockway <jon@jrock.us>
To: Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Re: completion buffer - unsuitable column width
Date: Tue, 03 Mar 2009 10:33:17 -0600	[thread overview]
Message-ID: <87eixemur6.fsf@bar.jrock.us> (raw)
In-Reply-To: <jwvtz6bo0h2.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 02 Mar 2009 20:33:09 -0500")

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

Thoughts?

Regards,
Jonathan Rockway

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




      parent reply	other threads:[~2009-03-03 16:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-02 19:13 completion buffer - unsuitable column width David Reitter
2009-03-03  1:33 ` Stefan Monnier
2009-03-03 13:23   ` David Reitter
2009-03-03 14:21     ` Stefan Monnier
2009-03-03 15:47       ` David Reitter
2009-03-03 18:03         ` Stefan Monnier
2009-03-03 16:46     ` Dan Nicolaescu
2009-03-03 16:33   ` Jonathan Rockway [this message]

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=87eixemur6.fsf@bar.jrock.us \
    --to=jon@jrock.us \
    --cc=emacs-devel@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).