GNU bug report logs -
#28648
Make mode-line number display consistent when both line and col numbers are shown.
Previous Next
Reported by: rswgnu <at> gmail.com
Date: Fri, 29 Sep 2017 16:01:02 UTC
Severity: wishlist
Tags: fixed
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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.")
[Message part 2 (text/html, inline)]
This bug report was last modified 4 years and 333 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.