aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-01-24 01:25:41 -0200
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-01-24 01:28:36 -0200
commitba80f6594f39b09a6212f1288297ad1a6124dcbe (patch)
treecb406759d0defbfd476404c26fb9f405a5826a29
parente8becf0aa8fd823a73a16292fffc261be7c4b9f5 (diff)
Clean up nested links
-rw-r--r--sx-question-print.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/sx-question-print.el b/sx-question-print.el
index 924608b..0528944 100644
--- a/sx-question-print.el
+++ b/sx-question-print.el
@@ -409,6 +409,14 @@ Image links are downloaded and displayed, if
(defun sx-question-mode--insert-link (text-or-image url)
"Return a link propertized version of TEXT-OR-IMAGE.
URL is used as 'help-echo and 'url properties."
+ ;; For now, the only way to handle nested links is to remove them.
+ (when (eq (char-before) ?\[)
+ (insert "a")
+ (forward-char -2)
+ (if (looking-at sx-question-mode--link-regexp)
+ (replace-match "")
+ (forward-char 1)
+ (delete-char 1)))
(let ((imagep (not (stringp text-or-image))))
;; Images need to be at the start of a line.
(when (and imagep (not (looking-at-p "^")))