Print messages after successful operations

This commit is contained in:
Tom Willemse 2013-11-06 23:29:04 +01:00
parent 42d776690b
commit db5cde9c3b
2 changed files with 9 additions and 5 deletions

1
NEWS
View file

@ -4,3 +4,4 @@
current session. current session.
- Add customization group and allow specification of the URL where - Add customization group and allow specification of the URL where
hypo runs. hypo runs.
- Print messages after successful operations.

13
hypo.el
View file

@ -52,7 +52,9 @@ sent to hypo.")
(let* ((start (search-forward "\n\n")) (let* ((start (search-forward "\n\n"))
(end (1- (search-forward "\n")))) (end (1- (search-forward "\n"))))
(setq hypo--last-post (buffer-substring-no-properties (- end 7) end)) (setq hypo--last-post (buffer-substring-no-properties (- end 7) end))
(copy-region-as-kill start end))) (copy-region-as-kill start end)
(message "Copied %s to kill-ring"
(buffer-substring-no-properties start end))))
(defun hypo--collect-and-kill (status) (defun hypo--collect-and-kill (status)
"Collect the returned url and kill the current buffer. "Collect the returned url and kill the current buffer.
@ -117,10 +119,11 @@ STATUS is ignored."
"Delete the last thing sent to hypo." "Delete the last thing sent to hypo."
(interactive) (interactive)
(unless hypo--last-post (error "Nothing posted this session")) (unless hypo--last-post (error "Nothing posted this session"))
(let ((url-request-method "DELETE")) (let ((url-request-method "DELETE")
(url-retrieve (format "%s/%s" hypo-instance-url hypo--last-post) (url (format "%s/%s" hypo-instance-url hypo--last-post)))
#'ignore) (url-retrieve url #'ignore)
(setq hypo--last-post nil))) (setq hypo--last-post nil)
(message "Deleted %s" url)))
(provide 'hypo) (provide 'hypo)
;;; hypo.el ends here ;;; hypo.el ends here