aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2014-11-26 09:29:36 +0000
committerArtur Malabarba <bruce.connor.am@gmail.com>2014-11-26 09:29:36 +0000
commit0d73114ea7e7a1aa9cf1e391951a9522e129492d (patch)
tree0e103f277a547713363162b6c383614ae5a2b93c
parent07a1456fe7a91d1589f689d40ac4391f35e695b9 (diff)
parenteb6d7c4567313b5b4a729bd56f53c56ed2cad27c (diff)
Merge pull request #98 from vermiculus/fix-at-mention-string
Fix at-mention string
-rw-r--r--sx-interaction.el2
-rw-r--r--sx.el7
2 files changed, 6 insertions, 3 deletions
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.
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