Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sshaw/copy-as-format
Emacs function to copy buffer locations as GitHub/Slack/JIRA etc... formatted code
https://github.com/sshaw/copy-as-format
asciidoc bitbucket disqus emacs gitlab hipchat html jira markdown mediawiki pod restructured-text restructuredtext slack
Last synced: 25 days ago
JSON representation
Emacs function to copy buffer locations as GitHub/Slack/JIRA etc... formatted code
- Host: GitHub
- URL: https://github.com/sshaw/copy-as-format
- Owner: sshaw
- Created: 2016-12-03T05:28:14.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-11-13T07:33:11.000Z (12 months ago)
- Last Synced: 2024-09-27T05:23:21.002Z (about 1 month ago)
- Topics: asciidoc, bitbucket, disqus, emacs, gitlab, hipchat, html, jira, markdown, mediawiki, pod, restructured-text, restructuredtext, slack
- Language: Emacs Lisp
- Homepage:
- Size: 122 KB
- Stars: 138
- Watchers: 6
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# copy-as-format
[![MELPA](https://melpa.org/packages/copy-as-format-badge.svg)](https://melpa.org/#/copy-as-format)
Emacs function to copy buffer locations as GitHub/Slack/JIRA etc...
formatted code![copy-as-format demo](demo.gif)
## Supported Formats/Services
* AsciiDoc
* Bitbucket
* Disqus
* GitHub
* GitLab
* ⚰ HipChat
* HTML
* JIRA
* Markdown
* MediaWiki
* Org-mode
* POD
* reStructuredText
* Slack
* Telegram## Usage
`M-x copy-as-format` or `C-u M-x copy-as-format`
Copy the current line or active region and add it to the kill ring as
GitHub/Slack/JIRA... formatted code. Format defaults to `copy-as-format-default`.
The buffer will not be modified.With a prefix argument prompt for the format.
`M-x copy-as-format-SERVICE`
Where `SERVICE` is one of the supported services.
It's a good idea to bind these functions to a key sequence:
```el
(global-set-key (kbd "C-c w s") 'copy-as-format-slack)
(global-set-key (kbd "C-c w g") 'copy-as-format-github)
```For AsciiDoc customization see `copy-as-format-asciidoc-include-file-name` and `copy-as-format-asciidoc-language-alist`.
## Adding Formats
Create a format function with a signature of `TEXT MULTILINE`:
* `TEXT` - the text to be formatted
* `MULTILINE` - `t` if `TEXT` spans multiple lines, otherwise `nil`For example:
```el
(defun some-great-format (text multiline)
(if multiline
(multiline-format text)
(single-line-format text)))
```Then, add an entry to `copy-as-format-format-alist`. The key is the format's name
and the value is the format function:```el
(add-to-list 'copy-as-format-format-alist '("great-format" some-great-format))
```## See Also
* [git-link](https://github.com/sshaw/git-link)
* [output-as-format](https://github.com/sshaw/output-as-format) - A command-line version of copy-as-format