From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#17303: On tty or -nw, (window-body-width) is one column too big. Date: Mon, 21 Apr 2014 19:07:39 +0300 Message-ID: <83a9bed5tg.fsf@gnu.org> References: <20140420170343.GA4058@acm.acm> <83ha5neqv7.fsf@gnu.org> <20140420203904.GA3580@acm.acm> <83a9bfdvcu.fsf@gnu.org> <20140421154335.GB4266@acm.acm> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1398096504 9547 80.91.229.3 (21 Apr 2014 16:08:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Apr 2014 16:08:24 +0000 (UTC) Cc: 17303@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 21 18:08:16 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WcGlT-0007tI-PZ for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 Apr 2014 18:08:15 +0200 Original-Received: from localhost ([::1]:50148 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcGlT-0000H1-4p for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 Apr 2014 12:08:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49141) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcGlL-0000Ev-IV for bug-gnu-emacs@gnu.org; Mon, 21 Apr 2014 12:08:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WcGlG-0004Bf-F9 for bug-gnu-emacs@gnu.org; Mon, 21 Apr 2014 12:08:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46147) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcGlG-0004BZ-BK for bug-gnu-emacs@gnu.org; Mon, 21 Apr 2014 12:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WcGlF-0001ax-Q6 for bug-gnu-emacs@gnu.org; Mon, 21 Apr 2014 12:08:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Apr 2014 16:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17303 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17303-submit@debbugs.gnu.org id=B17303.13980964736114 (code B ref 17303); Mon, 21 Apr 2014 16:08:01 +0000 Original-Received: (at 17303) by debbugs.gnu.org; 21 Apr 2014 16:07:53 +0000 Original-Received: from localhost ([127.0.0.1]:54304 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WcGl6-0001aX-Re for submit@debbugs.gnu.org; Mon, 21 Apr 2014 12:07:53 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:54889) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WcGl4-0001aN-9D for 17303@debbugs.gnu.org; Mon, 21 Apr 2014 12:07:51 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0N4E00G00216TM00@a-mtaout22.012.net.il> for 17303@debbugs.gnu.org; Mon, 21 Apr 2014 19:07:48 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N4E00G08250HD60@a-mtaout22.012.net.il>; Mon, 21 Apr 2014 19:07:48 +0300 (IDT) In-reply-to: <20140421154335.GB4266@acm.acm> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:88189 Archived-At: > Date: Mon, 21 Apr 2014 15:43:35 +0000 > Cc: 17303@debbugs.gnu.org > From: Alan Mackenzie > > > 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.