File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -222,10 +222,9 @@ Tries to look for a URL at point."
222
222
(defun go-playground-upload ()
223
223
" Upload the current buffer to play.golang.org and return the short URL of the playground."
224
224
(interactive )
225
- (if (go-playground-inside)
226
- (goto-char (point-min ))
227
- (forward-line )
228
- (insert (go-play-buffer))))
225
+ (if (not (go-playground-inside))
226
+ (message " Not in a Go Playground buffer! " )
227
+ (go-play-buffer)))
229
228
230
229
(defun go-playground-snippet-unique-dir (prefix )
231
230
" Get unique directory under GOPATH/`go-playground-basedir`."
@@ -237,8 +236,10 @@ Tries to look for a URL at point."
237
236
238
237
(defun go-playground-inside ()
239
238
" Is the current buffer is valid go-playground buffer."
240
- (if (string-match-p (file-truename go-playground-basedir) (file-truename (buffer-file-name )))
241
- (bound-and-true-p go-playground-mode)))
239
+ (and (bound-and-true-p go-playground-mode)
240
+ buffer-file-name
241
+ (string-prefix-p (file-truename go-playground-basedir)
242
+ (file-truename buffer-file-name))))
242
243
243
244
(provide 'go-playground )
244
245
; ;; go-playground.el ends here
You can’t perform that action at this time.
0 commit comments