diff options
author | Sean Allred <code@seanallred.com> | 2014-12-26 17:49:11 -0500 |
---|---|---|
committer | Sean Allred <code@seanallred.com> | 2014-12-26 17:50:19 -0500 |
commit | 0db8321f1dbb827666ef79bdae19b4864cb524ac (patch) | |
tree | ed8eeb818cd78d18b597839fcf25dd843b2b4677 /sx-button.el | |
parent | 0354bf2c974b13967558187936918db4af125571 (diff) | |
parent | a919c72f2b58d889bf3fbdde100f9912a90c64ab (diff) |
Merge branch 'master' into visit-question-from-link
Conflicts:
sx.el
Conflict arose from 6eb53ee0f12dd9f7d444e6749f6cc55c6db62078
Diffstat (limited to 'sx-button.el')
-rw-r--r-- | sx-button.el | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sx-button.el b/sx-button.el index 283fe0d..f166164 100644 --- a/sx-button.el +++ b/sx-button.el @@ -77,20 +77,23 @@ This is usually a link's URL, or the content of a code block." (point) 'sx-button-copy-type) content))))) -(defun sx-button-edit-this (text-or-marker) - "Open a temp buffer populated with the string TEXT-OR-MARKER. +(defun sx-button-edit-this (text-or-marker &optional major-mode) + "Open a temp buffer populated with the string TEXT-OR-MARKER using MAJOR-MODE. When given a marker (or interactively), use the 'sx-button-copy -text-property under the marker. This is usually the content of a -code-block." +and the 'sx-mode text-properties under the marker. These are +usually part of a code-block." (interactive (list (point-marker))) ;; Buttons receive markers. (when (markerp text-or-marker) + (setq major-mode (get-text-property text-or-marker 'sx-mode)) (unless (setq text-or-marker (get-text-property text-or-marker 'sx-button-copy)) (sx-message "Nothing of interest here."))) (with-current-buffer (pop-to-buffer (generate-new-buffer "*sx temp buffer*")) - (insert text-or-marker))) + (insert text-or-marker) + (when major-mode + (funcall major-mode)))) (defun sx-button-follow-link (&optional pos) "Follow link at POS. If POS is nil, use `point'." |