summaryrefslogtreecommitdiff
path: root/lisp/bindings.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/bindings.el')
-rw-r--r--lisp/bindings.el97
1 files changed, 65 insertions, 32 deletions
diff --git a/lisp/bindings.el b/lisp/bindings.el
index e3fc5637fab..250234e94c1 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -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,6 +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")
+ "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 '(list string)
+ :version "28.1"
+ :group 'mode-line)
+
+(defcustom mode-line-position-column-format '(" 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 '(list string)
+ :version "28.1"
+ :group 'mode-line)
+
+(defcustom mode-line-position-column-line-format '(" (%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 '(list string)
+ :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
@@ -450,38 +487,30 @@ mouse-1: Display Line and Column Mode Menu")))
(line-number-mode
((column-number-mode
(column-number-indicator-zero-based
- (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"))
- (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
- (column-number-indicator-zero-based
- (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"))
- (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")))))))
+ (10
+ (:propertize
+ mode-line-position-column-line-format
+ ,@mode-line-position--column-line-properties))
+ (10
+ (:propertize
+ (:eval (string-replace
+ "%c" "%C" (car mode-line-position-column-line-format)))
+ ,@mode-line-position--column-line-properties)))
+ (6
+ (:propertize
+ mode-line-position-line-format
+ ,@mode-line-position--column-line-properties))))
+ (column-number-mode
+ (column-number-indicator-zero-based
+ (6
+ (:propertize
+ mode-line-position-column-format
+ (,@mode-line-position--column-line-properties)))
+ (6
+ (:propertize
+ (:eval (string-replace
+ "%c" "%C" (car 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.")
@@ -889,6 +918,7 @@ if `inhibit-field-text-motion' is non-nil."
(define-key narrow-map "n" 'narrow-to-region)
(define-key narrow-map "w" 'widen)
+(define-key narrow-map "g" 'goto-line-relative)
;; Quitting
(define-key global-map "\e\e\e" 'keyboard-escape-quit)
@@ -1383,6 +1413,9 @@ if `inhibit-field-text-motion' is non-nil."
(define-key ctl-x-map "'" 'expand-abbrev)
(define-key ctl-x-map "\C-b" 'list-buffers)
+(define-key ctl-x-map "\C-j" 'dired-jump)
+(define-key ctl-x-4-map "\C-j" 'dired-jump-other-window)
+
(define-key ctl-x-map "z" 'repeat)
(define-key esc-map "\C-l" 'reposition-window)