]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/package.el: Improve package-menu-quick-help
authorArtur Malabarba <bruce.connor.am@gmail.com>
Sun, 12 Apr 2015 02:08:21 +0000 (03:08 +0100)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Sun, 12 Apr 2015 02:09:50 +0000 (03:09 +0100)
(package--quick-help-keys): New variable.
(package--prettify-quick-help-key): New function.
(package-menu-quick-help): Use it.

lisp/emacs-lisp/package.el

index 8920bf6a81ddf53306387b34c5f24e974a44b0d6..745c5bf5dc4585b09129e35161ae81d91175f821 100644 (file)
@@ -2639,10 +2639,31 @@ If optional arg BUTTON is non-nil, describe its associated package."
           (tabulated-list-put-tag "D" t)
         (forward-line 1)))))
 
+(defvar package--quick-help-keys
+  '(("install," "delete," "unmark," ("execute" . 1))
+    ("next," "previous")
+    ("refresh-contents," "g-redisplay," "filter," "help")))
+
+(defun package--prettify-quick-help-key (desc)
+  "Prettify DESC to be displayed as a help menu."
+  (if (listp desc)
+      (if (listp (cdr desc))
+          (mapconcat #'package--prettify-quick-help-key desc "   ")
+        (let ((place (cdr desc))
+              (out (car desc)))
+          ;; (setq out (propertize out 'face 'paradox-comment-face))
+          (add-text-properties place (1+ place)
+                               '(face (bold font-lock-function-name-face))
+                               out)
+          out))
+    (package--prettify-quick-help-key (cons desc 0))))
+
 (defun package-menu-quick-help ()
-  "Show short key binding help for package-menu-mode."
+  "Show short key binding help for `package-menu-mode'.
+The full list of keys can be viewed with \\[describe-mode]."
   (interactive)
-  (message "n-ext, i-nstall, d-elete, u-nmark, x-ecute, r-efresh, h-elp"))
+  (message (mapconcat #'package--prettify-quick-help-key
+                      package--quick-help-keys "\n")))
 
 (define-obsolete-function-alias
   'package-menu-view-commentary 'package-menu-describe-package "24.1")