Detect URL properly, such that correct API call is made
This fixes issue #2. Whenever a text contains an URL anywhere, the kagi-url-p function would return positive and the text is submitted as an URL to the Kagi Summarizer API. Now this is only done when the string is a URL only, otherwise the text summarizer is invoked.
This commit is contained in:
parent
fe72d5cebc
commit
bc0eb7023b
1 changed files with 1 additions and 1 deletions
2
kagi.el
2
kagi.el
|
@ -337,7 +337,7 @@ Returns a formatted string to be displayed by the shell."
|
||||||
|
|
||||||
(defun kagi--url-p (s)
|
(defun kagi--url-p (s)
|
||||||
"Non-nil if string S is a URL."
|
"Non-nil if string S is a URL."
|
||||||
(string-match-p (rx (seq "http" (? "s") "://")) s))
|
(string-match-p (rx (seq bos "http" (? "s") "://" (+ (not space)) eos)) s))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun kagi-summarize (text-or-url)
|
(defun kagi-summarize (text-or-url)
|
||||||
|
|
Loading…
Reference in a new issue