From 4a1329dcbfbc691755a396e42d1d78a4804556f1 Mon Sep 17 00:00:00 2001 From: Amir Hooshangi Date: Fri, 28 Dec 2018 16:48:45 +0000 Subject: [PATCH] Update README.md, extension writing documentation --- README.md | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a1e610d..e0eb954 100755 --- a/README.md +++ b/README.md @@ -114,34 +114,48 @@ We can install the required package manually by ``` install M-x package-install 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) + +```bash + yourfg42home/lib/extensions/latex.el + yourfg42home/lib/extensions/latex/init.el +``` + +First we are going to explore the latex.el. your file needs to include these parts: +```lisp +(require 'fpkg) (require 'fg42/extension) -(require 'extensions/latex/init)``` +(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)``` +after that, you must add the MELPA dependencies you wish to install and use, in our case: +```lisp +(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 +```lisp +(provide 'extensions/latex) +``` +At this point our latex.el is done and we have to implement the init.el file. 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. +follow this pattern: lisp extensions/latex-initialize() and you have to provide it at the end. for example: -```(defun extensions/latex-initialize () +```lisp +(defun extensions/latex-initialize () ;LaTeX development initialization (require 'company-auctex) (add-hook 'latex-mode #'company-auctex-init)) -(provide 'extensions/latex/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)``` +```lisp +(activate-extensions 'latex etc) +``` you are done. enjoy using your extension!