                                (mk-proj-buffers))
                regex))
 
+;; ---------------------------------------------------------------------
+;; Menus
+;; ---------------------------------------------------------------------
+
+(defun mk-proj-menu-item (key label fn &optional always-enabled-p)
+  "Define a mk-project menu item that may not be enabled if a
+project is not loaded."
+  (let ((whole-key `[menu-bar mkproject ,key]))
+    (define-key global-map whole-key
+      `(menu-item ,label ,fn :enable ,(if always-enabled-p 't 'mk-proj-name)))))
+
+(defun mk-proj-menu-item-separator (key)
+  "Define a separator line in the mk-project menu."
+  (define-key global-map `[menu-bar mkproject ,key] '(menu-item "--")))
+
+(defun project-menu ()
+  "Define a menu for mk-project operations."
+  (interactive)
+  ;; define a menu in the top-level menu
+  (define-key-after
+    global-map
+    [menu-bar mkproject]
+    (cons "mk-project" (make-sparse-keymap))
+    'tools)
+
+  ;; define the menu items in reverse order
+  (mk-proj-menu-item 'tags   "Build TAGS"     'project-tags)
+  (mk-proj-menu-item 'index  "Build Index"    'project-index)
+  (mk-proj-menu-item-separator 's2)
+  (mk-proj-menu-item 'dired  "Browse (dired)" 'project-dired)
+  (mk-proj-menu-item 'comp   "Compile   "     'project-compile)
+  (mk-proj-menu-item 'occur  "Multi-occur"    'project-multi-occur)
+  (mk-proj-menu-item 'ack    "Ack"            'project-ack)
+  (mk-proj-menu-item 'grep   "Grep"           'project-grep)
+  (mk-proj-menu-item-separator 's1)
+  (mk-proj-menu-item 'status "Status"         'project-status)
+  (mk-proj-menu-item 'unload "Unload Project" 'project-unload)
+  (mk-proj-menu-item 'load   "Load Project"   'project-load t))
+
+(defun project-menu-remove ()
+  "Remove the mk-project menu from the menu bar"
+  (interactive)
+  (global-unset-key [menu-bar mkproject]))
+
+(when mk-proj-menu-on 
+  (project-menu))
+
 (provide 'mk-project)
 
 ;;; mk-project.el ends here

not one relative to basedir. Value is expanded with expand-file-name.")

(defvar mk-proj-compile-cmd nil
  "Shell command to build the entire project. Optional. Example: make -k.")

(defvar mk-proj-startup-hook nil
  "Hook function to run after the project is loaded. Optional. Project

;; Grep
;; ---------------------------------------------------------------------

(defun project-grep (&optional phrase from-current-dir)
  "Run find-grep on the project's basedir, excluding files in 
mk-proj-ignore-patterns, tag files, etc.

If the phrase argument is not included, it will prompt for a
search phrase.  If the from-current-dir argument is true, or with
C-u prefix, start from the current directory."
  (interactive)
  (mk-proj-assert-proj)
  (let* ((wap (word-at-point))
         (regex (or phrase
                    (if wap (read-string (concat "Grep project for (default \"" wap "\"): ") nil nil wap)
                      (read-string "Grep project for: "))))
         (find-cmd "find . -type f")
         (grep-cmd (concat "grep -i -n \"" regex "\""))
         (default-directory (file-name-as-directory
                             (if (or from-current-dir (mk-proj-has-univ-arg))
                                 default-directory
                               mk-proj-basedir))))
    (when mk-proj-ignore-patterns
