From 026f8f42a124da1dcc0a7254e49e2cf787b82fe1 Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Tue, 25 Nov 2014 22:39:52 -0500 Subject: Remove whitespace for effective at-mentions If the display name contained whitespace, the function would keep the whitespace in the at-mention. According to observed behavior on the website, this is not correct. This commit removes all whitespace from the returned display name in the appropriate function. --- sx.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sx.el b/sx.el index d4c3ac2..e47e6e3 100644 --- a/sx.el +++ b/sx.el @@ -199,10 +199,13 @@ Return the result of BODY." result)) (defun sx--user-@name (user) - "Get the `display_name' of USER prepended with @." + "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 "@" .display_name)))) + (concat "@" (replace-regexp-in-string + "[[:space:]]" "" .display_name))))) ;;; Assoc-let -- cgit v1.2.3 From eb6d7c4567313b5b4a729bd56f53c56ed2cad27c Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Tue, 25 Nov 2014 22:42:27 -0500 Subject: Streamline replying to comments Append a single space after the at-mention in comment replies. --- sx-interaction.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sx-interaction.el b/sx-interaction.el index 404fb56..de27ca5 100644 --- a/sx-interaction.el +++ b/sx-interaction.el @@ -123,7 +123,7 @@ TEXT is a string. Interactively, it is read from the minibufer." (setq text (read-string "Comment text: " (when .comment_id - (sx--user-@name .owner)))) + (concat (sx--user-@name .owner) " ")))) (while (< (string-width text) 15) (setq text (read-string "Comment text (at least 15 characters): " text)))) ;; If non-interactive, `text' could be anything. -- cgit v1.2.3