From a33de03f6c9f0419d7640bce0ab203fd43607bb4 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sun, 14 Dec 2014 13:39:42 +0000 Subject: Use the header-line as a UI guide. --- sx-question-list.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sx-question-list.el b/sx-question-list.el index 788fc2f..0dfebc4 100644 --- a/sx-question-list.el +++ b/sx-question-list.el @@ -196,6 +196,18 @@ 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) +(defvar 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") + "Header-line used on the question list.") + ;;; Mode Definition (define-derived-mode sx-question-list-mode @@ -266,7 +278,7 @@ into consideration. #'sx-question-list-refresh nil t) (add-hook 'tabulated-list-revert-hook #'sx-question-list--update-mode-line nil t) - (tabulated-list-init-header)) + (setq header-line-format sx-question-list--header-line)) (defcustom sx-question-list-date-sort-method 'last_activity_date "Parameter which controls date sorting." -- cgit v1.2.3 From bc2c6b72e62cbcc1540ce4154760250273e05d04 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sun, 14 Dec 2014 13:39:46 +0000 Subject: Fix up and down keys --- sx-question-list.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sx-question-list.el b/sx-question-list.el index 0dfebc4..69fb435 100644 --- a/sx-question-list.el +++ b/sx-question-list.el @@ -300,8 +300,8 @@ into consideration. (car x) (cadr x))) '( ;; S-down and S-up would collide with `windmove'. - ([down] sx-question-list-view-next) - ([up] sx-question-list-view-previous) + ([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) -- cgit v1.2.3 From 8adc0ac710469949ac28aa664eef965ef179c290 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sun, 14 Dec 2014 13:42:29 +0000 Subject: Use the header-line as a UI guide on the question buffer. --- sx-question-mode.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sx-question-mode.el b/sx-question-mode.el index 5735f47..c45ef9f 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -175,12 +175,31 @@ property." ;;; Major-mode +(defvar sx-question-mode--header-line + '(" " + (:propertize "n p TAB" face mode-line-buffer-id) + ": Navigate" + " " + (:propertize "u d" face mode-line-buffer-id) + ": Up/Down Vote" + " " + (:propertize "c" face mode-line-buffer-id) + ": Comment" + " " + (:propertize "a" face mode-line-buffer-id) + ": Answer" + " " + (:propertize "e" face mode-line-buffer-id) + ": Edit") + "Header-line used on the question list.") + (define-derived-mode sx-question-mode special-mode "Question" "Major mode to display and navigate a question and its answers. Letters do not insert themselves; instead, they are commands. \\ \\{sx-question-mode}" + (setq header-line-format sx-question-mode--header-line) ;; Determine how to close this window. (unless (window-parameter nil 'quit-restore) (set-window-parameter -- cgit v1.2.3 From 4bcdd311b590156998ebf51a14fce31b6d0569ec Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sun, 14 Dec 2014 11:49:56 -0200 Subject: Also mention q --- sx-question-list.el | 5 ++++- sx-question-mode.el | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sx-question-list.el b/sx-question-list.el index 69fb435..f23310c 100644 --- a/sx-question-list.el +++ b/sx-question-list.el @@ -205,7 +205,10 @@ This is ignored if `sx-question-list--refresh-function' is set.") ": View question" " " (:propertize "v" face mode-line-buffer-id) - ": Visit externally") + ": Visit externally" + " " + (:propertize "q" face mode-line-buffer-id) + ": Quit") "Header-line used on the question list.") diff --git a/sx-question-mode.el b/sx-question-mode.el index c45ef9f..68618bb 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -190,7 +190,10 @@ property." ": Answer" " " (:propertize "e" face mode-line-buffer-id) - ": Edit") + ": Edit" + " " + (:propertize "q" face mode-line-buffer-id) + ": Quit") "Header-line used on the question list.") (define-derived-mode sx-question-mode special-mode "Question" -- cgit v1.2.3