;;;;;;;;;;;;; ;; Tinyurl ;; ;;;;;;;;;;;;; (require 'mm-url) (defun tinyurl-get () "Grabs the url at point and echos the equivalent tinyurl in the minibuffer to ease cutting and pasting." (interactive) (let* ((long-url (thing-at-point 'url)) (tinyurl (save-excursion (with-temp-buffer (mm-url-insert (concat "http://tinyurl.com/api-create.php?url=" long-url)) (kill-ring-save (point-min) (point-max)) (buffer-string))))) (message tinyurl))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Metamark - Free Short URL redirection ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (require 'mm-url) (defun tinyurl-get-metamark () "Grabs the url at point and echos the equivalent metamark url in the minibuffer to ease cutting and pasting." (interactive) (let* ((long-url (or (thing-at-point 'url) (read-string "URL to shorten: "))) (url (concat "http://metamark.net/api/rest/simple?" (mm-url-encode-www-form-urlencoded (list (cons "long_url" long-url))))) (short-url (save-excursion (with-temp-buffer (mm-url-insert url) (goto-char (point-max)) (goto-char (re-search-backward "[^[:cntrl:][:space:]]")) (delete-region (+ 1 (point)) (point-max)) (kill-ring-save (point-min) (point-max)) (buffer-string))))) (message "shortened: %s" short-url)))