Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions go-playground.el
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,9 @@ Tries to look for a URL at point."
(defun go-playground-upload ()
"Upload the current buffer to play.golang.org and return the short URL of the playground."
(interactive)
(if (go-playground-inside)
(goto-char (point-min))
(forward-line)
(insert (go-play-buffer))))
(if (not (go-playground-inside))
(message "Not in a Go Playground buffer!")
(go-play-buffer)))

(defun go-playground-snippet-unique-dir (prefix)
"Get unique directory under GOPATH/`go-playground-basedir`."
Expand All @@ -229,8 +228,10 @@ Tries to look for a URL at point."

(defun go-playground-inside ()
"Is the current buffer is valid go-playground buffer."
(if (string-match-p (file-truename go-playground-basedir) (file-truename (buffer-file-name)))
(bound-and-true-p go-playground-mode)))
(and (bound-and-true-p go-playground-mode)
buffer-file-name
(string-prefix-p (file-truename go-playground-basedir)
(file-truename buffer-file-name))))

(provide 'go-playground)
;;; go-playground.el ends here