All Projects → rexim → Org Cliplink

rexim / Org Cliplink

Insert org-mode links from clipboard

Projects that are alternatives of or similar to Org Cliplink

Org Roam
Rudimentary Roam replica with Org-mode
Stars: ✭ 4,067 (+1864.73%)
Mutual labels:  hacktoberfest, org-mode
Weblate
Web based localization tool with tight version control integration.
Stars: ✭ 2,719 (+1213.53%)
Mutual labels:  hacktoberfest
Redoc
📘 OpenAPI/Swagger-generated API Reference Documentation
Stars: ✭ 15,935 (+7598.07%)
Mutual labels:  hacktoberfest
Openwisp Radius
Administration web interface and REST API for freeradius 3 build in django & python. Supports captive portal authentication, WPA Enerprise (802.1x), freeradius rlm_rest, social login, Hotspot 2.0 / 802.11u, importing users from CSV, registration of new users and more.
Stars: ✭ 206 (-0.48%)
Mutual labels:  hacktoberfest
Netlify Cms
A Git-based CMS for Static Site Generators
Stars: ✭ 14,776 (+7038.16%)
Mutual labels:  hacktoberfest
Memetastic
Meme Creator for Android - Simple & Ad-Free
Stars: ✭ 206 (-0.48%)
Mutual labels:  hacktoberfest
Android
📱 Nextcloud Android app
Stars: ✭ 2,669 (+1189.37%)
Mutual labels:  hacktoberfest
Wireflow
Wireflow - user flow chart real-time collaborative tool
Stars: ✭ 2,788 (+1246.86%)
Mutual labels:  hacktoberfest
Vulny Code Static Analysis
Python script to detect vulnerabilities inside PHP source code using static analysis, based on regex
Stars: ✭ 207 (+0%)
Mutual labels:  hacktoberfest
Verb
Organize and send HTTP requests from Emacs
Stars: ✭ 205 (-0.97%)
Mutual labels:  org-mode
Liquibase Hibernate
Liquibase Hibernate Integration
Stars: ✭ 205 (-0.97%)
Mutual labels:  hacktoberfest
Shields
Concise, consistent, and legible badges in SVG and raster format
Stars: ✭ 15,716 (+7492.27%)
Mutual labels:  hacktoberfest
Doukutsu Rs
4fun open-source Cave Story reimplementation written in Rust
Stars: ✭ 206 (-0.48%)
Mutual labels:  hacktoberfest
Grpc Go
The Go language implementation of gRPC. HTTP/2 based RPC
Stars: ✭ 15,042 (+7166.67%)
Mutual labels:  hacktoberfest
Ru Test Assignments
Тестовые задания для самостоятельного выполнения от разных it компаний
Stars: ✭ 2,926 (+1313.53%)
Mutual labels:  hacktoberfest
Vim Go
Go development plugin for Vim
Stars: ✭ 14,085 (+6704.35%)
Mutual labels:  hacktoberfest
Yii2
Yii 2: The Fast, Secure and Professional PHP Framework
Stars: ✭ 13,852 (+6591.79%)
Mutual labels:  hacktoberfest
Bilberry Hugo Theme
Premium theme for the hugo site builder. DEMO:
Stars: ✭ 205 (-0.97%)
Mutual labels:  hacktoberfest
Preserver
Preserver is desktop notes organiser built on electron, angular2, pouchDB
Stars: ✭ 207 (+0%)
Mutual labels:  hacktoberfest
Pdns
PowerDNS Authoritative, PowerDNS Recursor, dnsdist
Stars: ✭ 2,575 (+1143.96%)
Mutual labels:  hacktoberfest

[[http://melpa.org/#/org-cliplink][file:http://melpa.org/packages/org-cliplink-badge.svg]] [[https://travis-ci.org/rexim/org-cliplink][file:https://travis-ci.org/rexim/org-cliplink.svg?branch=master]] [[https://coveralls.io/r/rexim/org-cliplink][file:https://coveralls.io/repos/rexim/org-cliplink/badge.svg]]

  • org-cliplink

    [[http://i.imgur.com/oA0birm.gif]]

    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.

  • Usage

** org-cliplink

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

#+BEGIN_SRC emacs-lisp (global-set-key (kbd "C-x p i") 'org-cliplink) #+END_SRC

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

** org-cliplink-capture

org-cliplink version for [[https://www.gnu.org/software/emacs/manual/html_node/org/Capture.html#Capture][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 [[https://www.gnu.org/software/emacs/manual/html_node/org/Capture-templates.html#Capture-templates][org-capture-templates]]:

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

** Custom Transformers

You can actually customize how org-cliplink transforms and inserts url and title to the current buffer. To do that use org-cliplink-insert-transformed-title function. It takes the URL and a CALLBACK which is invoked when the title is retrieved.

For example, if you want to strip off Github - : from the GitHub titles you can implement the following custom-org-cliplink function and use it instead of the original org-cliplink:

#+BEGIN_SRC emacs-lisp (defun custom-org-cliplink () (interactive) (org-cliplink-insert-transformed-title (org-cliplink-clipboard-content) ;take the URL from the CLIPBOARD (lambda (url title) (let* ((parsed-url (url-generic-parse-url url)) ;parse the url (clean-title (cond ;; if the host is github.com, cleanup the title ((string= (url-host parsed-url) "github.com") (replace-regexp-in-string "GitHub - .: \(.\)" "\1" title)) ;; otherwise keep the original title (t title)))) ;; forward the title to the default org-cliplink transformer (org-cliplink-org-mode-link-transformer url clean-title))))) #+END_SRC

  • Requirements

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

** Windows

Windows is not officially supported until [[https://github.com/rexim/org-cliplink/issues/35][#35]] is resolved.

** Automated testing

For automated testing you need to install [[http://cask.readthedocs.org/en/latest/][Cask]] first.

To run unit tests:

#+BEGIN_SRC bash $ cask # only once to download development dependencies $ cask exec ert-runner #+END_SRC

To run integration and unit tests together:

#+BEGIN_SRC bash $ ./run-travis-ci.sh #+END_SRC

This exact script is run on every push to [[https://github.com/rexim/org-cliplink][org-cliplink GitHub repo]] on [[https://travis-ci.org/rexim/org-cliplink/][Travis CI]] (that's why it's called run-travis-ci.sh). 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:

#+BEGIN_SRC bash $ ./run-testing-server.py #+END_SRC

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.

** Contribution

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. :)

Thanks.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].