With some help from the blog post found here, I have managed to write a small code for a test package (a minor mode) named niranjan. It is as follows.
(define-minor-mode niranjan-mode
"Hello world"
:lighter " niranjan"
:keymap (let ((map (make-sparse-keymap)))
(define-key map (kbd "C-c i") 'insert-niranjan)
map))
(add-hook 'text-mode-hook 'niranjan-mode)
(provide 'niranjan-mode)
I hope this is correct. I saved it in ~/.emacs.d/elpa/niranjan with the name niranjan.el. Now I expect niranjan-mode to be listed when I press M-x, but unfortunately it isn't. Note that I am opening a new session while pressing M-x to use my new mode. What should be done to make a package appear in the normal package/mode list? Is there something to be done to refresh the list of packages? Have I placed the .el file in a wrong location?