From 2ee72cc4361031f3ab34e312fca191125ce18bfc Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 15 Jan 2015 20:04:24 -0200 Subject: Move tag-format to sx-tag.el --- sx-tag.el | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sx-tag.el') diff --git a/sx-tag.el b/sx-tag.el index b2ad375..d69f330 100644 --- a/sx-tag.el +++ b/sx-tag.el @@ -133,6 +133,12 @@ tags." (push input list)) (reverse list))) + +;;; Printing +(defun sx-tag--format (tag) + "Formats TAG for display." + (concat "[" tag "]")) + (provide 'sx-tag) ;;; sx-tag.el ends here -- cgit v1.2.3 From feb8082bac11154d4f6cc768add49bd9b7c0c107 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 15 Jan 2015 22:02:41 -0200 Subject: Turn tags into buttons --- sx-tag.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sx-tag.el') diff --git a/sx-tag.el b/sx-tag.el index d69f330..ba32544 100644 --- a/sx-tag.el +++ b/sx-tag.el @@ -137,7 +137,12 @@ tags." ;;; Printing (defun sx-tag--format (tag) "Formats TAG for display." - (concat "[" tag "]")) + (with-temp-buffer + (insert-text-button (concat "[" tag "]") + 'sx-button-copy tag + 'sx-tag tag + :type 'sx-button-tag) + (buffer-string))) (provide 'sx-tag) ;;; sx-tag.el ends here -- cgit v1.2.3 From 74fce2c36f803abe232eebe9f542696b8d0fac23 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 15 Jan 2015 22:07:48 -0200 Subject: Always use sx-tag face for tags --- sx-question-list.el | 8 +------- sx-question-print.el | 7 +------ sx-tag.el | 6 ++++++ 3 files changed, 8 insertions(+), 13 deletions(-) (limited to 'sx-tag.el') diff --git a/sx-question-list.el b/sx-question-list.el index 306d39f..256bdb4 100644 --- a/sx-question-list.el +++ b/sx-question-list.el @@ -81,11 +81,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 +165,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-tag--format .tags " ")) - 'face 'sx-question-list-tags) + (format "%-40s" (mapconcat #'sx-tag--format .tags " ")) " " (sx-user--format "%15d %4r" .owner) (propertize " " 'display "\n"))))))) diff --git a/sx-question-print.el b/sx-question-print.el index 0ae0f04..6791222 100644 --- a/sx-question-print.el +++ b/sx-question-print.el @@ -79,11 +79,6 @@ Some faces of this mode might be defined in the `sx-user' group." :type 'string :group 'sx-question-mode) -(defface sx-question-mode-tags - '((t :underline nil :inherit font-lock-function-name-face)) - "Face used on the question tags in the question buffer." - :group 'sx-question-mode-faces) - (defface sx-question-mode-score '((t)) "Face used for the score in the question buffer." @@ -224,7 +219,7 @@ DATA can represent a question or an answer." (sx-question-mode--insert-header sx-question-mode-header-tags (mapconcat #'sx-tag--format .tags " ") - 'sx-question-mode-tags)) + nil)) ;; Body (insert "\n" (propertize sx-question-mode-separator diff --git a/sx-tag.el b/sx-tag.el index ba32544..d9e2877 100644 --- a/sx-tag.el +++ b/sx-tag.el @@ -24,6 +24,12 @@ (require 'sx) (require 'sx-method) +(defface sx-tag + '((t :underline nil :inherit font-lock-function-name-face)) + "Face used on the question tags in the question buffer." + :group 'sx-question-mode-faces + :group 'sx-question-list-faces) + ;;; Getting the list from a site (defconst sx-tag-filter -- cgit v1.2.3 From 33746908e639e53320fe1412ae01b01854a98605 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 15 Jan 2015 22:31:08 -0200 Subject: Define sx-tag--insert --- sx-tag.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'sx-tag.el') diff --git a/sx-tag.el b/sx-tag.el index d9e2877..009c8b1 100644 --- a/sx-tag.el +++ b/sx-tag.el @@ -142,14 +142,18 @@ tags." ;;; Printing (defun sx-tag--format (tag) - "Formats TAG for display." + "Format and return TAG for display." (with-temp-buffer - (insert-text-button (concat "[" tag "]") - 'sx-button-copy tag - 'sx-tag tag - :type 'sx-button-tag) + (sx-tag--insert tag) (buffer-string))) +(defun sx-tag--insert (tag) + "Insert TAG button." + (insert-text-button (concat "[" tag "]") + 'sx-button-copy tag + 'sx-tag tag + :type 'sx-button-tag)) + (provide 'sx-tag) ;;; sx-tag.el ends here -- cgit v1.2.3 From 058cca312d48ad44dc8b633be74e5731446d158e Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 15 Jan 2015 22:46:32 -0200 Subject: require 'sx-button --- sx-tag.el | 1 + 1 file changed, 1 insertion(+) (limited to 'sx-tag.el') diff --git a/sx-tag.el b/sx-tag.el index 009c8b1..316226b 100644 --- a/sx-tag.el +++ b/sx-tag.el @@ -23,6 +23,7 @@ (require 'sx) (require 'sx-method) +(require 'sx-button) (defface sx-tag '((t :underline nil :inherit font-lock-function-name-face)) -- cgit v1.2.3