aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Allred <code@seanallred.com>2014-11-12 22:15:16 -0500
committerSean Allred <code@seanallred.com>2014-11-12 22:15:16 -0500
commitf1c3473e5b6d20c80b2f2f2ae569748fc247fccd (patch)
treeb45a3ccba7a04c07fb9452903780c1e422b5f915
parentc6dfd63b0ec04911f5a768d754b30663c7516db7 (diff)
Use consistent tag formatting
Puts `mapconcat' to work by defining a helper function `sx-question--tag-format' and `concat'ing them with ` '. Simpler, more maintainable construction.
-rw-r--r--sx-question-list.el3
-rw-r--r--sx-question-mode.el2
-rw-r--r--sx-question.el4
3 files changed, 7 insertions, 2 deletions
diff --git a/sx-question-list.el b/sx-question-list.el
index 79b07be..2fdd376 100644
--- a/sx-question-list.el
+++ b/sx-question-list.el
@@ -240,7 +240,8 @@ Used in the questions list to indicate a question was updated \"4d ago\"."
(propertize (concat (sx-time-since .last_activity_date)
sx-question-list-ago-string)
'face 'sx-question-list-date)
- (propertize (concat " [" (mapconcat #'identity .tags "] [") "]")
+ " "
+ (propertize (mapconcat #'sx-question--tag-format .tags " ")
'face 'sx-question-list-tags)
(propertize " " 'display "\n"))))))
diff --git a/sx-question-mode.el b/sx-question-mode.el
index 0153feb..48c82a4 100644
--- a/sx-question-mode.el
+++ b/sx-question-mode.el
@@ -188,7 +188,7 @@ QUESTION must be a data structure returned by `json-read'."
'sx-question-mode-date
;; Tags
sx-question-mode-header-tags
- (concat "(" (mapconcat 'identity .tags ") (") ")")
+ (mapconcat 'sx-question--tag-format .tags " ")
'sx-question-mode-tags)
(insert sx-question-mode-separator)
(sx-question-mode--wrap-in-overlay
diff --git a/sx-question.el b/sx-question.el
index d3fd79f..0142929 100644
--- a/sx-question.el
+++ b/sx-question.el
@@ -73,6 +73,10 @@ With optional argument predicate, use it instead of `<'."
(cdr (assoc property x))
(cdr (assoc property y))))
+(defun sx-question--tag-format (tag)
+ "Formats TAG for display"
+ (concat "[" tag "]"))
+
(provide 'sx-question)
;;; sx-question.el ends here