: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.
: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
(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.")