aboutsummaryrefslogtreecommitdiff
path: root/sx-question-list.el
diff options
context:
space:
mode:
Diffstat (limited to 'sx-question-list.el')
-rw-r--r--sx-question-list.el39
1 files changed, 12 insertions, 27 deletions
diff --git a/sx-question-list.el b/sx-question-list.el
index 7757503..def490b 100644
--- a/sx-question-list.el
+++ b/sx-question-list.el
@@ -27,6 +27,7 @@
(require 'sx)
(require 'sx-time)
+(require 'sx-tag)
(require 'sx-site)
(require 'sx-question)
(require 'sx-question-mode)
@@ -81,11 +82,6 @@
""
:group 'sx-question-list-faces)
-(defface sx-question-list-tags
- '((t :inherit sx-question-mode-tags))
- ""
- :group 'sx-question-list-faces)
-
(defface sx-question-list-date
'((t :inherit font-lock-comment-face))
""
@@ -170,8 +166,7 @@ Also see `sx-question-list-refresh'."
" "
;; @TODO: Make this width customizable. (Or maybe just make
;; the whole thing customizable)
- (propertize (format "%-40s" (mapconcat #'sx-question--tag-format .tags " "))
- 'face 'sx-question-list-tags)
+ (format "%-40s" (sx-tag--format-tags .tags sx-question-list--site))
" "
(sx-user--format "%15d %4r" .owner)
(propertize " " 'display "\n")))))))
@@ -308,7 +303,8 @@ into consideration. The same holds for `sx-question-list--order'.
\\{sx-question-list-mode-map}"
(hl-line-mode 1)
- (sx-question-list--update-mode-line)
+ (setq mode-line-format
+ sx-question-list--mode-line-format)
(setq sx-question-list--pages-so-far 0)
(setq tabulated-list-format
[(" V" 3 t :right-align t)
@@ -320,8 +316,6 @@ into consideration. The same holds for `sx-question-list--order'.
(setq tabulated-list-sort-key nil)
(add-hook 'tabulated-list-revert-hook
#'sx-question-list-refresh nil t)
- (add-hook 'tabulated-list-revert-hook
- #'sx-question-list--update-mode-line nil t)
(setq header-line-format sx-question-list--header-line))
(defcustom sx-question-list-date-sort-method 'last_activity_date
@@ -400,14 +394,14 @@ Non-interactively, DATA is a question alist."
;; "Unanswered", etc.
"Variable describing current tab being viewed.")
-(defvar sx-question-list--total-count 0
- "Holds the total number of questions in the current buffer.")
-(make-variable-buffer-local 'sx-question-list--total-count)
-
(defconst sx-question-list--mode-line-format
- '(" "
- mode-name
- " "
+ '(" "
+ (:propertize
+ (:eval (mapconcat #'capitalize
+ (split-string sx-question-list--site "\\.")
+ " "))
+ face mode-line-buffer-id)
+ " " mode-name ": "
(:propertize sx-question-list--current-tab
face mode-line-buffer-id)
" ["
@@ -418,7 +412,7 @@ Non-interactively, DATA is a question alist."
", "
"Total: "
(:propertize
- (:eval (int-to-string sx-question-list--total-count))
+ (:eval (int-to-string (length tabulated-list-entries)))
face mode-line-buffer-id)
"] ")
"Mode-line construct to use in question-list buffers.")
@@ -429,15 +423,6 @@ Non-interactively, DATA is a question alist."
(cl-count-if-not
#'sx-question--read-p sx-question-list--dataset)))
-(defun sx-question-list--update-mode-line ()
- "Fill the mode-line with useful information."
- ;; All the data we need is right in the buffer.
- (when (derived-mode-p 'sx-question-list-mode)
- (setq mode-line-format
- sx-question-list--mode-line-format)
- (setq sx-question-list--total-count
- (length tabulated-list-entries))))
-
(defvar sx-question-list--site nil
"Site being displayed in the *question-list* buffer.")
(make-variable-buffer-local 'sx-question-list--site)