Insert org-mode links from clipboard
Emacs Lisp Python Other
Clone or download
rexim Merge pull request #106 from rexim/105
(#105) Fix org-cliplink-retrieve-title-synchronous
Latest commit 7d35b09 Jul 17, 2018


A simple command that takes a URL from the clipboard and inserts an org-mode link with a title of a page found by the URL into the current buffer.

This code was a part of my Emacs config almost a year. I decided to publish it as a separate package in case someone needs this feature too.



Bind org-cliplink function to something. For example, put this line in your init file:

(global-set-key (kbd "C-x p i") 'org-cliplink)

Then copy any http/https URL to the clipboard, switch to the Emacs window and hit C-x p i.


org-cliplink version for org-capture templates. Makes synchronous request. Returns the link instead of inserting it to the current buffer. Doesn’t support Basic Auth. Doesn’t support cURL transport.

Here is how it’s supposed to be used in org-capture-templates:

(setq org-capture-templates
   '(("K" "Cliplink capture task" entry (file "")
      "* TODO %(org-cliplink-capture) \n  SCHEDULED: %t\n" :empty-lines 1)))


  • Linux
  • Emacs version 24.4+
  • cURL 7.35.0+ (optional)


Windows is not officially supported until #35 is resolved.

  • GnuTLS — if you use Emacs installation from the official GNU FTP server — — you may simply download the latest version of GnuTLS from and copy the content of the downloaded archive to the emacs installation folder.



  1. open org-cliplink.el in Emacs;
  2. change something;
  3. M-x eval-buffer RET;
  4. manual testing;
  5. go to 3 until it’s done;

Automated testing

For automated testing you need to install Cask first.

To run unit tests:

$ cask # only once to download development dependencies
$ cask exec ert-runner

To run integration and unit tests together:

$ ./

This exact script is run on every push to org-cliplink GitHub repo on Travis CI (that’s why it’s called This script starts up a testing web-server, executes integrations tests defined in *-integration-tests.el files and executes unit tests after that.

You can start the testing web-server standalone:

$ ./

It requires Python 2.7.6+. It will serve test-data/site folder on different ports with different features (like HTTPS, Gziped content, Basic Auth, etc.).

To stop the server just ^C it.

The automated testing stuff was tested only under Linux so far.


This command doesn’t handle some cases (like different encodings) but I do my best to improve it. If you find this code useful and want to make a contribution I’m waiting for your pull requests. :)