[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: completion buffer - unsuitable column width
From: |
Dan Nicolaescu |
Subject: |
Re: completion buffer - unsuitable column width |
Date: |
Tue, 3 Mar 2009 08:46:18 -0800 (PST) |
David Reitter <address@hidden> writes:
> On 2 Mar 2009, at 20:33, Stefan Monnier wrote:
>
> >> 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.
> >
> >> I haven't encountered such an issue with 22.
> >
> > The code in Emacs-22, just used a hard-coded 79.
>
> OK, perhaps we could use something like
>
> (if (assq 'default face-remapping-alist) 79 (window-width))
>
> to cover at least the case that I've encountered.
>
> A grep over the source, looking for (window-width), reveals other
> suspicious uses.
> I haven't examined it further, but take simple.el, line-move-visual:
>
> (cond ((eq (nth 1 posn) 'right-fringe) ; overflow-newline-into-
> fringe
> (setq temporary-goal-column (- (window-width) 1)))
>
> `temporary-goal-column' refers to buffer columns; window-width does not.
>
> Or, abbrev.el:
>
> (while abbrev-list
> (if (> (+ first-column 40) (window-width))
> (progn
>
> first-column seems to refer to the buffer, again.
>
> Or, term.el:
> `term-window-width' uses (window-width) and I would assume that this
> (`term-width') is what is used by processes running in the terminal
> (COLUMNS).
term.el relies on using a fixed width font. Trying to not do so in a
terminal emulator is simply not worth the effort.