Open artelse opened 2 months ago
What are org links? But yeah, the function uses thing-at-point-url-at-point
which is part of the Emacs standard library (thingatpt.el). If you want support for different types of URLs the best place would be to start fixing it there.
What do you mean there is a missing closing parenthesis? All the parenthesis seem balanced otherwise the tests shouldn't succeed.
Lame contribution, but gpt spits out this code which works fine for me:
(defun qrencode-url-at-point ()
"Encode any URL found at point into a QR code.
First, try to get a standard URL at the point. If not found,
try to get an Org link URL. If either is found, encode it into a QR code."
(interactive)
(let ((url (or (thing-at-point-url-at-point)
(let* ((element (org-element-context))
(type (org-element-type element)))
(if (eq type 'link)
(org-element-property :raw-link element)
nil)))))
(if url
(progn
(message "Encoding URL: %s" url)
(qrencode--encode-to-buffer url))
(message "No URL found at point"))))
p.s.: that missing parenthesis turned out to be in my code.
When the point is on a collapsed or toggled org link, it won't recognise the url. Looked at the code and function
thing-at-point-url-at-point
seem not targeting org links. Noticed also that the functionqrencode-url-at-point
is also missing a closing parenthesis.