summaryrefslogtreecommitdiff
path: root/lisp/use-package/bind-key.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2014-02-18 16:36:18 -0600
committerJohn Wiegley <johnw@newartisans.com>2014-02-18 16:36:18 -0600
commit0f7d54d1db28f8db2c3f03be125e06e347464393 (patch)
tree0b170e001e06166a7c99ad10dc91e49e6173fac0 /lisp/use-package/bind-key.el
parente23bce4c2f0c42390c9462d80792917e4372b06c (diff)
parent38d4d2e2dac995a086af5060f42ba823aab7c039 (diff)
downloademacs-0f7d54d1db28f8db2c3f03be125e06e347464393.tar.gz
emacs-0f7d54d1db28f8db2c3f03be125e06e347464393.tar.bz2
emacs-0f7d54d1db28f8db2c3f03be125e06e347464393.zip
Merge pull request from Fuco1/variable-col-width
Add variable column width GitHub-reference: https://github.com/jwiegley/use-package/issues/90
Diffstat (limited to 'lisp/use-package/bind-key.el')
-rw-r--r--lisp/use-package/bind-key.el17
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/use-package/bind-key.el b/lisp/use-package/bind-key.el
index a6bba121fe7..1081486b99f 100644
--- a/lisp/use-package/bind-key.el
+++ b/lisp/use-package/bind-key.el
@@ -88,6 +88,11 @@
"A simple way to manage personal keybindings"
:group 'emacs)
+(defcustom bind-key-column-widths '(18 . 40)
+ "Width of columns in `describe-personal-keybindings'."
+ :type '(cons integer integer)
+ :group 'bind-key)
+
(defcustom bind-key-segregation-regexp
"\\`\\(\\(C-[chx] \\|M-[gso] \\)\\([CM]-\\)?\\|.+-\\)"
"Regular expression used to divide key sets in the output from
@@ -244,9 +249,11 @@ function symbol (unquoted)."
"Display all the personal keybindings defined by `bind-key'."
(interactive)
(with-output-to-temp-buffer "*Personal Keybindings*"
- (princ "Key name Command Comments
------------------ --------------------------------------- ---------------------
-")
+ (princ (format "Key name%s Command%s Comments\n%s %s ---------------------\n"
+ (make-string (- (car bind-key-column-widths) 9) ? )
+ (make-string (- (cdr bind-key-column-widths) 8) ? )
+ (make-string (1- (car bind-key-column-widths)) ?-)
+ (make-string (1- (cdr bind-key-column-widths)) ?-)))
(let (last-binding)
(dolist (binding
(setq personal-keybindings
@@ -257,7 +264,7 @@ function symbol (unquoted)."
(if (not (eq (cdar last-binding) (cdar binding)))
(princ (format "\n\n%s\n%s\n\n"
(cdar binding)
- (make-string 79 ?-)))
+ (make-string (+ 21 (car bind-key-column-widths) (cdr bind-key-column-widths)) ?-)))
(if (and last-binding
(cdr (compare-keybindings last-binding binding)))
(princ "\n")))
@@ -275,7 +282,7 @@ function symbol (unquoted)."
)
(let ((line
(format
- "%-18s%-40s%s\n"
+ (format "%%-%ds%%-%ds%%s\n" (car bind-key-column-widths) (cdr bind-key-column-widths))
key-name (format "`%s\'" command-desc)
(if (string= command-desc at-present-desc)
(if (or (null was-command)