Fix up previous change for column/line spec mechanism in the mode line
* lisp/bindings.el (column-number-indicator-zero-based): Make obsolete (bug#28648). (mode-line-position-column-line-format): New variable. (mode-line-position--column-line-properties): New const. (mode-line-position): Use it.
This commit is contained in:
parent
c6291d6efe
commit
cd151d0608
3 changed files with 57 additions and 48 deletions
|
@ -2177,11 +2177,18 @@ number.
|
|||
The format used to display column numbers when
|
||||
@code{column-number-mode} (@pxref{Optional Mode Line,,, emacs, The GNU
|
||||
Emacs Manual}) is switched on. @samp{%c} in the format will be
|
||||
replaced with the line number, and this is zero-based if
|
||||
replaced with the column number, and this is zero-based if
|
||||
@code{column-number-indicator-zero-based} is non-@code{nil}, and
|
||||
one-based if @code{column-number-indicator-zero-based} is @code{nil}.
|
||||
@end defvar
|
||||
|
||||
@defvar mode-line-position-column-line-format
|
||||
The format used to display column numbers when both
|
||||
@code{line-number-mode} and @code{column-number-mode} are switched on.
|
||||
See the previous two variables for the meaning of the @samp{%l} and
|
||||
@samp{%c} format specs.
|
||||
@end defvar
|
||||
|
||||
@defvar minor-mode-alist
|
||||
@anchor{Definition of minor-mode-alist}
|
||||
This variable holds an association list whose elements specify how the
|
||||
|
|
8
etc/NEWS
8
etc/NEWS
|
@ -1001,10 +1001,10 @@ window after starting). This variable defaults to nil.
|
|||
+++
|
||||
*** New user options to control the look of line/column numbers in the mode line.
|
||||
'mode-line-position-line-format' is the line number format (when
|
||||
'line-number-mode' is on), and 'mode-line-position-column-format' is
|
||||
the column number format (when 'column-number-mode' is on). These are
|
||||
also used if both modes are on, which leads to the default in that
|
||||
case going from "(5,9)" to "(L5,C9)".
|
||||
'line-number-mode' is on), 'mode-line-position-column-format' is
|
||||
the column number format (when 'column-number-mode' is on), and
|
||||
'mode-line-position-column-line-format' is the combined format (when
|
||||
both modes are on).
|
||||
|
||||
+++
|
||||
*** New command 'submit-emacs-patch'.
|
||||
|
|
|
@ -411,6 +411,8 @@ zero, otherwise they start from one."
|
|||
:type 'boolean
|
||||
:group 'mode-line
|
||||
:version "26.1")
|
||||
(make-obsolete-variable 'column-number-indicator-zero-based
|
||||
'mode-line-position-column-format "28.1")
|
||||
|
||||
(defcustom mode-line-percent-position '(-3 "%p")
|
||||
"Specification of \"percentage offset\" of window through buffer.
|
||||
|
@ -431,24 +433,41 @@ displayed in `mode-line-position', a component of the default
|
|||
:group 'mode-line)
|
||||
(put 'mode-line-percent-position 'risky-local-variable t)
|
||||
|
||||
(defcustom mode-line-position-line-format "L%l"
|
||||
(defcustom mode-line-position-line-format '(-6 " L%l")
|
||||
"Format used to display line numbers in the mode line.
|
||||
This is used when `line-number-mode' is switched on. The \"%l\"
|
||||
format spec will be replaced by the line number."
|
||||
:type 'string
|
||||
:type 'form
|
||||
:version "28.1"
|
||||
:group 'mode-line)
|
||||
|
||||
(defcustom mode-line-position-column-format "C%c"
|
||||
(defcustom mode-line-position-column-format '(-6 " C%c")
|
||||
"Format used to display column numbers in the mode line.
|
||||
This is used when `column-number-mode' is switched on. The
|
||||
\"%c\" format spec will be replaced by the column number, which
|
||||
is zero-based if `column-number-indicator-zero-based' is non-nil,
|
||||
and one-based if `column-number-indicator-zero-based' is nil."
|
||||
:type 'string
|
||||
and one-based if `column-number-indicator-zero-based' is nil.."
|
||||
:type 'form
|
||||
:version "28.1"
|
||||
:group 'mode-line)
|
||||
|
||||
(defcustom mode-line-position-column-line-format '(-10 " (%l,%c)")
|
||||
"Format used to display combined line/column numbers in the mode line.
|
||||
This is used when `column-number-mode' and `line-number-mode' are
|
||||
switched on. The \"%c\" format spec will be replaced by the
|
||||
column number, which is zero-based if
|
||||
`column-number-indicator-zero-based' is non-nil, and one-based if
|
||||
`column-number-indicator-zero-based' is nil."
|
||||
:type 'form
|
||||
:version "28.1"
|
||||
:group 'mode-line)
|
||||
|
||||
(defconst mode-line-position--column-line-properties
|
||||
(list '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"))
|
||||
|
||||
(defvar mode-line-position
|
||||
`((:propertize
|
||||
mode-line-percent-position
|
||||
|
@ -468,44 +487,27 @@ mouse-1: Display Line and Column Mode Menu")))
|
|||
(line-number-mode
|
||||
((column-number-mode
|
||||
(column-number-indicator-zero-based
|
||||
(10 ,(propertize
|
||||
(format " (%s,%s)"
|
||||
mode-line-position-line-format
|
||||
mode-line-position-column-format)
|
||||
'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"))
|
||||
(10 ,(propertize
|
||||
(format " (%s,%s)"
|
||||
mode-line-position-line-format
|
||||
(replace-in-string "%c" "%C"
|
||||
mode-line-position-column-format))
|
||||
'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
|
||||
(format " %s" mode-line-position-line-format)
|
||||
'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
|
||||
(column-number-indicator-zero-based
|
||||
(5 ,(propertize
|
||||
(format " %s" mode-line-position-column-format)
|
||||
'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"))
|
||||
(5 ,(propertize
|
||||
(format " %s" (replace-in-string "%c" "%C"
|
||||
mode-line-position-column-format))
|
||||
'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")))))))
|
||||
(:propertize
|
||||
mode-line-position-column-line-format
|
||||
,@mode-line-position--column-line-properties)
|
||||
(:propertize
|
||||
(,(car mode-line-position-column-line-format)
|
||||
(:eval (replace-in-string
|
||||
"%c" "%C" (cadr mode-line-position-column-line-format))))
|
||||
,@mode-line-position--column-line-properties))
|
||||
(:propertize
|
||||
mode-line-position-line-format
|
||||
,@mode-line-position--column-line-properties)))
|
||||
(column-number-mode
|
||||
(column-number-indicator-zero-based
|
||||
(:propertize
|
||||
mode-line-position-column-format
|
||||
,@mode-line-position--column-line-properties)
|
||||
(:propertize
|
||||
(,(car mode-line-position-column-format)
|
||||
(:eval (replace-in-string
|
||||
"%c" "%C" (cadr mode-line-position-column-format))))
|
||||
,@mode-line-position--column-line-properties)))))
|
||||
"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.")
|
||||
|
|
Loading…
Add table
Reference in a new issue