From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Native display of line numbers Date: Mon, 19 Jun 2017 18:51:04 +0300 Message-ID: <831sqgx9g7.fsf@gnu.org> References: <83lgoqzm0v.fsf@gnu.org> <83tw3dxs60.fsf@gnu.org> <83k249xgs2.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1497887491 31289 195.159.176.226 (19 Jun 2017 15:51:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 19 Jun 2017 15:51:31 +0000 (UTC) Cc: emacs-devel@gnu.org To: Yuri Khan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 19 17:51:27 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dMyxZ-0007n3-Pv for ged-emacs-devel@m.gmane.org; Mon, 19 Jun 2017 17:51:26 +0200 Original-Received: from localhost ([::1]:43204 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMyxe-0002l5-No for ged-emacs-devel@m.gmane.org; Mon, 19 Jun 2017 11:51:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMyxT-0002jW-RY for emacs-devel@gnu.org; Mon, 19 Jun 2017 11:51:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dMyxQ-0007NW-MI for emacs-devel@gnu.org; Mon, 19 Jun 2017 11:51:19 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:46275) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMyxQ-0007NQ-GM; Mon, 19 Jun 2017 11:51:16 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4596 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dMyxP-0005mv-QL; Mon, 19 Jun 2017 11:51:16 -0400 In-reply-to: (message from Yuri Khan on Mon, 19 Jun 2017 12:32:19 +0700) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:215781 Archived-At: > From: Yuri Khan > Date: Mon, 19 Jun 2017 12:32:19 +0700 > Cc: Emacs developers > > How much is too much is subjective. Fair enough. > > OK, and what's your point? That the line number display is not ideal? > > I agree, but I think the alternatives are much worse. E.g., switching > > the order can only work on TTY frames and when the fringes are > > disabled, > > I do not understand this limitation. Could you please elaborate? Sure. The basic restriction (well, unless the geometry of the display canvas is redesigned) is that what is collectively called "display elements" -- character glyphs, images, stretches of whitespace, xwidgets, etc. -- can appear in one of 3 areas of the display: the left margin, text area, and the right margin. The order of these 3 areas is fixed, left to right (although one or both of the margins could be empty). Each one of the 3 areas is contiguous, so e.g. you cannot place the fringe in the middle of the text area, as that will disrupt layout calculations. The line numbers in my implementation are in the text area, before the actual line. On TTY frames, the left-truncation indicator is also in the text area before the actual line. It is injected there by the display engine in a way that is very similar to my implementation of the line numbers. So on TTY frames, I could in principle insert the line number before the truncation indicator. But that cannot be done on GUI frames, because the indicator is on the fringe, and cannot be moved to be to the right of the line numbers, as long as we want the line numbers to be in the text area, not in the margin. So if we want consistency between the GUI and TTY frames, the left-truncation indicator should be to the left of the line numbers on TTY frames as well. > > I'm sure people who like line numbers will get > > used to the arrangement of indicators soon enough; I did. Especially > > since long lines are rare in source code buffers, at least IME. > > Depends on what we call long lines. I run Emacs in two windows > side-by-side on a 24″ monitor, so for me everything exceeding ≈100 > columns is a long line. My teammates sometimes break this limit, and > some teams in the company I work for have a 120-column coding > standard. IME, lines longer than 80 columns are frowned upon in many coding standards. It's certainly so in Emacs and on my daytime job. And even if such long lines are allowed, I presume most of the lines are way shorter, at least in some popular languages. I'm not saying long lines never happen, I'm saying this is a clear 80-20 situation, and IMO we should favor the majority. > > Experience shows that using the margins for such pervasive modes is > > trouble in itself, because there are modes which want to use the > > margins for their own purposes. We still don't have a satisfactory > > solution for those problems. > > The problem here is that there isn’t a defined protocol for sharing > the margin. There was a discussion in 2015-12 on that matter. > > https://lists.gnu.org/archive/html/emacs-devel/2015-12/msg00066.html Indeed we discussed this more than once, but the problem is still unsolved, and AFAIR we were unable to even reach a consensus, let alone design the solution. Which to me means the problem is really hard to solve. Working around hard problems is a good engineering practice.