highlight2clipboard

Homepage: https://github.com/Lindydancer/highlight2clipboard

Author: Anders Lindgren

Updated:

Summary

Copy text to clipboard with highlighting

Commentary

Support for copying text with formatting information, like color,
to the system clipboard. Concretely, this allows you to paste
syntax highlighted source code into word processors and mail
editors.

On MS-Windows, Ruby must be installed.

Usage:

* `M-x highlight2clipboard-copy-region-to-clipboard RET' -- Copy
  the region, with formatting, to the clipboard.

* `M-x highlight2clipboard-copy-buffer-to-clipboard RET' -- Copy
  the buffer, with formatting, to the clipboard.

* Highlight2clipboard mode -- Global minor mode, when enabled, all
  copies and cuts are exported, with formatting information, to the
  clipboard.

Supported systems:

Copying formatted text to the clipboard is highly system specific.
Currently, Mac OS X and MS-Windows are supported. Contributions for
other systems are most welcome.

Windows:

On Windows, a support script written in Ruby is used. For this to
work, Ruby most be installed on the system.

macOS:

On macOS, a support script written in python is used to access the
clipboard. The module `AppKit' must be installed. This can be done
using the following command:

    pip install -U PyObjC

You might need to use a version-specific variant, such as `pip3'.

Known problems:

Font Lock mode, the system providing syntax highlighting in Emacs,
use "lazy highlighting". Effectively, this mean that only the
visible parts of a buffer are highlighted. The problem with this is
that when copying text to the clipboard, only the highlighted parts
gets formatting information. To get around this, walk through the
buffer, use `highlight2clipboard-ensure-buffer-is-fontified', or
use one of the `highlight2clipboard-copy-' functions.

This package generates some temporary files, which it does not
remove. It is assumed that the system temporary directory is
cleaned from time to time.

Implementation:

This package use the package `htmlize' to create an HTML version of
a highlighted text. This is added as a new flavor to the clipboard,
allowing an application to pick the most suited version.

Dependencies