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
- Host: GitHub
- URL: https://github.com/lujun9972/examples.el
- Owner: lujun9972
- Created: 2016-07-30T22:32:59.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-18T14:03:04.000Z (almost 10 years ago)
- Last Synced: 2025-04-04T03:26:59.558Z (over 1 year ago)
- Language: Emacs Lisp
- Size: 702 KB
- Stars: 11
- Watchers: 2
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.org
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=