summaryrefslogtreecommitdiff
path: root/rust-mode.el
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2021-03-29 19:09:00 +0200
committerbrotzeit <brotzeitmacher@gmail.com>2021-04-23 13:57:07 +0200
commitd54842519e512b9197e0e8b9421c0771307e33b9 (patch)
treea001800aa5c67f10c150363e414edf5987485025 /rust-mode.el
parent139a6580ed85d4ec1b29b23abeb474d33e78ea39 (diff)
downloadrust-mode-d54842519e512b9197e0e8b9421c0771307e33b9.tar.gz
Create rust-playpen.el from existing code
Diffstat (limited to 'rust-mode.el')
-rw-r--r--rust-mode.el42
1 files changed, 0 insertions, 42 deletions
diff --git a/rust-mode.el b/rust-mode.el
index 37b5cd3..0b1f5d1 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -16,7 +16,6 @@
;;; Code:
(eval-when-compile (require 'rx))
-(eval-when-compile (require 'url-vars))
(require 'json)
(require 'thingatpt)
@@ -54,16 +53,6 @@ When nil, `where' will be aligned with `fn' or `trait'."
:group 'rust-mode
:safe #'booleanp)
-(defcustom rust-playpen-url-format "https://play.rust-lang.org/?code=%s"
- "Format string to use when submitting code to the playpen."
- :type 'string
- :group 'rust-mode)
-
-(defcustom rust-shortener-url-format "https://is.gd/create.php?format=simple&url=%s"
- "Format string to use for creating the shortened link of a playpen submission."
- :type 'string
- :group 'rust-mode)
-
(defcustom rust-match-angle-brackets t
"Whether to enable angle bracket (`<' and `>') matching where appropriate."
:type 'boolean
@@ -1621,37 +1610,6 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
;;; Secondary Commands
-(defun rust-playpen-region (begin end)
- "Create a shareable URL for the region from BEGIN to END on the Rust playpen."
- (interactive "r")
- (let* ((data (buffer-substring begin end))
- (escaped-data (url-hexify-string data))
- (escaped-playpen-url (url-hexify-string
- (format rust-playpen-url-format escaped-data))))
- (if (> (length escaped-playpen-url) 5000)
- (error "encoded playpen data exceeds 5000 character limit (length %s)"
- (length escaped-playpen-url))
- (let ((shortener-url (format rust-shortener-url-format escaped-playpen-url))
- (url-request-method "POST"))
- (url-retrieve shortener-url
- (lambda (state)
- ;; filter out the headers etc. included at the
- ;; start of the buffer: the relevant text
- ;; (shortened url or error message) is exactly
- ;; the last line.
- (goto-char (point-max))
- (let ((last-line (thing-at-point 'line t))
- (err (plist-get state :error)))
- (kill-buffer)
- (if err
- (error "failed to shorten playpen url: %s" last-line)
- (message "%s" last-line)))))))))
-
-(defun rust-playpen-buffer ()
- "Create a shareable URL for the contents of the buffer on the Rust playpen."
- (interactive)
- (rust-playpen-region (point-min) (point-max)))
-
(defun rust-promote-module-into-dir ()
"Promote the module file visited by the current buffer into its own directory.