;; Author: Bad Blue Bull <address@hidden> ;; Keywords: irc, icq
;; Version: 1.0
;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or (at ;; your option) any later version.
;; This program is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details.
;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see ;; <https://www.gnu.org/licenses/>.
;;; Commentary:
;; shorten-url allows you to insert a shortened alternative for a given ;; URL. Can be useful for chatting. ;; ;; A request for a URL produced by concatenation of shorten-url-base ;; with a URL passed as an argument is fulfilled and data from HTTP ;; response gets inserted into current buffer. ;; ;; At the moment of this release TIMEOUT optional variable of ;; url-retrieve-synchronously may break execution of this function ;; (bug #34607), so it's unused. ;; ;; Also url-retrieve-synchronously takes long time to retrieve a URL ;; that hasn't been retrieved before in some interval of time in same ;; Emacs session (bug #34652).
;; Configuration:
;; You can customize shorten-url-base to use diffirent URL shortener web ;; service.
;; Usage:
;; Call shorten-url from Lisp or execute it as command with URL you want ;; to shorten passed as an argument. ;; ;; Example: ;; ;; M-x shorten-url https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34607 ;; ;; result inserted: https://qps.ru/MjrtW ;; ;; For convenient usage bind a key sequence so that it will insert ;; shortened version of URL stored in kill ring. ;; Here is example how you can bind C-c C-y key sequence so that when it ;; is used in ERC it inserts a shortened URL corresponding to element of ;; kill ring that the yank command would insert: ;; ;; (add-hook 'erc-mode-hook (lambda () ;; (local-set-key (kbd "C-c C-y") ;; (lambda (&optional arg) ;; (interactive "*P") ;; (shorten-url (current-kill ;; (cond ;; ((listp arg) ;; 0) ;; ((eq arg '-) ;; -2) ;; (t ;; (1- arg))) ;; ))))))