forked from FG42/FG42
Update README.md for writing extensions.
This commit is contained in:
parent
930cc01fcb
commit
d1f48294a7
40
README.md
40
README.md
|
@ -105,6 +105,46 @@ your experience:
|
|||
|
||||
|
||||
|
||||
## How to implement your own extension:
|
||||
|
||||
In this part we will explore the extensibility features of the FG42. As an example
|
||||
we will add LaTeX autocompletion and other useful features to our emacs based on AUCTeX
|
||||
and company-auctex [company-auctex](https://github.com/alexeyr/company-auctex).
|
||||
We can install the required package manually by ``` install M-x package-install RET company-auctex RET ``` or the FG42
|
||||
would do this for us based on its configurations.
|
||||
Assume that our extension is called latex, to this end we are needed to create a file and a directory in the following
|
||||
directories:
|
||||
```yourfg42home/lib/extensions/latex.el
|
||||
yourfg42home/lib/extensions/latex/init.el```
|
||||
First we are going to explore the latex.el. First of all your file needs to include these parts:
|
||||
```(require 'fpkg)
|
||||
(require 'fg42/extension)
|
||||
(require 'extensions/latex/init)```
|
||||
|
||||
extensions/latex/init says to FG42 that the corresponding init file is in the latex directory and in the init.el file.
|
||||
after that you must add the MELPA dependencies you wish to install and use, in our case:
|
||||
```(depends-on 'company-auctex)```
|
||||
There are other doc and extension functions you may like to implement for your versioning and documentation stuff.
|
||||
finally you have to provide your extension using:
|
||||
```(provide 'extensions/latex)```
|
||||
At this point our latex.el is done and we have to implement the init.el. extension customization, key-binding, and hooks on the
|
||||
major modes, etc. are configured in init.el. The only protocol you have to recall is that name of your init function should
|
||||
follow this pattern: ```extensions/latex-initialize()``` and you have to provide it at the end.
|
||||
|
||||
for example:
|
||||
```(defun extensions/latex-initialize ()
|
||||
;LaTeX development initialization
|
||||
(require 'company-auctex)
|
||||
(add-hook 'latex-mode #'company-auctex-init))
|
||||
|
||||
(provide 'extensions/latex/init)```
|
||||
|
||||
FG42 will add your package to its classpath and would load it on the related major mode.
|
||||
Finally you have to enable this extension in the yourfg42home/fg42-confilg.el file.
|
||||
``` (activate-extensions 'latex etc)```
|
||||
|
||||
you are done. enjoy using your extension!
|
||||
|
||||
## what's with the name?
|
||||
|
||||
I'm a huge fan of [Steins Gate](https://en.wikipedia.org/wiki/Steins;Gate) anime and I follow its
|
||||
|
|
Loading…
Reference in New Issue