Skip to content

Commit 3b27267

Browse files
committed
Check for the mode and file under default dir.
1 parent afc4881 commit 3b27267

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

rs-playground.el

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ By default confirmation required."
128128
(defun rust-playground-rm ()
129129
"Remove files of the current snippet together with directory of this snippet."
130130
(interactive)
131-
(if (string-match-p (file-truename rust-playground-basedir) (file-truename (buffer-file-name)))
131+
(if (rust-playground-inside)
132132
(if (or (not rust-playground-confirm-deletion)
133133
(y-or-n-p (format "Do you want delete whole snippet dir %s? "
134134
(file-name-directory (buffer-file-name)))))
@@ -162,7 +162,7 @@ By default confirmation required."
162162
;; (switch-to-buffer buffer)))))
163163

164164
;; (defun rust-playground-upload ()
165-
;; "Upload the current buffer to play.golang.org and return the short URL of the playground."
165+
;; "Upload the current buffer to play.rust-lang.org and return the short URL of the playground."
166166
;; (interactive)
167167
;; (goto-char (point-min))
168168
;; (forward-line)
@@ -176,5 +176,10 @@ By default confirmation required."
176176
(make-directory dir-name t)
177177
dir-name))
178178

179+
(defun rust-playground-inside ()
180+
"It checks that minor mode is rusl-playground and buffer file placed under default directory."
181+
(and (boundp 'rust-playground-mode) rust-playground-mode
182+
(if (string-match-p (file-truename rust-playground-basedir) (file-truename (buffer-file-name))) t)))
183+
179184
(provide 'rust-playground)
180185
;;; rust-playground.el ends here

0 commit comments

Comments
 (0)