aboutsummaryrefslogtreecommitdiff
path: root/sx-question-list.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-02-27 00:58:40 -0300
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-02-27 00:58:40 -0300
commita6763f4257829e65b7602f0965a19a7efc310442 (patch)
tree233b3e990e48824782f82bfcd493d3e44ebda119 /sx-question-list.el
parent1e8299a933e115c41d81f00948074085d961e47c (diff)
parentaa1368c104aebf837fd7654deea8d244428616a2 (diff)
Merge branch 'delete-command' into json-false
Diffstat (limited to 'sx-question-list.el')
-rw-r--r--sx-question-list.el76
1 files changed, 36 insertions, 40 deletions
diff --git a/sx-question-list.el b/sx-question-list.el
index 32bc140..4f298a3 100644
--- a/sx-question-list.el
+++ b/sx-question-list.el
@@ -210,19 +210,39 @@ and thus not displayed in the list of questions.
This is ignored if `sx-question-list--refresh-function' is set.")
(make-variable-buffer-local 'sx-question-list--dataset)
+(defconst sx-question-list--key-definitions
+ '(
+ ;; S-down and S-up would collide with `windmove'.
+ ("<down>" sx-question-list-next)
+ ("<up>" sx-question-list-previous)
+ ("RET" sx-display "Display")
+ ("n" sx-question-list-next "Navigate")
+ ("p" sx-question-list-previous "Navigate")
+ ("j" sx-question-list-view-next "Navigate")
+ ("k" sx-question-list-view-previous "Navigate")
+ ("N" sx-question-list-next-far)
+ ("P" sx-question-list-previous-far)
+ ("J" sx-question-list-next-far)
+ ("K" sx-question-list-previous-far)
+ ("g" sx-question-list-refresh)
+ ("t" sx-tab-switch "tab")
+ ("a" sx-ask "ask")
+ ("S" sx-search "Search")
+ ("s" sx-switchto-map "switch-to")
+ ("v" sx-visit-externally "visit")
+ ("u" sx-upvote)
+ ("d" sx-downvote)
+ ("h" sx-question-list-hide "hide")
+ ("m" sx-question-list-mark-read "mark-read")
+ ("*" sx-favorite)
+ )
+ "List of key definitions for `sx-question-list-mode'.
+This list must follow the form described in
+`sx--key-definitions-to-header-line'.")
+
(defconst sx-question-list--header-line
- '(" "
- (:propertize "n p j k" face mode-line-buffer-id)
- ": Navigate"
- " "
- (:propertize "RET" face mode-line-buffer-id)
- ": View question"
- " "
- (:propertize "v" face mode-line-buffer-id)
- ": Visit externally"
- " "
- (:propertize "q" face mode-line-buffer-id)
- ": Quit")
+ (sx--key-definitions-to-header-line
+ sx-question-list--key-definitions)
"Header-line used on the question list.")
(defconst sx-question-list--order-methods
@@ -332,34 +352,10 @@ into consideration. The same holds for `sx-question-list--order'.
;;; Keybinds
-(mapc
- (lambda (x) (define-key sx-question-list-mode-map
- (car x) (cadr x)))
- '(
- ;; S-down and S-up would collide with `windmove'.
- ([down] sx-question-list-next)
- ([up] sx-question-list-previous)
- ("n" sx-question-list-next)
- ("p" sx-question-list-previous)
- ("j" sx-question-list-view-next)
- ("k" sx-question-list-view-previous)
- ("N" sx-question-list-next-far)
- ("P" sx-question-list-previous-far)
- ("J" sx-question-list-next-far)
- ("K" sx-question-list-previous-far)
- ("g" sx-question-list-refresh)
- ("t" sx-tab-switch)
- ("a" sx-ask)
- ("S" sx-search)
- ("s" sx-switchto-map)
- ("v" sx-visit-externally)
- ("u" sx-upvote)
- ("d" sx-downvote)
- ("h" sx-question-list-hide)
- ("m" sx-question-list-mark-read)
- ("*" sx-favorite)
- ([?\r] sx-display)
- ))
+;; We need this quote+eval combo because `kbd' was a macro in 24.2.
+(mapc (lambda (x) (eval `(define-key sx-question-list-mode-map
+ (kbd ,(car x)) #',(cadr x))))
+ sx-question-list--key-definitions)
(defun sx-question-list-hide (data)
"Hide question under point.