From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Robert Weiner Newsgroups: gmane.emacs.bugs Subject: bug#28648: Make mode-line number display consistent when both line and col numbers are shown. Date: Fri, 29 Sep 2017 11:59:35 -0400 Message-ID: Reply-To: rswgnu@gmail.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c0600bc58674d055a561ebe" X-Trace: blaine.gmane.org 1506700968 2658 195.159.176.226 (29 Sep 2017 16:02:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 29 Sep 2017 16:02:48 +0000 (UTC) To: 28648@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 29 18:02:41 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1dxxkO-0008Rc-Fw for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Sep 2017 18:02:40 +0200 Original-Received: from localhost ([::1]:35961 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxxkU-0001Of-42 for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Sep 2017 12:02:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxxis-00009B-Ok for bug-gnu-emacs@gnu.org; Fri, 29 Sep 2017 12:01:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxxio-0004rO-Q3 for bug-gnu-emacs@gnu.org; Fri, 29 Sep 2017 12:01:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58983) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dxxio-0004rF-MV for bug-gnu-emacs@gnu.org; Fri, 29 Sep 2017 12:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dxxio-0001TO-EN for bug-gnu-emacs@gnu.org; Fri, 29 Sep 2017 12:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Weiner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Sep 2017 16:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 28648 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15067008305588 (code B ref -1); Fri, 29 Sep 2017 16:01:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Sep 2017 16:00:30 +0000 Original-Received: from localhost ([127.0.0.1]:39431 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dxxiI-0001S3-8u for submit@debbugs.gnu.org; Fri, 29 Sep 2017 12:00:30 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42213) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dxxiG-0001Rl-QD for submit@debbugs.gnu.org; Fri, 29 Sep 2017 12:00:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxxi7-0004S3-Jh for submit@debbugs.gnu.org; Fri, 29 Sep 2017 12:00:23 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:33153) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dxxi7-0004Rt-Dm for submit@debbugs.gnu.org; Fri, 29 Sep 2017 12:00:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxxi0-0007si-H6 for bug-gnu-emacs@gnu.org; Fri, 29 Sep 2017 12:00:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxxhv-0004IP-Is for bug-gnu-emacs@gnu.org; Fri, 29 Sep 2017 12:00:12 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47508) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxxhv-0004IJ-Dv for bug-gnu-emacs@gnu.org; Fri, 29 Sep 2017 12:00:07 -0400 Original-Received: from mail-qk0-f177.google.com ([209.85.220.177]:57186) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1dxxhv-0001Hi-1J for bug-gnu-emacs@gnu.org; Fri, 29 Sep 2017 12:00:07 -0400 Original-Received: by mail-qk0-f177.google.com with SMTP id g128so53789qke.13 for ; Fri, 29 Sep 2017 09:00:06 -0700 (PDT) X-Gm-Message-State: AMCzsaV2I/dITNSmd4cWP6X9r5t3BrM+npJQxr+4vYhFo7LH1Gcn6W6f gFVzlJnczrwuv5Dls5qu4OlAshHIjNqMGFTjbSw= X-Google-Smtp-Source: AOwi7QBjrYfKv6tnkTXyWbCkjFiqSe47jn3CpioiHYKLX1cd5jLoGyXeKJSEnHDOiHv2ui4ABcKUAgcGQ66YoxLbw+M= X-Received: by 10.55.161.85 with SMTP id k82mr3919187qke.156.1506700806349; Fri, 29 Sep 2017 09:00:06 -0700 (PDT) Original-Received: by 10.237.34.225 with HTTP; Fri, 29 Sep 2017 08:59:35 -0700 (PDT) X-Gmail-Original-Message-ID: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:137604 Archived-At: --94eb2c0600bc58674d055a561ebe Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable When mode-line line numbers are on by themselves, L appears. When mode-line column numbers are on by themselves, C appears. When both are on, (,) appears. The latter is inconsistent and always forces the user to remember which is the line and which is the column number. Fixing this is simple, simply remove the parentheses which are no longer needed and add the prefix character to each number for: L,C. This makes the display perfectly consistent, easier to read and does not take up any more character space. Based on some discussion on the emacs-devel list here: https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00976.html =E2=80=8B=E2=80=8B this new patch solves both the consistency problem and the need for easy alteration of the available line and column formats. It extracts the line and col format strings into a new variable so they can be easily changed. Any change to that variable is immediately reflected in the modeline. =E2=80=8B=E2=80=8B Patch to =E2=80=8B=E2=80=8B Emacs 25.3 included below. For Emacs 26, =E2=80=8BI believe there is one additional=E2=80=8B =E2=80=8B=E2=80=8B l =E2=80=8B=E2=80=8B i =E2=80=8B=E2=80=8B n =E2=80=8B=E2=80=8B e =E2=80=8B=E2=80=8B that will need updating. It is an easy manual addition. =E2=80=8B=E2=80=8B Eli, woul =E2=80=8B=E2=80=8B d you =E2=80=8Bconsider this =E2=80=8B =E2=80=8Bchange f=E2=80=8B or Emacs 26? It would be nice to have the consisten =E2=80=8B=E2=80=8B cy =E2=80=8B and for other users to benefit=E2=80=8B . =E2=80=8B=E2=80=8B =E2=80=8B =E2=80=8B=E2=80=8B *** bindings-orig.el 2017-09-29 11:55:31.000000000 -0400 --- bindings.el 2017-09-29 11:55:31.000000000 -0400 *************** *** 350,355 **** --- 350,363 ---- map) "\ Keymap to display on column and line numbers.") + (defvar mode-line-column-line-number-formats + '((line-and-column . " L%l,C%c") + (line . " L%l") + (column . " C%c")) + "Alist of (symbol . format-string) pairs for mode-line numbering display. + SYMBOL may be one of: line-and-column, line or column. + FORMAT-STRING may contain %l for the line number and %c for the column number.") + (defvar mode-line-position `((-3 ,(propertize "%p" *************** *** 368,392 **** mouse-1: Display Line and Column Mode Menu"))) (line-number-mode ((column-number-mode ! (10 ,(propertize ! " (%l,%c)" ! 'local-map mode-line-column-line-number-mode-map ! 'mouse-face 'mode-line-highlight ! 'help-echo "Line number and Column number\n\ ! mouse-1: Display Line and Column Mode Menu")) ! (6 ,(propertize ! " L%l" ! 'local-map mode-line-column-line-number-mode-map ! 'mouse-face 'mode-line-highlight ! 'help-echo "Line Number\n\ ! mouse-1: Display Line and Column Mode Menu")))) ((column-number-mode ! (5 ,(propertize ! " C%c" ! 'local-map mode-line-column-line-number-mode-map ! 'mouse-face 'mode-line-highlight ! 'help-echo "Column number\n\ ! mouse-1: Display Line and Column Mode Menu")))))) "Mode line construct for displaying the position in the buffer. Normally displays the buffer percentage and, optionally, the buffer size, the line number and the column number.") --- 376,400 ---- mouse-1: Display Line and Column Mode Menu"))) (line-number-mode ((column-number-mode ! (10 (:eval (propertize ! (or (cdr (assq 'line-and-column mode-line-column-line-number-formats)) " ") ! 'local-map mode-line-column-line-number-mode-map ! 'mouse-face 'mode-line-highlight ! 'help-echo "Line number and Column number\n\ ! mouse-1: Display Line and Column Mode Menu"))) ! (6 (:eval (propertize ! (or (cdr (assq 'line mode-line-column-line-number-formats)) " ") ! 'local-map mode-line-column-line-number-mode-map ! 'mouse-face 'mode-line-highlight ! 'help-echo "Line Number\n\ ! mouse-1: Display Line and Column Mode Menu"))))) ((column-number-mode ! (5 (:eval (propertize ! (or (cdr (assq 'column mode-line-column-line-number-formats)) " ") ! 'local-map mode-line-column-line-number-mode-map ! 'mouse-face 'mode-line-highlight ! 'help-echo "Column number\n\ ! mouse-1: Display Line and Column Mode Menu"))))))) "Mode line construct for displaying the position in the buffer. Normally displays the buffer percentage and, optionally, the buffer size, the line number and the column number.") --94eb2c0600bc58674d055a561ebe Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
When mode-line line numbers are on by themselves, L<line-nu= m> appears.
When mode-line column numbers are on by t= hemselves, C<col-num> appears.
When both are on, (<line-num>,<col-num>) appears= .

The latter is inconsistent and always= forces the user to remember which is the line and which is the column numb= er.=C2=A0 Fixing this is simple, simply remove the parentheses which are no= longer needed and add the prefix character to each number for:=C2=A0 L<= line-num>,C<col-num>.=C2=A0 This makes the display perfectly consi= stent, easier to read and does not take up any more character space.=

Based on some discussion on the em= acs-devel list here:
=C2=A0=C2=A0<= /div>
this = new patch solves both the consistency problem and the need for easy alterat= ion of the available line and column formats.=C2=A0 It extracts the line an= d col format strings into a new variable so they can be easily changed.=C2= =A0 Any change to that variable is immediately reflected in the modeline.

=E2=80= =8B=E2=80=8B
Patch to
=E2=80=8B=E2=80=8B
Emacs 25.3 in= cluded below.=C2=A0 For Emacs 26,=C2=A0
=E2=80=8BI believe ther= e is one additional=E2=80=8B
=E2=80=8B=E2=80=8B
l=E2=80=8B=E2=80=8B
i
=E2=80=8B=E2=80=8B
n
=E2=80=8B=E2=80=8B
e
=E2=80=8B=E2=80=8B that will need u= pdating.=C2=A0 It is an easy manual addition.

=E2=80=8B=E2=80=8B
Eli, woul<= div class=3D"gmail_default" style=3D"font-family:monospace,monospace;displa= y:inline">=E2=80=8B=E2=80=8B
d you
=E2=80=8Bconsider this = =E2=80=8B
=E2=80=8Bchange=C2=A0
f=E2=80=8B<= /div>or Emacs 26?=C2=A0 It would be nice to have the consisten
= =E2=80=8B=E2=80=8B
cy
=E2=80=8B and for other users to benef= it=E2=80=8B
.
=E2=80=8B=E2=80=8B
=E2=80=8B

=E2=80=8B=E2=80=8B
*** bindings-orig.el 2017-09-29 11:55:31.000000000 -0400
--- bindings.el = 2017-09-29 11:55:31.000000000 -0400
***************
*** 350,355 ****
--- 350,363 ----
=C2=A0 =C2=A0 =C2=A0 map) "\
=C2=A0 Keymap to display on column and line numbers."= )
=C2=A0=C2=A0<= /div>
+ (defvar mode-line-column-li= ne-number-formats
+=C2= =A0 =C2=A0'((line-and-column . " L%l,C%c")
<= font face=3D"monospace, monospace">+=C2=A0 =C2=A0 =C2=A0(line=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 . " L%l")
+=C2=A0 =C2=A0 =C2=A0(column=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 . " C%c"))
+=C2=A0 =C2=A0"Alist of (symbol . format-string) pairs fo= r mode-line numbering display.
+ SYMBOL may be one of: line-and-column, line or column.
+ FORMAT-STRING may contain %l = for the line number and %c for the column number.")
<= font face=3D"monospace, monospace">+=C2=A0
=C2=A0 (defvar mode-line-position
=C2=A0 =C2=A0 `((-3 ,(propertize
=C2=A0 =C2=A0 "%p"
***************
*** 368,392 ****
=C2=A0 mouse-1: Display Line and Column Mode Menu")))
=C2=A0 =C2=A0 =C2=A0 (line-number= -mode
=C2=A0 =C2=A0 = =C2=A0 =C2=A0((column-number-mode
!=C2=A0 =C2=A0 =C2=A0 =C2=A0 (10 ,(propertize
= ! =C2=A0 =C2=A0 =C2=A0" (%l,%c)"
! =C2=A0 =C2= =A0 =C2=A0'local-map mode-line-column-line-number-mode-map
=
! = =C2=A0 =C2=A0 =C2=A0'mouse-face 'mode-line-highlight=
! =C2=A0 =C2=A0 =C2=A0'help-echo "Line number and Colu= mn number\n\
! mouse-1= : Display Line and Column Mode Menu"))
!=C2=A0 =C2=A0 =C2=A0 =C2=A0 (6 ,(propertize
! =C2=A0 =C2=A0 " L%l"
! =C2=A0 =C2= =A0 'local-map mode-line-column-line-number-mode-map
<= font face=3D"monospace, monospace">! =C2=A0 =C2=A0 'mouse-face 'mode-line-highlight
<= font face=3D"monospace, monospace">! =C2=A0 =C2=A0 'help-echo "Line Number\n\
! mouse-1: Display Line and Column Mode Menu&= quot;))))
=C2=A0 =C2= =A0 =C2=A0 =C2=A0((column-number-mode
!=C2=A0 =C2=A0 =C2=A0 =C2=A0 (5 ,(propertize
! <= /span>=C2=A0 =C2=A0 " C%c"
! =C2=A0 =C2=A0 '= ;local-map mode-line-column-line-number-mode-map
! =C2=A0= =C2=A0 'mouse-face 'mode-line-highlight
! =C2=A0= =C2=A0 'help-echo "Column number\n\
! mouse-1: Display Line and Column Mode Menu"= ;))))))
=C2=A0 =C2=A0 = "Mode line construct for displaying the position in the buffer.=
=C2=A0 Normally displays the= buffer percentage and, optionally, the
=C2=A0 buffer size, the line number and the column number= .")
--- 376,400 -= ---
=C2=A0 mouse-1: Di= splay Line and Column Mode Menu")))
=C2=A0 =C2=A0 =C2=A0 (line-number-mode
= =C2=A0 =C2=A0 =C2=A0 =C2=A0((column-num= ber-mode
!=C2=A0 =C2= =A0 =C2=A0 =C2=A0 (10 (:eval (propertize
! =C2=A0 =C2=A0= (or (cdr (assq 'line-and-column mode-line-column-line-number-formats)) = " ")
! =C2=A0 =C2=A0'local-map mode-line-c= olumn-line-number-mode-map
! =C2=A0 =C2=A0'mouse-fac= e 'mode-line-highlight
! =C2=A0 =C2=A0'help-echo= "Line number and Column number\n\
! mouse-1: Display Line and Column Mode Menu")))
!=C2=A0 =C2=A0 =C2=A0 =C2= =A0 (6 (:eval (propertize
! =C2=A0 (or (cdr (assq 'l= ine mode-line-column-line-number-formats)) " ")
= ! =C2=A0 'local-map mode-line-column-line-number-mode-map
! =C2=A0 'mouse-face 'mode-line-highlight
= ! =C2=A0 'help-echo "Line Number\n\
! mouse-1: Display Line and Column Mode Menu"= ;)))))
=C2=A0 =C2=A0 = =C2=A0 =C2=A0((column-number-mode
!=C2=A0 =C2=A0 =C2=A0 =C2=A0 (5 (:eval (propertize
=
! = =C2=A0 (or (cdr (assq 'column mode-line-column-line-number-for= mats)) " ")
= ! =C2=A0 'local-map mode-line-= column-line-number-mode-map
! =C2=A0 'mouse-face = 9;mode-line-highlight
= ! =C2=A0 'help-echo "Colu= mn number\n\
! mouse-1= : Display Line and Column Mode Menu")))))))
=C2=A0 =C2=A0 "Mode line construct for disp= laying the position in the buffer.
=C2=A0 Normally displays the buffer percentage and, optionally= , the
=C2=A0 buffer si= ze, the line number and the column number.")

--94eb2c0600bc58674d055a561ebe--