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(-) (limited to 'sx-interaction.el') 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 From 85835a2031d046e529f39b108b960c993d9bcaab Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Tue, 25 Nov 2014 23:01:33 -0500 Subject: Add ability to copy link instead of visiting it --- sx-interaction.el | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'sx-interaction.el') diff --git a/sx-interaction.el b/sx-interaction.el index 404fb56..1e6164f 100644 --- a/sx-interaction.el +++ b/sx-interaction.el @@ -51,16 +51,25 @@ Only fields contained in TO are copied." (setcar to (car from)) (setcdr to (cdr from))) -(defun sx-visit (data) +(defun sx-visit (data &optional copy-as-kill) "Visit DATA in a web browser. DATA can be a question, answer, or comment. Interactively, it is derived from point position. + +If copy-as-kill is non-nil, do not call `browse-url'. +Instead, copy the link as a new kill with `kill-new'. +Interactively, this is specified with a prefix argument. + If DATA is a question, also mark it as read." - (interactive (list (sx--data-here))) + (interactive (list (sx--data-here) current-prefix-arg)) (sx-assoc-let data - (when (stringp .link) - (browse-url .link)) - (when .title + (let ((link + (when (stringp .link) + (funcall (if copy-as-kill #'kill-new #'browse-url) + .link)))) + (when (and (called-interactively-p 'any) copy-as-kill) + (message "Copied: %S" link))) + (when (and .title (not copy-as-kill)) (sx-question--mark-read data) (sx--maybe-update-display)))) -- cgit v1.2.3