An open API service indexing awesome lists of open source software.

https://github.com/lujun9972/examples.el

Do By Examples
https://github.com/lujun9972/examples.el

Last synced: 6 months ago
JSON representation

Do By Examples

Awesome Lists containing this project

README

          

#+TITLE: README
#+AUTHOR: lujun9972
#+CATEGORY: examples.el
#+DATE: [2016-07-29 周五 16:21]
#+OPTIONS: ^:{}

* Do By Examples
[[examples.gif]]

* The Idea
There are always some commands that we use frequently, but not frequently enough to remember. Usually I record them into org files.

So, If I forget a command, I should go through the following steps:
1. Found the org file
2. Open the org file and find out the corresponding src-block
3. Copy the code in the src-block, and then modify it according to the actual situation

That's too much steps!!

That's why I write this =examples= package.

The idea is to treat headlines as examples and the codes in src-blocks as command templates.

Specifically, =examples= will do following things
1. List all the examples in org files to user for selection.
2. Once user selected an example, =examples= will search corresponding src-blocks.
3. If there is only one src-block then the code will be expanded by yasnippet and inserted into current buffer, otherwise tell the user to select which src-block before expanding and inserting.

* Usage
1. setting =examples-default-org-files=

The varialbe specified org files stored examples.

The default value is all the org files in =PATH-TO-EXAMPLES/examples/= directory

2. (Optional)setting =exampls-mode-lang-alist=

This varialbe specified the correspondence between currect major-mode and the src-block language.

It is mainly used to reduce the amount of src-block selection. after all, if you're in eshell, It is less likely to use C ++ code.

Defautly, =examples= only search those src-blocks which language is the same as current major-mode(removed the mode suffix).

3. execute =M-x examples=