all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#28648: Make mode-line number display consistent when both line and col numbers are shown.
@ 2017-09-29 15:59 Robert Weiner
       [not found] ` <handler.28648.B.15067008305588.ack@debbugs.gnu.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Robert Weiner @ 2017-09-29 15:59 UTC (permalink / raw)
  To: 28648

[-- Attachment #1: Type: text/plain, Size: 4387 bytes --]

When mode-line line numbers are on by themselves, L<line-num> appears.
When mode-line column numbers are on by themselves, 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 number.  Fixing this is simple, simply
remove the parentheses which are no longer needed and add the prefix
character to each number for:  L<line-num>,C<col-num>.  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
​​

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.

​​
Patch to
​​
Emacs 25.3 included below.  For Emacs 26,
​I believe there is one additional​
​​
l
​​
i
​​
n
​​
e
​​ that will need updating.  It is an easy manual addition.

​​
Eli, woul
​​
d you
​consider this ​
​change
f​
or Emacs 26?  It would be nice to have the consisten
​​
cy
​ and for other users to benefit​
.
​​
​

​​
*** 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.")

[-- Attachment #2: Type: text/html, Size: 12744 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Make mode-line number display consistent when both line and col numbers are shown.
@ 2017-09-28 21:56 Robert Weiner
  2017-09-29  7:02 ` Colin Baxter
  2017-09-29 17:06 ` Eli Zaretskii
  0 siblings, 2 replies; 14+ messages in thread
From: Robert Weiner @ 2017-09-28 21:56 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

When mode-line line numbers are on by themselves, L<line-num> appears.
When mode-line column numbers are on by themselves, 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 number.  Fixing this is simple, simply
remove the parentheses which are no longer needed and add the prefix
character to each number for:  L<line-num>,C<col-num>.  This makes the
display perfectly consistent, easier to read and does not take up any more
character space.

Patch to Emacs 25.3 included below.  For Emacs 26, 2 lines have to change
rather than one.  It is an easy manual fix.

Eli, would you change this for Emacs 26?  It would be nice to have the
consistency.

*** bindings-orig.el 2017-09-28 17:48:59.000000000 -0400
--- bindings.el 2017-09-28 17:48:59.000000000 -0400
***************
*** 369,375 ****
      (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\
--- 369,375 ----
      (line-number-mode
       ((column-number-mode
         (10 ,(propertize
!      " L%l,C%c"
       'local-map mode-line-column-line-number-mode-map
       'mouse-face 'mode-line-highlight
       'help-echo "Line number and Column number\n\

[-- Attachment #2: Type: text/html, Size: 4205 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-09-15 15:09 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-29 15:59 bug#28648: Make mode-line number display consistent when both line and col numbers are shown Robert Weiner
     [not found] ` <handler.28648.B.15067008305588.ack@debbugs.gnu.org>
2017-10-19 20:32   ` bug#28648: Acknowledgement (Make mode-line number display consistent when both line and col numbers are shown.) Robert Weiner
2020-09-15 15:09     ` Lars Ingebrigtsen
  -- strict thread matches above, loose matches on Subject: below --
2017-09-28 21:56 Make mode-line number display consistent when both line and col numbers are shown Robert Weiner
2017-09-29  7:02 ` Colin Baxter
2017-09-29  8:25   ` Jose Arroyo
2017-09-29  9:22     ` Colin Baxter
2017-09-29 13:26       ` Robert Weiner
2017-09-29 17:35         ` John Wiegley
2017-09-29 18:16           ` Eli Zaretskii
2017-09-29 18:20             ` bug#28648: " Robert Weiner
2017-09-29 17:06 ` Eli Zaretskii
2017-09-29 17:45   ` bug#28648: " Robert Weiner
2017-09-29 18:20     ` Eli Zaretskii
2017-09-29 18:48       ` Robert Weiner
2017-09-29 21:55         ` Richard Stallman
2017-09-29 17:49   ` John Wiegley
2017-09-29 18:17     ` bug#28648: " Robert Weiner
2017-09-29 19:15       ` Eli Zaretskii
2017-09-29 19:23         ` Robert Weiner
2017-09-29 20:08           ` Eli Zaretskii
2017-09-29 20:15             ` Robert Weiner
2017-09-30  3:03             ` Drew Adams

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.