From 42d776690bea26d44b7fb891c2aa8ab2c3ed6adc Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 6 Nov 2013 23:22:05 +0100 Subject: [PATCH] Add customization option --- NEWS | 3 ++- hypo.el | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 4b159a7..6d34689 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ # -*- mode: org; -*- * v0.2.0 - - Add =hypo-delete-last=, which deletes the last posted item of the current session. + - Add customization group and allow specification of the URL where + hypo runs. diff --git a/hypo.el b/hypo.el index 3a24752..44e2da5 100644 --- a/hypo.el +++ b/hypo.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: tools -;; Version: 0.1.0 +;; Version: 0.1.0.3 ;; 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 @@ -31,6 +31,16 @@ (autoload 'beginning-of-sexp "thingatpt") (autoload 'end-of-sexp "thingatpt") +(defgroup hypo nil + "Customization options for `hypo'." + :group 'convenience) + +(defcustom hypo-instance-url "https://ryuslash.org/hypo" + "URL of the hypo instance to communicate with." + :group 'hypo + :risky t + :type 'string) + (defvar hypo--last-post nil "The hash of the last snippet sent to hypo. @@ -64,7 +74,7 @@ STATUS is ignored." (read-string "Filename: " (buffer-name)))))) (let ((url-request-data (buffer-substring-no-properties start end)) (url-request-method "PUT")) - (url-retrieve (concat "https://ryuslash.org/hypo/" filename) + (url-retrieve (format "%s/%s" hypo-instance-url filename) #'hypo--collect-and-kill))) ;;;###autoload @@ -108,7 +118,7 @@ STATUS is ignored." (interactive) (unless hypo--last-post (error "Nothing posted this session")) (let ((url-request-method "DELETE")) - (url-retrieve (concat "https://ryuslash.org/hypo/" hypo--last-post) + (url-retrieve (format "%s/%s" hypo-instance-url hypo--last-post) #'ignore) (setq hypo--last-post nil)))