From b9a683e915ff6cc093851232a1e4d76c5613a112 Mon Sep 17 00:00:00 2001 From: larstvei Date: Tue, 23 Sep 2014 21:44:44 +0200 Subject: [PATCH] Added try. --- init.el | 9 +++++++++ init.org | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/init.el b/init.el index d0666c2..a240d79 100644 --- a/init.el +++ b/init.el @@ -603,6 +603,15 @@ the languages in ISPELL-LANGUAGES when invoked." (whitespace-cleanup) (untabify beg (if (< end (point-max)) end (point-max))))) +;; If you have a link to a raw =.el=-file, run =M-x try= and yank an URL +;; into the minibuffer, and the file will be evaluated. + +(defun try (url) + "Takes an URL to a .el-file, and evaluates it." + (interactive (list (read-from-minibuffer "url: "))) + (with-current-buffer (url-retrieve-synchronously url) + (eval-region (search-forward-regexp "^$") (point-max)))) + ;; Key bindings ;; Bindings for [[https://github.com/magnars/expand-region.el][expand-region]]. diff --git a/init.org b/init.org index 82205a4..8c6f0d7 100644 --- a/init.org +++ b/init.org @@ -749,6 +749,17 @@ (untabify beg (if (< end (point-max)) end (point-max))))) #+END_SRC + If you have a link to a raw =.el=-file, run =M-x try= and yank an URL + into the minibuffer, and the file will be evaluated. + + #+BEGIN_SRC emacs-lisp + (defun try (url) + "Takes an URL to a .el-file, and evaluates it." + (interactive (list (read-from-minibuffer "url: "))) + (with-current-buffer (url-retrieve-synchronously url) + (eval-region (search-forward-regexp "^$") (point-max)))) + #+END_SRC + ** Key bindings Bindings for [[https://github.com/magnars/expand-region.el][expand-region]].