From unknown Sat Jun 21 03:28:41 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#17303 <17303@debbugs.gnu.org> To: bug#17303 <17303@debbugs.gnu.org> Subject: Status: On tty or -nw, (window-body-width) is one column too big. Reply-To: bug#17303 <17303@debbugs.gnu.org> Date: Sat, 21 Jun 2025 10:28:41 +0000 retitle 17303 On tty or -nw, (window-body-width) is one column too big. reassign 17303 emacs submitter 17303 Alan Mackenzie severity 17303 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 20 13:08:12 2014 Received: (at submit) by debbugs.gnu.org; 20 Apr 2014 17:08:12 +0000 Received: from localhost ([127.0.0.1]:53506 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WbvDu-0001GU-VA for submit@debbugs.gnu.org; Sun, 20 Apr 2014 13:08:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46908) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WbvDr-0001GH-VI for submit@debbugs.gnu.org; Sun, 20 Apr 2014 13:08:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WbvDh-00085u-NR for submit@debbugs.gnu.org; Sun, 20 Apr 2014 13:08:07 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:48647) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WbvDh-00085q-Kg for submit@debbugs.gnu.org; Sun, 20 Apr 2014 13:07:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WbvDZ-0007eM-U3 for bug-gnu-emacs@gnu.org; Sun, 20 Apr 2014 13:07:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WbvDS-00084C-EY for bug-gnu-emacs@gnu.org; Sun, 20 Apr 2014 13:07:49 -0400 Received: from colin.muc.de ([193.149.48.1]:42833 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WbvDS-000841-80 for bug-gnu-emacs@gnu.org; Sun, 20 Apr 2014 13:07:42 -0400 Received: (qmail 85781 invoked by uid 3782); 20 Apr 2014 17:07:39 -0000 Received: from acm.muc.de (pD951961C.dip0.t-ipconnect.de [217.81.150.28]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 20 Apr 2014 19:07:39 +0200 Received: (qmail 4134 invoked by uid 1000); 20 Apr 2014 17:03:43 -0000 Date: Sun, 20 Apr 2014 17:03:43 +0000 To: bug-gnu-emacs@gnu.org Subject: On tty or -nw, (window-body-width) is one column too big. Message-ID: <20140420170343.GA4058@acm.acm> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) Hi, Emacs. I'm doing something at the moment involving scrolling of windows, and I need to know at what "visual" column point is in. So, naturally, I do (% (current-column) (window-body-width)) . At the start of the first continuation line, this formula (correctly) returns 0 on a GUI, but (e.g.) 79 on a tty or in emacs -nw. This is caused by emacs counting the "\" character in the right margin as part of the body-width. This seems like a bad idea. I think it's also a bug. So, is there a better method of determining the "visual" column point is in? -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 20 15:35:41 2014 Received: (at 17303) by debbugs.gnu.org; 20 Apr 2014 19:35:41 +0000 Received: from localhost ([127.0.0.1]:53546 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WbxWe-0005zo-SF for submit@debbugs.gnu.org; Sun, 20 Apr 2014 15:35:41 -0400 Received: from mtaout27.012.net.il ([80.179.55.183]:49146) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WbxWa-0005zb-QD for 17303@debbugs.gnu.org; Sun, 20 Apr 2014 15:35:38 -0400 Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il (HyperSendmail v2007.08) id <0N4C00H00GDO8I00@mtaout27.012.net.il> for 17303@debbugs.gnu.org; Sun, 20 Apr 2014 22:32:06 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout27.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N4C00A3ZGXINY80@mtaout27.012.net.il>; Sun, 20 Apr 2014 22:32:06 +0300 (IDT) Date: Sun, 20 Apr 2014 22:35:24 +0300 From: Eli Zaretskii Subject: Re: bug#17303: On tty or -nw, (window-body-width) is one column too big. In-reply-to: <20140420170343.GA4058@acm.acm> X-012-Sender: halo1@inter.net.il To: Alan Mackenzie Message-id: <83ha5neqv7.fsf@gnu.org> References: <20140420170343.GA4058@acm.acm> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 17303 Cc: 17303@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > Date: Sun, 20 Apr 2014 17:03:43 +0000 > From: Alan Mackenzie > > I'm doing something at the moment involving scrolling of windows, and I > need to know at what "visual" column point is in. So, naturally, I do > > (% (current-column) (window-body-width)) > > . At the start of the first continuation line, this formula (correctly) > returns 0 on a GUI, but (e.g.) 79 on a tty or in emacs -nw. You mean, it says 80 in a GUI session, not 0, right? > This is caused by emacs counting the "\" character in the right margin as > part of the body-width. No, it's because the last character in the continued like is in column 78 on a TTY, but in column 79 in a GUI session. Emacs counts columns in continuation lines starting from the last column in the previous line, as you'd expect. IOW, the continued line is treated as one long line, and all its columns counted contiguously. It is true that the "\" character on a TTY takes up one column, and thus leaves only 79 columns for text, but what else can Emacs do? > This seems like a bad idea. I think it's also a bug. What would you like Emacs to do instead, given what I just explained? > So, is there a better method of determining the "visual" column point is > in? current-column is it. Please tell why it doesn't fit your needs. From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 20 16:06:04 2014 Received: (at 17303) by debbugs.gnu.org; 20 Apr 2014 20:06:04 +0000 Received: from localhost ([127.0.0.1]:53558 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wby03-0007a1-6F for submit@debbugs.gnu.org; Sun, 20 Apr 2014 16:06:03 -0400 Received: from mtaout24.012.net.il ([80.179.55.180]:58566) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wbxzz-0007ZR-IW for 17303@debbugs.gnu.org; Sun, 20 Apr 2014 16:06:01 -0400 Received: from conversion-daemon.mtaout24.012.net.il by mtaout24.012.net.il (HyperSendmail v2007.08) id <0N4C00G00HPW3L00@mtaout24.012.net.il> for 17303@debbugs.gnu.org; Sun, 20 Apr 2014 23:04:10 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout24.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N4C00CZNIEYA650@mtaout24.012.net.il>; Sun, 20 Apr 2014 23:04:10 +0300 (IDT) Date: Sun, 20 Apr 2014 23:05:46 +0300 From: Eli Zaretskii Subject: Re: bug#17303: On tty or -nw, (window-body-width) is one column too big. In-reply-to: <83ha5neqv7.fsf@gnu.org> X-012-Sender: halo1@inter.net.il To: acm@muc.de Message-id: <83d2gbepgl.fsf@gnu.org> References: <20140420170343.GA4058@acm.acm> <83ha5neqv7.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 17303 Cc: 17303@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > Date: Sun, 20 Apr 2014 22:35:24 +0300 > From: Eli Zaretskii > Cc: 17303@debbugs.gnu.org > > > Date: Sun, 20 Apr 2014 17:03:43 +0000 > > From: Alan Mackenzie > > > > I'm doing something at the moment involving scrolling of windows, and I > > need to know at what "visual" column point is in. So, naturally, I do > > > > (% (current-column) (window-body-width)) > > > > . At the start of the first continuation line, this formula (correctly) > > returns 0 on a GUI, but (e.g.) 79 on a tty or in emacs -nw. > > You mean, it says 80 in a GUI session, not 0, right? Wait, perhaps I misunderstood your complain. Is the problem with window-body-width, rather than with current-column? (You seemed to ask about current-column, not window-body-width.) If so, then you should know that the continuation character does not have to take one column, it can be customized via the buffer display table. So the effective window width on a TTY is not always 1 column less than on GUI frames. Also, if there's a truncation glyph at the left, you'd probably want us to subtract its length as well, right? Moreover, when there are no fringes on a GUI frame, we also use "\" there to indicate a continued line, but we still return from window-body-width a value that counts the continuation character. So this is not an easy thing to change. And the question is of course: why do it? What is the use case where you bumped into this issue, and why window-body-width was important to you? From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 20 16:43:08 2014 Received: (at 17303) by debbugs.gnu.org; 20 Apr 2014 20:43:08 +0000 Received: from localhost ([127.0.0.1]:53569 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WbyZv-0000u2-8I for submit@debbugs.gnu.org; Sun, 20 Apr 2014 16:43:07 -0400 Received: from colin.muc.de ([193.149.48.1]:63092 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WbyZq-0000tY-GX for 17303@debbugs.gnu.org; Sun, 20 Apr 2014 16:43:03 -0400 Received: (qmail 98964 invoked by uid 3782); 20 Apr 2014 20:43:01 -0000 Received: from acm.muc.de (pD951961C.dip0.t-ipconnect.de [217.81.150.28]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 20 Apr 2014 22:42:59 +0200 Received: (qmail 3656 invoked by uid 1000); 20 Apr 2014 20:39:04 -0000 Date: Sun, 20 Apr 2014 20:39:04 +0000 To: Eli Zaretskii Subject: Re: bug#17303: On tty or -nw, (window-body-width) is one column too big. Message-ID: <20140420203904.GA3580@acm.acm> References: <20140420170343.GA4058@acm.acm> <83ha5neqv7.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83ha5neqv7.fsf@gnu.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 17303 Cc: 17303@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) Hi, Eli. On Sun, Apr 20, 2014 at 10:35:24PM +0300, Eli Zaretskii wrote: > > Date: Sun, 20 Apr 2014 17:03:43 +0000 > > From: Alan Mackenzie > > I'm doing something at the moment involving scrolling of windows, and I > > need to know at what "visual" column point is in. So, naturally, I do > > (% (current-column) (window-body-width)) > > . At the start of the first continuation line, this formula (correctly) > > returns 0 on a GUI, but (e.g.) 79 on a tty or in emacs -nw. > You mean, it says 80 in a GUI session, not 0, right? Er, no. It says 0 in a GUI session. In the GUI, (window-body-width) is the number of characters which fit on the line. In a tty, (window-body-width) is ONE MORE than that number. > > This is caused by emacs counting the "\" character in the right margin as > > part of the body-width. > No, it's because the last character in the continued like is in column > 78 on a TTY, but in column 79 in a GUI session. Emacs counts columns > in continuation lines starting from the last column in the previous > line, as you'd expect. IOW, the continued line is treated as one long > line, and all its columns counted contiguously. Yes, this is true, but it's (window-body-width) which is inconsistent between GUI and tty. > It is true that the "\" character on a TTY takes up one column, and > thus leaves only 79 columns for text, but what else can Emacs do? Tell me that (window-body-width) is 79, not 80. > > This seems like a bad idea. I think it's also a bug. > What would you like Emacs to do instead, given what I just explained? See above. > > So, is there a better method of determining the "visual" column point is > > in? > current-column is it. Please tell why it doesn't fit your needs. current-column provides the "logical" column (e.g. 79). I need the "visual" column (e.g. 0). 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. :-( It is (Determine-the-visual-column-..) which gives me trouble. On a GUI, I can use (% (current-column) (window-body-width)) , but this fails on a tty, as noted above. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 21 02:56:20 2014 Received: (at 17303) by debbugs.gnu.org; 21 Apr 2014 06:56:20 +0000 Received: from localhost ([127.0.0.1]:53716 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wc89L-0004Vq-8C for submit@debbugs.gnu.org; Mon, 21 Apr 2014 02:56:19 -0400 Received: from mtaout20.012.net.il ([80.179.55.166]:48461) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wc89F-0004VX-D0 for 17303@debbugs.gnu.org; Mon, 21 Apr 2014 02:56:15 -0400 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0N4D00200CEBQN00@a-mtaout20.012.net.il> for 17303@debbugs.gnu.org; Mon, 21 Apr 2014 09:56:11 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N4D002PRCLNA860@a-mtaout20.012.net.il>; Mon, 21 Apr 2014 09:56:11 +0300 (IDT) Date: Mon, 21 Apr 2014 09:56:01 +0300 From: Eli Zaretskii Subject: Re: bug#17303: On tty or -nw, (window-body-width) is one column too big. In-reply-to: <20140420203904.GA3580@acm.acm> X-012-Sender: halo1@inter.net.il To: Alan Mackenzie Message-id: <83a9bfdvcu.fsf@gnu.org> References: <20140420170343.GA4058@acm.acm> <83ha5neqv7.fsf@gnu.org> <20140420203904.GA3580@acm.acm> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 17303 Cc: 17303@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > Date: Sun, 20 Apr 2014 20:39:04 +0000 > Cc: 17303@debbugs.gnu.org > From: Alan Mackenzie > > > No, it's because the last character in the continued like is in column > > 78 on a TTY, but in column 79 in a GUI session. Emacs counts columns > > in continuation lines starting from the last column in the previous > > line, as you'd expect. IOW, the continued line is treated as one long > > line, and all its columns counted contiguously. > > Yes, this is true, but it's (window-body-width) which is inconsistent > between GUI and tty. > > > It is true that the "\" character on a TTY takes up one column, and > > thus leaves only 79 columns for text, but what else can Emacs do? > > Tell me that (window-body-width) is 79, not 80. It can't. It's not designed for what you need. You should use different APIs for what you want; see below. > > current-column is it. Please tell why it doesn't fit your needs. > > current-column provides the "logical" column (e.g. 79). I need the > "visual" column (e.g. 0). Then what you want is '(car (posn-col-row (posn-at-point)))'. But see below. > 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. There's also the new pre-redisplay-function hook that you might find useful. 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. So can we close this bug report? From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 21 11:33:38 2014 Received: (at 17303-done) by debbugs.gnu.org; 21 Apr 2014 15:33:38 +0000 Received: from localhost ([127.0.0.1]:54257 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WcGDy-0000Vw-Dy for submit@debbugs.gnu.org; Mon, 21 Apr 2014 11:33:38 -0400 Received: from colin.muc.de ([193.149.48.1]:41503 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WcGDv-0000Vh-9K for 17303-done@debbugs.gnu.org; Mon, 21 Apr 2014 11:33:36 -0400 Received: (qmail 77129 invoked by uid 3782); 21 Apr 2014 15:33:33 -0000 Received: from acm.muc.de (pD9519BAA.dip0.t-ipconnect.de [217.81.155.170]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 21 Apr 2014 17:33:33 +0200 Received: (qmail 5103 invoked by uid 1000); 21 Apr 2014 15:29:39 -0000 Date: Mon, 21 Apr 2014 15:29:39 +0000 To: 17303-done@debbugs.gnu.org Subject: Re: bug#17303: Acknowledgement (On tty or -nw, (window-body-width) is one column too big.) Message-ID: <20140421152939.GA4266@acm.acm> References: <20140420170343.GA4058@acm.acm> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 17303-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) Bug closed; not a bug. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 21 11:47:35 2014 Received: (at 17303) by debbugs.gnu.org; 21 Apr 2014 15:47:35 +0000 Received: from localhost ([127.0.0.1]:54264 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WcGRR-0000wV-UE for submit@debbugs.gnu.org; Mon, 21 Apr 2014 11:47:34 -0400 Received: from colin.muc.de ([193.149.48.1]:36888 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WcGRO-0000wJ-Oz for 17303@debbugs.gnu.org; Mon, 21 Apr 2014 11:47:31 -0400 Received: (qmail 78125 invoked by uid 3782); 21 Apr 2014 15:47:30 -0000 Received: from acm.muc.de (pD9519BAA.dip0.t-ipconnect.de [217.81.155.170]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 21 Apr 2014 17:47:29 +0200 Received: (qmail 5199 invoked by uid 1000); 21 Apr 2014 15:43:35 -0000 Date: Mon, 21 Apr 2014 15:43:35 +0000 To: Eli Zaretskii Subject: Re: bug#17303: On tty or -nw, (window-body-width) is one column too big. Message-ID: <20140421154335.GB4266@acm.acm> References: <20140420170343.GA4058@acm.acm> <83ha5neqv7.fsf@gnu.org> <20140420203904.GA3580@acm.acm> <83a9bfdvcu.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83a9bfdvcu.fsf@gnu.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 17303 Cc: 17303@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) Hi, Eli. On Mon, Apr 21, 2014 at 09:56:01AM +0300, Eli Zaretskii wrote: > > Date: Sun, 20 Apr 2014 20:39:04 +0000 > > Cc: 17303@debbugs.gnu.org > > From: Alan Mackenzie > > > It is true that the "\" character on a TTY takes up one column, and > > > thus leaves only 79 columns for text, but what else can Emacs do? > > Tell me that (window-body-width) is 79, not 80. > It can't. It's not designed for what you need. You should use > different APIs for what you want; see below. OK. > > > current-column is it. Please tell why it doesn't fit your needs. > > current-column provides the "logical" column (e.g. 79). I need the > > "visual" column (e.g. 0). > 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. What I ended up using is (- (current-column) (progn (vertical-motion 0) (current-column))) (with a save-excursion at a strategic surrounding point). > > 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. > There's also the new pre-redisplay-function hook that you might find > useful. OK, I'll look at this sometime. > 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. ;-) As its original author recently discussed with you, it would be nice if there were more support for it inside redisplay, but that means Somebody (tm) stepping up to the plate and implementing it. > So can we close this bug report? I've just closed it. Thanks for all the help! -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 21 12:07:53 2014 Received: (at 17303) by debbugs.gnu.org; 21 Apr 2014 16:07:53 +0000 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 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 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) 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) Date: Mon, 21 Apr 2014 19:07:39 +0300 From: Eli Zaretskii Subject: Re: bug#17303: On tty or -nw, (window-body-width) is one column too big. In-reply-to: <20140421154335.GB4266@acm.acm> X-012-Sender: halo1@inter.net.il To: Alan Mackenzie 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> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 17303 Cc: 17303@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > 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. From unknown Sat Jun 21 03:28:41 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 20 May 2014 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator