Elpy is an Emacs package that brings powerful Python editing to Emacs. While going through elpy issues, I came across an interesting thread, where someone asked this
This lead to this post. This post gives a brief introduction on getting familiar with any Emacs package & start hacking it quickly.
That will be help You to get started with any package. You can start using default functions/key bindings.
If we take elpy as a case study, it has Readme file which shows how to install elpy. It also has a good documentation about elpy & some of its important features.
One useful package I recommend for this purpose is helm-descbindings which shows key bindings of all available modes. You can also filter among them.
Here You will come to know about few useful functions an Emacs package is capable of doing.
In the case of elpy, You can see something like this.
But You cannot find all key bindings here as some of them might be shadowed (or taken away) by other packages.
To specify a key binding, Emacs packages use a define-key function. So if You open source code of the package and search for define-key, you will see all key bindings there.
If you search for define-key in elpy.el You will come across this
Now You know a few functions & their key bindings which are not present in the documentation.
If there are any key bindings that are not useful You can unbind them.
For example elpy has "C-c C-p" binded to (elpy-flymake-previous-error) which I won't use much. So I can unbind it
The first thing You can do is start using interactive functions right away. Functions in Emacs package which has interactive form are callable commands. You can invoke them using M-x and function name. You will find a lot of them here.
If you want to find all interactive commands in an emacs package, You have to search through source code & find them. Instead if you have helm (If You are not using Helm, I highly recommend You to start using it.) installed, if you type M-x & few letters of the package name, it will narrow down all the interactive functions of that package.
Now You can start bindings keys to any of the functions that You like. Previously We have unbinded a key. Now lets bind it to some function.
(global-set-key (kbd "C-c C-p") 'elpy-set-project-root)
GETTING STARTED:
Most Emacs packages provide a Readme file & some of them have good documentation too. Also there is emacswiki where some other hacks will be available.That will be help You to get started with any package. You can start using default functions/key bindings.
If we take elpy as a case study, it has Readme file which shows how to install elpy. It also has a good documentation about elpy & some of its important features.
GETTING UNDER THE HOOD:
Now lets see some interesting stuff which Emacs packages are capable of but read me file or documentation wont contain.One useful package I recommend for this purpose is helm-descbindings which shows key bindings of all available modes. You can also filter among them.
Here You will come to know about few useful functions an Emacs package is capable of doing.
In the case of elpy, You can see something like this.
But You cannot find all key bindings here as some of them might be shadowed (or taken away) by other packages.
To specify a key binding, Emacs packages use a define-key function. So if You open source code of the package and search for define-key, you will see all key bindings there.
If you search for define-key in elpy.el You will come across this
If there are any key bindings that are not useful You can unbind them.
For example elpy has "C-c C-p" binded to (elpy-flymake-previous-error) which I won't use much. So I can unbind it
(define-key elpy-mode-map (kbd "C-c C-p") nil)
This sets "C-c C-p" to nil.
DIGGING DEEPER:
So far we have seen what an Emacs package is capable of doing. Now, lets start tweaking it a little bit.The first thing You can do is start using interactive functions right away. Functions in Emacs package which has interactive form are callable commands. You can invoke them using M-x and function name. You will find a lot of them here.
If you want to find all interactive commands in an emacs package, You have to search through source code & find them. Instead if you have helm (If You are not using Helm, I highly recommend You to start using it.) installed, if you type M-x & few letters of the package name, it will narrow down all the interactive functions of that package.
Elpy has a lot of interactive commands, You can see a few of them here.
Now You can start bindings keys to any of the functions that You like. Previously We have unbinded a key. Now lets bind it to some function.
(global-set-key (kbd "C-c C-p") 'elpy-set-project-root)
GETTING (IN)SANE WITH LISP:
So far we have just used Emacs package as it is. If You know a bit of lisp, You can start tweaking existing functions or You can write Your own functions. This mostly depends on how You want to use & customize a package. You can do a lot of fun stuff. Enjoy lisping :)