From 304217c1ac70ee7dc6f7e4c16410fca73b11c515 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 14:44:24 -0200 Subject: Move user-printing to sx-user --- sx-user.el | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sx-user.el (limited to 'sx-user.el') diff --git a/sx-user.el b/sx-user.el new file mode 100644 index 0000000..975d5ef --- /dev/null +++ b/sx-user.el @@ -0,0 +1,73 @@ +;;; sx-user.el --- handling and printing user information -*- lexical-binding: t; -*- + +;; Copyright (C) 2014 Artur Malabarba + +;; Author: Artur Malabarba + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + + +;;; Code: +(require 'sx) +(require 'sx-button) + +(defgroup sx-user nil + "Customization group for sx-question-mode." + :prefix "sx-user-" + :tag "SX Question Mode" + :group 'sx) + +(defvar sx--user-format-property-alist + '((?d face sx-question-mode-author) + (?r face sx-question-mode-reputation) + (?a face sx-question-mode-accept-rate)) + "Alist relating % constructs with text properties. +See `sx--user-format'.") + +(defun sx--user-format (format-string user) + "Use FORMAT-STRING to format the user object USER. +The value is a copy of FORMAT-STRING, but with certain constructs +replaced by text that describes the specified USER: + +%d is the display name. +%l is the link to the profile. +%r is the reputation. +%a is the accept rate. + +The returned string is additionally propertized as a button with +the `sx-button-user' category." + (sx-assoc-let (append user sx-question-mode-fallback-user) + (let* ((text (sx-format-replacements + format-string + `((?d . ,.display_name) + (?l . ,.link) + (?r . ,.reputation) + (?a . ,.accept_rate)) + sx--format-user-property-alist))) + (if link + (insert-text-button text + ;; For visiting and stuff. + 'sx-button-url link + 'sx-button-copy link + :type 'sx-button-user) + text)))) + +(provide 'sx-user) +;;; sx-user.el ends here + +;; Local Variables: +;; indent-tabs-mode: nil +;; End: -- cgit v1.2.3 From d2e808eae7565cefb95becd05628ae69f2980e25 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 15:08:58 -0200 Subject: Move fallback-user to sx-user, and improve it --- sx-question-print.el | 12 -------- sx-user.el | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 12 deletions(-) (limited to 'sx-user.el') diff --git a/sx-question-print.el b/sx-question-print.el index 3ae86fc..6ab7698 100644 --- a/sx-question-print.el +++ b/sx-question-print.el @@ -42,18 +42,6 @@ ;;; Faces and Variables -(defconst sx-question-mode-fallback-user - '((display_name . "(unknown user)") - (link . "") - (reputation . -1) - (accept_rate . -1)) - "The structure used to represent a deleted account." - :type '(alist :options ((display_name string) - (link string) - (reputation integer) - (accept_rate integer))) - :group 'sx-question-mode) - (defface sx-question-mode-header '((t :inherit font-lock-variable-name-face)) "Face used on the question headers in the question buffer." diff --git a/sx-user.el b/sx-user.el index 975d5ef..d09faf0 100644 --- a/sx-user.el +++ b/sx-user.el @@ -30,6 +30,86 @@ :tag "SX Question Mode" :group 'sx) +(defcustom sx-question-mode-fallback-user + '( + (about_me . "") + (accept_rate . -1) + (account_id . -1) + (age . -1) + (answer_count . -1) + (badge_counts . ((bronze . -1) (silver . -1) (gold . -1))) + (creation_date . -1) + (display_name . "(unknown user)") + (down_vote_count . -1) + (is_employee . :json-false) + (last_access_date . -1) + (last_modified_date . -1) + (link . "") + (location . "") + (profile_image . ":(") + (question_count . -1) + (reputation . -1) + (reputation_change_day . -1) + (reputation_change_month . -1) + (reputation_change_quarter . -1) + (reputation_change_week . -1) + (reputation_change_year . -1) + (timed_penalty_date . -1) + (up_vote_count . -1) + (user_id . -1) + (user_type . does_not_exist) + (view_count . -1) + (website_url . "") + ) + "The structure used to represent missing user information. +NOOTE: SX relies on this variable containing all necessary user +information. You may edit any of its fields, but you'll run into +errors if you remove them." + :type '(alist :options ((about_me string) + (accept_rate integer) + (account_id integer) + (age integer) + (answer_count integer) + (badge_counts alist) + (creation_date integer) + (display_name string) + (down_vote_count integer) + (is_employee boolean) + (last_access_date integer) + (last_modified_date integer) + (link string) + (location string) + (profile_image string) + (question_count integer) + (reputation integer) + (reputation_change_day integer) + (reputation_change_month integer) + (reputation_change_quarter integer) + (reputation_change_week integer) + (reputation_change_year integer) + (timed_penalty_date integer) + (up_vote_count integer) + (user_id integer) + (user_type symbol) + (view_count integer) + (website_url string))) + :group 'sx-user) + +(defface sx-user-name + '((t :inherit font-lock-variable-name-face)) + "Face used for user names." + :group 'sx-user) + +(defface sx-user-reputation + '((t :inherit font-lock-function-name-face)) + "Face used for user reputations." + :group 'sx-user) + +(defface sx-user-accept-rate + '((t)) + "Face used for user accept-rates." + :group 'sx-user) + (defvar sx--user-format-property-alist '((?d face sx-question-mode-author) (?r face sx-question-mode-reputation) -- cgit v1.2.3 From adbf1e311eaafbec2476fe08a5ba81672f25eb79 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 15:09:21 -0200 Subject: Fix some migration left-overs --- sx-question-print.el | 20 +++++++++++--------- sx-user.el | 29 ++++++++++++++++------------- 2 files changed, 27 insertions(+), 22 deletions(-) (limited to 'sx-user.el') diff --git a/sx-question-print.el b/sx-question-print.el index 6ab7698..66ae922 100644 --- a/sx-question-print.el +++ b/sx-question-print.el @@ -34,8 +34,9 @@ :tag "SX Question Mode" :group 'sx) -(defgroup sx-question-mode-faces nil - "Customization group for the faces of `sx-question-mode'." +(defgroup sx-question-mode-faces '((sx-user custom-group)) + "Customization group for the faces of `sx-question-mode'. +Some faces of this mode might be defined in the `sx-user' group." :prefix "sx-question-mode-" :tag "SX Question Mode Faces" :group 'sx-question-mode) @@ -62,7 +63,7 @@ :type 'string :group 'sx-question-mode) -(defcustom sx-question-mode-header-author-format "\nAuthor: %n %r" +(defcustom sx-question-mode-header-author-format "\nAuthor: %d %r" "String used to display the question author at the header. % constructs have special meaning here. See `sx--user-format'." :type 'string @@ -191,10 +192,11 @@ DATA can represent a question or an answer." (sx--wrap-in-overlay '(sx-question-mode--section-content t) ;; Author - (sx--format-user - (propertize sx-question-mode-header-author-format - 'face 'sx-question-mode-header) - .owner) + (insert + (sx--user-format + (propertize sx-question-mode-header-author-format + 'face 'sx-question-mode-header) + .owner)) (sx-question-mode--insert-header ;; Date sx-question-mode-header-date @@ -203,7 +205,7 @@ DATA can represent a question or an answer." (when .last_edit_date (format sx-question-mode-last-edit-format (sx-time-since .last_edit_date) - (sx--format-user "%n" .last_editor)))) + (sx--user-format "%d" .last_editor)))) 'sx-question-mode-date) (sx-question-mode--insert-header sx-question-mode-header-score @@ -272,7 +274,7 @@ The comment is indented, filled, and then printed according to " ")) (insert (format sx-question-mode-comments-format - (sx--format-user "%n" .owner) + (sx--user-format "%d" .owner) (substring ;; We fill with three spaces at the start, so the comment is ;; slightly indented. diff --git a/sx-user.el b/sx-user.el index d09faf0..362f1e3 100644 --- a/sx-user.el +++ b/sx-user.el @@ -25,9 +25,9 @@ (require 'sx-button) (defgroup sx-user nil - "Customization group for sx-question-mode." + "How users are displayed by SX." :prefix "sx-user-" - :tag "SX Question Mode" + :tag "SX User" :group 'sx) (defcustom sx-question-mode-fallback-user @@ -111,12 +111,14 @@ errors if you remove them." :group 'sx-user) (defvar sx--user-format-property-alist - '((?d face sx-question-mode-author) - (?r face sx-question-mode-reputation) - (?a face sx-question-mode-accept-rate)) + '((?d face sx-user-name) + (?r face sx-user-reputation) + (?a face sx-user-accept-rate)) "Alist relating % constructs with text properties. See `sx--user-format'.") + +;;; Formatting function (defun sx--user-format (format-string user) "Use FORMAT-STRING to format the user object USER. The value is a copy of FORMAT-STRING, but with certain constructs @@ -132,16 +134,17 @@ the `sx-button-user' category." (sx-assoc-let (append user sx-question-mode-fallback-user) (let* ((text (sx-format-replacements format-string - `((?d . ,.display_name) - (?l . ,.link) - (?r . ,.reputation) - (?a . ,.accept_rate)) - sx--format-user-property-alist))) - (if link + `((?d . ,\.display_name) + (?n . ,\.display_name) + (?l . ,\.link) + (?r . ,\.reputation) + (?a . ,\.accept_rate)) + sx--user-format-property-alist))) + (if (> 0 (string-width .link)) (insert-text-button text ;; For visiting and stuff. - 'sx-button-url link - 'sx-button-copy link + 'sx-button-url .link + 'sx-button-copy .link :type 'sx-button-user) text)))) -- cgit v1.2.3 From 0da0edda16757f2ec16e645288ba2cd49786f169 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 15:55:44 -0200 Subject: Better faces --- sx-user.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sx-user.el') diff --git a/sx-user.el b/sx-user.el index 362f1e3..fe620ca 100644 --- a/sx-user.el +++ b/sx-user.el @@ -96,12 +96,12 @@ errors if you remove them." :group 'sx-user) (defface sx-user-name - '((t :inherit font-lock-variable-name-face)) + '((t :inherit font-lock-function-name-face)) "Face used for user names." :group 'sx-user) (defface sx-user-reputation - '((t :inherit font-lock-function-name-face)) + '((t :inherit font-lock-string-face)) "Face used for user reputations." :group 'sx-user) -- cgit v1.2.3 From 5e29ea61e86c399cb966fc2299566d43694c2cfe Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 16:29:09 -0200 Subject: Move @name to sx-user --- sx-user.el | 42 ++++++++++++++++++++++++++++++++++++++++++ sx.el | 33 --------------------------------- 2 files changed, 42 insertions(+), 33 deletions(-) (limited to 'sx-user.el') diff --git a/sx-user.el b/sx-user.el index fe620ca..2e8c89a 100644 --- a/sx-user.el +++ b/sx-user.el @@ -148,6 +148,48 @@ the `sx-button-user' category." :type 'sx-button-user) text)))) + +;;; @name conversion +(defconst sx-user--ascii-replacement-list + '(("[:space:]" . "") + ("àåáâäãåą" . "a") + ("èéêëę" . "e") + ("ìíîïı" . "i") + ("òóôõöøőð" . "o") + ("ùúûüŭů" . "u") + ("çćčĉ" . "c") + ("żźž" . "z") + ("śşšŝ" . "s") + ("ñń" . "n") + ("ýÿ" . "y") + ("ğĝ" . "g") + ("ř" . "r") + ("ł" . "l") + ("đ" . "d") + ("ß" . "ss") + ("Þ" . "th") + ("ĥ" . "h") + ("ĵ" . "j") + ("^[:ascii:]" . "")) + "List of replacements to use for non-ascii characters. +Used to convert user names into @mentions.") + +(defun sx-user--@name (user) + "Get the `display_name' of USER prepended with @. +In order to correctly @mention the user, all whitespace is +removed from the display name and a series of unicode conversions +are performed before it is returned +See `sx-user--ascii-replacement-list'. + +If all you need is the @name, this is very slightly faster than +using `sx-user--format'." + (sx-assoc-let user + (if (stringp .display_name) + (concat "@" (sx--recursive-replace + sx-user--ascii-replacement-list .display_name)) + ;; "" + ))) + (provide 'sx-user) ;;; sx-user.el ends here diff --git a/sx.el b/sx.el index d67771b..36ecfca 100644 --- a/sx.el +++ b/sx.el @@ -294,39 +294,6 @@ Return the result of BODY." (push ov sx--overlays)) result)) -(defconst sx--ascii-replacement-list - '(("[:space:]" . "") - ("àåáâäãåą" . "a") - ("èéêëę" . "e") - ("ìíîïı" . "i") - ("òóôõöøőð" . "o") - ("ùúûüŭů" . "u") - ("çćčĉ" . "c") - ("żźž" . "z") - ("śşšŝ" . "s") - ("ñń" . "n") - ("ýÿ" . "y") - ("ğĝ" . "g") - ("ř" . "r") - ("ł" . "l") - ("đ" . "d") - ("ß" . "ss") - ("Þ" . "th") - ("ĥ" . "h") - ("ĵ" . "j") - ("^[:ascii:]" . "")) - "List of replacements to use for non-ascii characters. -Used to convert user names into @mentions.") - -(defun sx--user-@name (user) - "Get the `display_name' of USER prepended with @. -In order to correctly @mention the user, all whitespace is -removed from the display name before it is returned." - (sx-assoc-let user - (when (stringp .display_name) - (concat "@" (sx--recursive-replace - sx--ascii-replacement-list .display_name))))) - (defun sx--recursive-replace (alist string) "Replace each car of ALIST with its cdr in STRING." (if alist -- cgit v1.2.3 From 085c9d8d29aeb060b93db35e0c1076745ac9fe88 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 16:29:20 -0200 Subject: Change sx--user- to sx-user-- --- sx-user.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sx-user.el') diff --git a/sx-user.el b/sx-user.el index 2e8c89a..e2aab49 100644 --- a/sx-user.el +++ b/sx-user.el @@ -110,16 +110,16 @@ errors if you remove them." "Face used for user accept-rates." :group 'sx-user) -(defvar sx--user-format-property-alist +(defvar sx-user--format-property-alist '((?d face sx-user-name) (?r face sx-user-reputation) (?a face sx-user-accept-rate)) "Alist relating % constructs with text properties. -See `sx--user-format'.") +See `sx-user--format'.") ;;; Formatting function -(defun sx--user-format (format-string user) +(defun sx-user--format (format-string user) "Use FORMAT-STRING to format the user object USER. The value is a copy of FORMAT-STRING, but with certain constructs replaced by text that describes the specified USER: @@ -139,7 +139,7 @@ the `sx-button-user' category." (?l . ,\.link) (?r . ,\.reputation) (?a . ,\.accept_rate)) - sx--user-format-property-alist))) + sx-user--format-property-alist))) (if (> 0 (string-width .link)) (insert-text-button text ;; For visiting and stuff. -- cgit v1.2.3 From 49ee9fc6aa1702cfaf3f67b193eb7c888d23f8d2 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 16:29:47 -0200 Subject: Typo --- sx-user.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sx-user.el') diff --git a/sx-user.el b/sx-user.el index e2aab49..7a07d03 100644 --- a/sx-user.el +++ b/sx-user.el @@ -187,8 +187,7 @@ using `sx-user--format'." (if (stringp .display_name) (concat "@" (sx--recursive-replace sx-user--ascii-replacement-list .display_name)) - ;; "" - ))) + ""))) (provide 'sx-user) ;;; sx-user.el ends here -- cgit v1.2.3 From 74790a11bc19fbdeae054816962b2160461767f4 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 16:36:07 -0200 Subject: Make sx-user--@name take a string. --- sx-user.el | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'sx-user.el') diff --git a/sx-user.el b/sx-user.el index 7a07d03..fe05057 100644 --- a/sx-user.el +++ b/sx-user.el @@ -174,20 +174,17 @@ the `sx-button-user' category." "List of replacements to use for non-ascii characters. Used to convert user names into @mentions.") -(defun sx-user--@name (user) - "Get the `display_name' of USER prepended with @. +(defun sx-user--@name (display-name) + "Convert DISPLAY-NAME into an @mention. In order to correctly @mention the user, all whitespace is -removed from the display name and a series of unicode conversions -are performed before it is returned +removed from DISPLAY-NAME and a series of unicode conversions are +performed before it is returned. See `sx-user--ascii-replacement-list'. If all you need is the @name, this is very slightly faster than -using `sx-user--format'." - (sx-assoc-let user - (if (stringp .display_name) - (concat "@" (sx--recursive-replace - sx-user--ascii-replacement-list .display_name)) - ""))) +using `sx-user--format', but it doesn't do any sanity checking." + (concat "@" (sx--recursive-replace + sx-user--ascii-replacement-list display-name))) (provide 'sx-user) ;;; sx-user.el ends here -- cgit v1.2.3 From 09423c2e8f40638a8438cd76783a21d0eb7ed492 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 16:36:35 -0200 Subject: Add %@ support to sx-user--format --- sx-user.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sx-user.el') diff --git a/sx-user.el b/sx-user.el index fe05057..c533744 100644 --- a/sx-user.el +++ b/sx-user.el @@ -125,6 +125,7 @@ The value is a copy of FORMAT-STRING, but with certain constructs replaced by text that describes the specified USER: %d is the display name. +%@ is the display name in a format suitable for @mentions. %l is the link to the profile. %r is the reputation. %a is the accept rate. @@ -138,7 +139,10 @@ the `sx-button-user' category." (?n . ,\.display_name) (?l . ,\.link) (?r . ,\.reputation) - (?a . ,\.accept_rate)) + (?a . ,\.accept_rate) + (?@ . ,(when (string-match "%@" format-string) + (sx-user--@name .display_name))) + ) sx-user--format-property-alist))) (if (> 0 (string-width .link)) (insert-text-button text -- cgit v1.2.3 From a582fa9da166983076460ba8a245a86a1330f8fb Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 16:37:53 -0200 Subject: Indentation --- sx-user.el | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'sx-user.el') diff --git a/sx-user.el b/sx-user.el index c533744..df7d82f 100644 --- a/sx-user.el +++ b/sx-user.el @@ -155,25 +155,25 @@ the `sx-button-user' category." ;;; @name conversion (defconst sx-user--ascii-replacement-list - '(("[:space:]" . "") - ("àåáâäãåą" . "a") - ("èéêëę" . "e") - ("ìíîïı" . "i") - ("òóôõöøőð" . "o") - ("ùúûüŭů" . "u") - ("çćčĉ" . "c") - ("żźž" . "z") - ("śşšŝ" . "s") - ("ñń" . "n") - ("ýÿ" . "y") - ("ğĝ" . "g") - ("ř" . "r") - ("ł" . "l") - ("đ" . "d") - ("ß" . "ss") - ("Þ" . "th") - ("ĥ" . "h") - ("ĵ" . "j") + '(("[:space:]" . "") + ("àåáâäãåą" . "a") + ("èéêëę" . "e") + ("ìíîïı" . "i") + ("òóôõöøőð" . "o") + ("ùúûüŭů" . "u") + ("çćčĉ" . "c") + ("żźž" . "z") + ("śşšŝ" . "s") + ("ñń" . "n") + ("ýÿ" . "y") + ("ğĝ" . "g") + ("ř" . "r") + ("ł" . "l") + ("đ" . "d") + ("ß" . "ss") + ("Þ" . "th") + ("ĥ" . "h") + ("ĵ" . "j") ("^[:ascii:]" . "")) "List of replacements to use for non-ascii characters. Used to convert user names into @mentions.") -- cgit v1.2.3 From 65000b68e9f8db743081c1a36acd31222b666a56 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 17:08:50 -0200 Subject: Face changes --- sx-user.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sx-user.el') diff --git a/sx-user.el b/sx-user.el index df7d82f..44456a0 100644 --- a/sx-user.el +++ b/sx-user.el @@ -96,12 +96,12 @@ errors if you remove them." :group 'sx-user) (defface sx-user-name - '((t :inherit font-lock-function-name-face)) + '((t :inherit font-lock-builtin-face)) "Face used for user names." :group 'sx-user) (defface sx-user-reputation - '((t :inherit font-lock-string-face)) + '((t :inherit font-lock-comment-face)) "Face used for user reputations." :group 'sx-user) -- cgit v1.2.3 From 7ea2edd6e54cf4dd257a32555fec4489d510eaf6 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 17:59:51 -0200 Subject: Only display_name and @name are turned into buttons --- sx-button.el | 2 +- sx-user.el | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) (limited to 'sx-user.el') diff --git a/sx-button.el b/sx-button.el index 8309543..a459eb4 100644 --- a/sx-button.el +++ b/sx-button.el @@ -155,7 +155,7 @@ usually part of a code-block." 'action #'sx-button-follow-link 'help-echo sx-button--user-help-echo ;; We use different faces on diferent parts of the user button. - 'face nil + 'face 'sx-user-name :supertype 'sx-button) (define-button-type 'sx-button-comment diff --git a/sx-user.el b/sx-user.el index 44456a0..c0f3a78 100644 --- a/sx-user.el +++ b/sx-user.el @@ -95,6 +95,8 @@ errors if you remove them." (website_url string))) :group 'sx-user) + +;;; Text properties (defface sx-user-name '((t :inherit font-lock-builtin-face)) "Face used for user names." @@ -111,7 +113,9 @@ errors if you remove them." :group 'sx-user) (defvar sx-user--format-property-alist - '((?d face sx-user-name) + `((?d button ,(list t) category ,(button-category-symbol 'sx-button-user)) + (?n button ,(list t) category ,(button-category-symbol 'sx-button-user)) + (?@ button ,(list t) category ,(button-category-symbol 'sx-button-user)) (?r face sx-user-reputation) (?a face sx-user-accept-rate)) "Alist relating % constructs with text properties. @@ -130,8 +134,10 @@ replaced by text that describes the specified USER: %r is the reputation. %a is the accept rate. -The returned string is additionally propertized as a button with -the `sx-button-user' category." +The string replaced in each of these construct is also given the +text-properties specified in `sx-user--format-property-alist'. +Specially, %d and %@ are turned into buttons with the +`sx-button-user' category." (sx-assoc-let (append user sx-question-mode-fallback-user) (let* ((text (sx-format-replacements format-string @@ -144,12 +150,11 @@ the `sx-button-user' category." (sx-user--@name .display_name))) ) sx-user--format-property-alist))) - (if (> 0 (string-width .link)) - (insert-text-button text - ;; For visiting and stuff. - 'sx-button-url .link - 'sx-button-copy .link - :type 'sx-button-user) + (if (< 0 (string-width .link)) + (propertize text + ;; For visiting and stuff. + 'sx-button-url .link + 'sx-button-copy .link) text)))) -- cgit v1.2.3