FG42/src/lib/modes.el

104 lines
3.4 KiB
EmacsLisp
Raw Normal View History

2011-01-02 13:53:57 +00:00
;; Shit - My personal emacs IDE configuration
2011-01-02 09:46:04 +00:00
;; Copyright (C) 2010 Sameer Rahmani <lxsameer@gnu.org>
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;; This file will define the most popular modes for ShitIDE
2011-01-02 13:39:49 +00:00
;; ---------------------------------------------------------------------
;; Hooks
;; ---------------------------------------------------------------------
(defvar shit-preinit-mode-hook '()
"This hook runs before initializing the 'shit-mode' minor mode."
)
(defvar shit-postinit-mode-hook '()
"This hook runs after 'shit-mode' minor mode initialized."
)
(defvar shit-prerm-mode-hook '()
"This hook runs before deactivating 'shit-mode' minor mode."
)
(defvar shit-postrm-mode-hook '()
"This hook runs after 'shit-mode' minor mode deactivated."
)
2011-01-02 09:46:04 +00:00
;; ---------------------------------------------------------------------
;; Keymaps
;; ---------------------------------------------------------------------
(defvar shit-map (make-sparse-keymap)
"Default keymap for shit-mode minor mode that hold the global key
binding for shit IDE. each language plugin will have their own minor-mode
2011-01-02 13:53:57 +00:00
and keymap for their actions."
)
2011-01-02 09:46:04 +00:00
;; ---------------------------------------------------------------------
;; Groups
;; ---------------------------------------------------------------------
(defgroup shit-group nil
"Default values for ShitIDE configuration will are categorized here.")
2011-01-02 12:29:07 +00:00
(defgroup shit-features nil
"This group contains all the optional components of ShitIDE."
:group 'shit-group
)
2011-01-02 09:46:04 +00:00
;; ---------------------------------------------------------------------
;; Custom Variables
;; ---------------------------------------------------------------------
2011-01-02 12:29:07 +00:00
(defcustom c-plugin t
"ShitIDE C programming language plugin."
:group 'shit-features
:type 'boolean
:tag '"C Plugin")
;; ----------------------------------------------------------------------
2011-01-02 13:53:57 +00:00
;; Functions
;; ----------------------------------------------------------------------
2011-01-02 14:05:40 +00:00
2011-01-02 13:53:57 +00:00
;; ----------------------------------------------------------------------
2011-01-02 12:29:07 +00:00
;; Minor Modes
;; ----------------------------------------------------------------------
(define-minor-mode shit-mode
"Toggle Shit mode.
This mode provide a basic configuration for an IDE."
:init-value nil
:lighter " Shit"
2011-01-02 13:53:57 +00:00
:keymap shit-map
2011-01-02 12:29:07 +00:00
:global t
:group 'shit-group
(if (not shit-mode)
2011-01-02 13:39:49 +00:00
;; shit-mode is not loaded
(let ()
;; before initiazing mode
(run-hooks shit-preinit-mode-hook)
2011-01-02 14:03:11 +00:00
(menu/init-menu)
2011-01-02 13:39:49 +00:00
;; after mode was initialized
(run-hooks shit-postinit-mode-hook)
)
;; shit-mode already loaded
(let ()
;; before deactivating mode
(run-hooks shit-prerm-mode-hook)
;; after deactivating mode
(run-hooks shit-postrm-mode-hook)
)
)
2011-01-02 14:05:40 +00:00
)
;; TODO: provide a easy way for plugins to define a minor mode