Fix the toggle behavior of prelude-mode.

This commit is contained in:
Bozhidar Batsov 2013-01-13 16:16:17 +02:00
parent 91a4c94730
commit 5a8a724abb

View file

@ -54,6 +54,7 @@
map) map)
"Keymap for Prelude mode.") "Keymap for Prelude mode.")
(defun prelude-mode-add-menu ()
(easy-menu-add-item nil '("Tools") (easy-menu-add-item nil '("Tools")
'("Prelude" '("Prelude"
("Files" ("Files"
@ -90,16 +91,20 @@
["View URL" prelude-view-url])) ["View URL" prelude-view-url]))
"Search Files (Grep)...") "Search Files (Grep)...")
(easy-menu-add-item nil '("Tools") '("----") "Search Files (Grep)...") (easy-menu-add-item nil '("Tools") '("--") "Search Files (Grep)..."))
(defun prelude-mode-remove-menu ()
(easy-menu-remove-item nil '("Tools") "Prelude")
(easy-menu-remove-item nil '("Tools") "--"))
;; define minor mode ;; define minor mode
(define-globalized-minor-mode prelude-global-mode prelude-mode prelude-on) (define-globalized-minor-mode prelude-global-mode prelude-mode prelude-on)
(defun prelude-on () (defun prelude-on ()
(prelude-mode t)) (prelude-mode +1))
(defun prelude-off () (defun prelude-off ()
(easy-menu-remove)) (prelude-mode -1))
(define-minor-mode prelude-mode (define-minor-mode prelude-mode
"Minor mode to consolidate Emacs Prelude extensions. "Minor mode to consolidate Emacs Prelude extensions.
@ -109,8 +114,9 @@
:keymap prelude-mode-map :keymap prelude-mode-map
(if prelude-mode (if prelude-mode
;; on start ;; on start
(prelude-mode-add-menu)
;; on stop ;; on stop
(prelude-off))) (prelude-mode-remove-menu)))
(provide 'prelude-mode) (provide 'prelude-mode)
;;; prelude-mode.el ends here ;;; prelude-mode.el ends here