 (require 'org)
 (require 's)
 (require 'cl)
+(require 'ar-url)
+(require 'ar-string)
 
 (cl-defstruct
     org-link

                                     (lambda (url title)
                                       (funcall fn
                                                (make-org-link :url url
                                                               :title (read-string "Link title: " title)))))
      (funcall fn link))))

(provide 'org-link)

  "Return a link with URL if found in clipboard, else link with title."
  (let ((value (substring-no-properties (current-kill 0))))
    (make-org-link :url (when (s-matches-p "^http" value)
                          (ar/url-sans-query value))
                   :title (unless (s-matches-p "^http" value)
                            value))))

