GNU bug report logs - #17303
On tty or -nw, (window-body-width) is one column too big.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Sun, 20 Apr 2014 17:09:01 UTC

Severity: normal

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 17303 <at> debbugs.gnu.org
Subject: bug#17303: On tty or -nw, (window-body-width) is one column too	big.
Date: Mon, 21 Apr 2014 19:07:39 +0300
> Date: Mon, 21 Apr 2014 15:43:35 +0000
> Cc: 17303 <at> debbugs.gnu.org
> From: Alan Mackenzie <acm <at> muc.de>
> 
> > Then what you want is '(car (posn-col-row (posn-at-point)))'.  But see
> > below.
> 
> posn-at-point only works when point is inside a window.

Which it sometimes is.  I was drawing your attention to some APIs that
you should know about if you want to mess with redisplay.

> What I ended up using is
> 
>     (- (current-column)
>        (progn (vertical-motion 0) (current-column)))
> 
> (with a save-excursion at a strategic surrounding point).

That should do, but beware of display properties on that line.

> > > I'm working on getting follow-mode's scrolling working properly.  I have
> > > a situation where:
> > > o - point is at Col 79, this being at the start of a continuation line.
> > > o - this position is one line below the bottom of the window
> > > o - (but hasn't been redisplayed yet).
> > > o - set-window-start has NOT been called with a nil NOFORCE parameter.
> 
> > > If I were to allow the redisplay without further action, redisplay would
> > > scroll the window back upwards to ensure point is displayed.  This would
> > > negate the purpose of the scrolling.  I want to move point back into the
> > > window before the redisplay.  So I attempt the following:
> > > o - (setq dest-col (Determine-the-visual-column-point-is-in))
> > > o - (vertical-motion -1)
> > > o - (move-to-column dest-col)
> 
> > > However this last action becomes, on a tty, (move-to-column 79) putting
> > > point back where it started.  :-(
> 
> > I think you just need to use pos-visible-in-window-p instead of all
> > that complexity: if that function returns an indication that point is
> > not visible, move it back until it is.
> 
> pos-visible-in-window-p unfortunately doesn't reveal whether pos is above
> or below the window, it just returns nil.

Your description above indicated that you already know where you are.
If you don't, compare with what window-start returns.

> > Don't try to outsmart redisplay; instead, ask redisplay to tell you
> > what it already knows.  The functions I mentioned are interfaces
> > exposed by redisplay for this very purpose.
> 
> follow-mode is about nothing else but outsmarting redisplay.  ;-)

You can't.

> > So can we close this bug report?
> 
> I've just closed it.

Thanks.




This bug report was last modified 11 years and 34 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.