diff options
author | Alan Mackenzie <acm@muc.de> | 2017-05-21 10:16:09 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2017-05-21 10:16:09 +0000 |
commit | b0b02ca7f3e06d0f092df6f81babd1277bf93b0f (patch) | |
tree | 8d5d40e2150d975bd4a4a67e3190fe65b0f9ed37 /lisp/bindings.el | |
parent | 9759b249e97d4b05644309fc70ae9277b347027e (diff) | |
download | emacs-b0b02ca7f3e06d0f092df6f81babd1277bf93b0f.tar.gz |
Enhance mode-line percentage offset facility, with "%o" and "%q"
"%o" will display the percentage "travel" of the window through the buffer.
"%q" will display a combination of the percentage offsets of the top and
bottom of the window. The new user option mode-line-percent-position will
facilitate selecting a setting for this part of the mode line.
* lisp/bindings.el (mode-line-percent-position): New customizable user option.
(mode-line-position): Use mode-line-percent-position in place of "%p", etc.
* src/xdisp.c (decode_mode_spec): Add handlers for "%o" and "%q".
* doc/lispref/modes.texi (Mode Line Variables): Document
mode-line-percent-position.
(%-Constructs): Document %o and %q.
* etc/NEWS: Add an entry for these new facilities.
Diffstat (limited to 'lisp/bindings.el')
-rw-r--r-- | lisp/bindings.el | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/lisp/bindings.el b/lisp/bindings.el index 85a54087178..0b4c3bda80f 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -365,14 +365,32 @@ zero, otherwise they start from one." :group 'mode-line :version "26.1") +(defcustom mode-line-percent-position '(-3 "%p") + "Specification of \"percentage offset\" of window through buffer +This option specifies both the field width and the type of offset +displayed in `mode-line-position', a component of the default +`mode-line-format'." + :type `(radio + (const :tag "nil: No offset is displayed" nil) + (const :tag "\"%o\": Proportion of \"travel\" of the window through the buffer" + (-3 "%o")) + (const :tag "\"%p\": Percentage offset of top of window" + (-3 "%p")) + (const :tag "\"%P\": Precentage offset of bottom of window" + (-3 "%P")) + (const :tag "\"%q\": Offsets of both top and bottom of window" + (6 "%q"))) + :version "26.1" + :group 'mode-line) + (defvar mode-line-position - `((-3 ,(propertize - "%p" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - ;; XXX needs better description - 'help-echo "Size indication mode\n\ -mouse-1: Display Line and Column Mode Menu")) + `((:propertize + mode-line-percent-position + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + ;; XXX needs better description + 'help-echo "Size indication mode\n\ +mouse-1: Display Line and Column Mode Menu") (size-indication-mode (8 ,(propertize " of %I" |