all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Alan Mackenzie <acm@muc.de>
Cc: 17303@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	[thread overview]
Message-ID: <83a9bed5tg.fsf@gnu.org> (raw)
In-Reply-To: <20140421154335.GB4266@acm.acm>

> Date: Mon, 21 Apr 2014 15:43:35 +0000
> Cc: 17303@debbugs.gnu.org
> From: Alan Mackenzie <acm@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.





  reply	other threads:[~2014-04-21 16:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-20 17:03 bug#17303: On tty or -nw, (window-body-width) is one column too big Alan Mackenzie
2014-04-20 19:35 ` Eli Zaretskii
2014-04-20 20:05   ` Eli Zaretskii
2014-04-20 20:39   ` Alan Mackenzie
2014-04-21  6:56     ` Eli Zaretskii
2014-04-21 15:43       ` Alan Mackenzie
2014-04-21 16:07         ` Eli Zaretskii [this message]
     [not found] ` <handler.17303.B.13980136924874.ack@debbugs.gnu.org>
2014-04-21 15:29   ` bug#17303: Acknowledgement (On tty or -nw, (window-body-width) is one column too big.) Alan Mackenzie

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83a9bed5tg.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=17303@debbugs.gnu.org \
    --cc=acm@muc.de \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.