@@ -398,6 +398,9 @@ services."
398398 (when s
399399 (mapconcat #'identity (split-string s) " " )))
400400
401+ (defun org-cliplink-clipboard-content ()
402+ (substring-no-properties (current-kill 0 )))
403+
401404(defun org-cliplink-parse-raw-header (raw-header )
402405 (let ((start 0 )
403406 (result-header nil ))
@@ -441,10 +444,13 @@ services."
441444 (concat (substring s 0 (- max-length 3 )) " ..." )
442445 s)))
443446
444- (defun org-cliplink-insert- org-mode-link-callback (url title )
447+ (defun org-cliplink-org-mode-link-transformer (url title )
445448 (if title
446- (insert (format " [[%s ][%s ]] " url title))
447- (insert (format " [[%s ]] " url))))
449+ (format " [[%s ][%s ]] " url title)
450+ (format " [[%s ]] " url)))
451+
452+ (defun org-cliplink-insert-org-mode-link-callback (url title )
453+ (insert (org-cliplink-org-mode-link-transformer url title)))
448454
449455(defun org-cliplink-uncompress-gziped-text (text )
450456 (let ((filename (make-temp-file " org-cliplink" nil " .gz" )))
@@ -525,6 +531,13 @@ Example:
525531 (url-retrieve url url-retrieve-callback))
526532 (url-retrieve url url-retrieve-callback))))
527533
534+ ;;;### autoload
535+ (defun org-cliplink-insert-transformed-title (url transformer )
536+ (org-cliplink-retrieve-title
537+ url
538+ (lambda (url title )
539+ (insert (funcall transformer url title)))))
540+
528541;;;### autoload
529542(defun org-cliplink-retrieve-title-synchronously (url )
530543 (let ((response-buffer (url-retrieve-synchronously url)))
@@ -539,8 +552,8 @@ Example:
539552with the title of a page found by the URL into the current
540553buffer"
541554 (interactive )
542- (org-cliplink-retrieve- title (substring-no-properties ( current-kill 0 ) )
543- 'org-cliplink-insert- org-mode-link-callback ))
555+ (org-cliplink-insert-transformed- title (org-cliplink-clipboard-content )
556+ 'org-cliplink-org-mode-link-transformer ))
544557
545558(provide 'org-cliplink )
546559
0 commit comments