gnu-emacs-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

menu-bar+.el - extensions to GNU `menu-bar.el'


From: Drew Adams
Subject: menu-bar+.el - extensions to GNU `menu-bar.el'
Date: Tue, 16 Jan 2001 21:35:20 -0500

;;; menu-bar+.el --- Extensions to `menu-bar.el'.
;;
;; Emacs Lisp Archive Entry
;; Filename: menu-bar+.el
;; Description: Extensions to `menu-bar.el'.
;; Author: Drew Adams
;; Maintainer: Drew Adams
;; Copyright (C) 1996-2001, Drew Adams, all rights reserved.
;; Created: Thu Aug 17 10:05:46 1995
;; Version: $Id: menu-bar+.el,v 1.7 2001/01/08 23:26:01 dadams Exp $
;; Last-Updated: Mon Jan  8 15:25:53 2001
;;           By: dadams
;;     Update #: 1830
;; Keywords: internal, local
;; Compatibility: GNU Emacs 20.x
;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;;    Extensions to `menu-bar.el'.  Redefines the default menu bar.
;;
;;  Main differences:
;;
;;    1. Added "Search" and "Frames" menus.
;;    2. Menus "Files", "Tools", "Edit", & "Help" were changed a lot.
;;    4. Order of menus changed.
;;    5. Buffer-local menus are separated from common menus via "||".
;;
;;  New functions defined here:
;;
;;    `describe-menubar', `fill-paragraph-ala-mode',
;;    `nonincremental-repeat-word-search-backward',
;;    `nonincremental-repeat-word-search-forward'
;;
;;  New menu variables defined here:
;;
;;    `menu-bar-apropos-menu', `menu-bar-describe-menu',
;;    `menu-bar-divider-menu', `menu-bar-edit-fill-menu',
;;    `menu-bar-edit-region-menu', `menu-bar-edit-sort-menu',
;;    `menu-bar-emacs-lisp-manual-menu', `menu-bar-emacs-manual-menu',
;;    `menu-bar-frames-menu', `menu-bar-print-menu',
;;    `menu-bar-search-replace-menu', `menu-bar-search-tags-menu',
;;    `menu-bar-whereami-menu'.
;;
;;
;;  ***** NOTE: The following functions defined in `menu-bar.el' have
;;              been REDEFINED HERE:
;;
;;  `kill-this-buffer' -        Deletes buffer's windows as well, if
;;                              `sub-kill-buffer-and-its-windows'.
;;  `menu-bar-select-buffer' -  1. Uses -other-frame.
;;                              2. defun -> defsubst.
;;
;;
;;  ***** NOTE: The following variables defined in `menu-bar.el' have
;;              been REDEFINED HERE:
;;
;;  `menu-bar-edit-menu', `menu-bar-files-menu',
;;  `menu-bar-manuals-menu', `menu-bar-search-menu'.
;;
;;
;;
;;  This file should be loaded after loading the standard GNU file
;;  `menu-bar.el'.  So, in your `~/.emacs' file, do this:
;;  (eval-after-load "menu-bar" '(require 'menu-bar+))
;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Change log:
;; 
;; RCS $Log: menu-bar+.el,v $
;; RCS Revision 1.7  2001/01/08 23:26:01  dadams
;; RCS Adapted file header for Emacs Lisp Archive.
;; RCS
;; RCS Revision 1.6  2001/01/03 17:40:18  dadams
;; RCS *** empty log message ***
;; RCS
;; RCS Revision 1.5  2001/01/03 00:54:44  dadams
;; RCS *** empty log message ***
;; RCS
;; RCS Revision 1.4  2000/12/07 19:51:05  dadams
;; RCS *** empty log message ***
;; RCS
;; RCS Revision 1.3  2000/11/28 20:26:39  dadams
;; RCS Optional require's via 3rd arg=t now.
;; RCS
;; RCS Revision 1.2  2000/09/27 22:14:16  dadams
;; RCS 1. Added to Files menu: execute-extended-command, repeat-complex-command.
;; RCS 2. Removed help-frame condition on show-*Help*-buffer.
;; RCS
;; RCS Revision 1.1  2000/09/14 17:23:06  dadams
;; RCS Initial revision
;; RCS
; Revision 1.18  1999/10/07  13:07:25  dadams
; Added autoloads for calendar+.
;
; Revision 1.17  1999/10/07  09:34:20  dadams
; Added show-calendar and separator to Tools menu.
;
; Revision 1.16  1999/10/01  14:40:37  dadams
; Added: menu-bar-divider-menu. Use it for [menu-bar divider].
;
; Revision 1.15  1999/09/02  08:33:18  dadams
; kill-this-buffer: 1) defsubst -> defun.
;                   2) use sub-kill-buffer-and-its-windows.
;
; Revision 1.14  1999/08/25  12:52:20  dadams
; 1. Removed: menu-bar-replace-menu.
; 2. Require when compile: vc+.el.
; 3. Added Frames menu (Ø). Changed Help to ? menu.
; 4. Commented out most of menu-bar-print-menu (all but PostScript).
;
; Revision 1.13  1999/04/08  10:09:51  dadams
; 1. Require help+.el.
; 2. Added to help menu: help-for-help.
;
; Revision 1.12  1999/04/07  15:57:08  dadams
; 1. Bound apropos stuff regardless of (fboundp 'apropos).
; 2. Corrected help menu order.
;
; Revision 1.11  1999/04/07  15:46:46  dadams
; 1. Added to help menu: help-on-click, save-*Help*-buffer.
; 2. apropos-symbol->apropos; super-apropos-symbol->apropos-documentation.
;
; Revision 1.10  1999/04/06  14:03:52  dadams
; Added *highlight*-region fns to Edit->Region submenu.
;
; Revision 1.9  1999/04/02  09:58:21  dadams
; 1. Only add "Show *Help* Buffer" if help-frame.
; 2. Removed: doctor.
;
; Revision 1.8  1999/03/29  14:30:17  dadams
; 1. Removed/added some `...'s.
; 2. Added 'put menu-enable's for VC stuff.
;
; Revision 1.7  1999/03/29  12:47:13  dadams
; 1. Removed 2 extra separators from tools vc sub menu.
; 2. Changed menu-enables: vc-diff, vc-toggle-read-only, vc-register.
;
; Revision 1.6  1999/03/26  13:38:47  dadams
; *** empty log message ***
;
; Revision 1.5  1999/03/26  13:37:53  dadams
; 1. Added vc-ediff to ediff menu (when fboundp).
; 2. Redefined vc-menu-map items: Replaced ediff-revision binding by
;    vc-ediff. Redefined vc-check-out. Enabled vc-ediff when should.
;
; Revision 1.4  1999/03/23  08:54:50  dadams
; 1. EDIFF: Removed: unset-key, compare-windows, ediff-buffers, vc-ediff,
;    ediff-files.
; 2. VERSION CONTROL: Added: ediff-revision, vc-diff.
;
; Revision 1.3  1999/03/17  12:16:16  dadams
; 1. Moved Replace menu to be a Search submenu.
; 2. Reordered Edit menu. Removed edit-options (on Help menu).
; 3. Removed default Help items (duplicate).
;
; Revision 1.2  1999/03/16  14:50:12  dadams
; Removed extra default binding (separator).
;
; Revision 1.1  1999/03/16  12:32:36  dadams
; Initial revision
;
; Revision 1.1  1997/03/21  12:54:38  dadams
; Initial revision
;
; Revision 1.21  1996/07/04  14:02:14  dadams
; remove-suffix: Fixed bug when suffix not in name.
;
; Revision 1.20  1996/07/01  13:18:54  dadams
; (trivial)
;
; Revision 1.19  1996/06/25  13:55:27  dadams
; Buffers menu: Added rename-buffer and rename-uniquely.
;
; Revision 1.18  1996/06/20  11:59:31  dadams
; Require help.el (save-*Help*-buffer, view-emacs-FAQ, view-emacs-lisp-news).
;
; Revision 1.17  1996/06/14  14:11:59  dadams
; Updated file header Commentary to mention new fns and vars defined here.
;
; Revision 1.16  1996/06/12  12:55:20  dadams
; ediff -> ediff-files, since the alias may not be autoloaded.
;
; Revision 1.15  1996/06/06  14:21:03  dadams
; 1. ###autoload: remove-suffix, menu-bar-search-menu.
; 2. Update of file dependency comments (e.g. "Autoloaded from...").
;
; Revision 1.14  1996/04/26  09:59:11  dadams
; Put escaped newlines on long-line strings.
;
; Revision 1.13  1996/04/24  09:53:25  dadams
; 1. Reordered File menu items.
; 2. Added edit-options to Edit menu.
;
; Revision 1.12  1996/04/22  09:08:29  dadams
; 1. menu-bar-edit-menu:  Added: flush-lines, keep-lines.
; 2. menu-bar-edit-region-menu:  Added: (un)tabify-region, center-region,
;    indent-rigidly-region, abbrevs-region, macro-region.
;
; Revision 1.11  1996/04/18  09:31:48  dadams
; Changed text of a few menu items.
;
; Revision 1.10  1996/04/16  08:20:11  dadams
; Files->Print menu:
;   1. Added declp-region-w-switches, declp-buffer-w-switches.
;   2. Added missing input-needed-suffix's, and a separator.
;
; Revision 1.9  1996/04/05  14:31:51  dadams
; Improved Commentary:  List redefinitions.
;
; Revision 1.8  1996/04/04  14:18:19  dadams
; 1. Require misc-cmds.el when compile, to quiet compiler.
; 2. Added redefinition of mouse-menu-choose-yank: Better message.
; 3. Added fill-paragraph-ala-mode.
; 4. Edit menu major changes:
;    a. Unbound (prebound) separator-edit, fill, spell.
;    b. undo -> advertised-undo.
;    c. Added yank-secondary and select-all to Edit menu.
;    d. Added Edit submenus Fill, Region, Sort, Highlight.
;
; Revision 1.7  1996/03/26  16:26:10  dadams
; menu-bar-replace-menu: 1) Added replace-regexp, replace-string.
;                        2) query-replace -> query-replace-w-options.
;
; Revision 1.6  1996/03/20  13:48:36  dadams
; 1. submenu-suffix, input-needed-suffix, max-buffer-file-len,
;    menu-bar-update-buffers: Added ;;;###autoload.
; 2. menu-bar-select-buffer, kill-this-buffer: defun -> defsubst.
;
; Revision 1.5  1996/03/19  09:38:52  dadams
; 1. menu-bar-help-menu: a) defvar+setq -> defconst b) Added edit-options.
;
; Revision 1.4  1996/03/18  15:41:06  dadams
; Added vc-diff to menu-bar-ediff-menu.
;
; Revision 1.3  1996/03/12  16:03:34  dadams
; 1. Unbound rcs-ediff.  2. Added diff and reordered ediff menu.
;
; Revision 1.2  1996/03/08  13:24:46  dadams
; 1. drew-window-cmds.el -> frame-cmds.el, drew-misc-19.el -> misc-cmds.el,
; 2. Added redefinition of kill-this-buffer.
;
; Revision 1.1  1996/03/05  13:12:05  dadams
; Initial revision
;
; Revision 1.23  1996/03/05  13:11:29  dadams
; 1. Copyright.  2. Renamed to menu-bar+.el.
;
; Revision 1.22  1996/02/22  16:54:30  dadams
; Added gnus to Misc menu.
;
; Revision 1.21  1996/02/13  14:14:07  dadams
; 1. Don't autoload finder.el (done via ###autoload).
; 2. No "..." for finder-by-keyword.
;
; Revision 1.20  1996/02/13  07:11:18  dadams
; No longer autoload finder+.el.  (My finder.el is ###autoloaded instead.)
;
; Revision 1.19  1996/02/12  09:22:36  dadams
; 1. Updated header keywords (for finder).
; 2. Autoload finder+.el.
;
; Revision 1.18  1996/02/08  17:25:49  dadams
; 1. Cleanup.  Require cl.el.
; 2. Added: save-*Help*-buffer, describe-syntax, locate-library,
;    finder-by-keyword, view-emacs-lisp-news, doctor.
;
; Revision 1.17  1996/02/06  10:53:34  dadams
; Put variable-interactive property on appropriate user option vars.
;
; Revision 1.16  1996/01/30  10:11:46  dadams
; raise-*Help*-buffer -> show-*Help*-buffer
;
; Revision 1.15  1996/01/26  12:48:08  dadams
; no-op -> %$>address@hidden (Shouldn't be bound command, else binding is 
shown.)
; In search menu: Reminder on search help.
;
; Revision 1.14  1996/01/25  16:12:39  dadams
; 1. setq, not defvar, menu-bar-help-menu, to wipe out original.
; 2. menu-bar-help-menu: Added Emacs FAQ.
;
; Revision 1.13  1996/01/17  09:14:09  dadams
; apropos -> apropos-symbol, super-apropos -> super-apropos-symbol.
;
; Revision 1.12  1996/01/16  08:43:37  dadams
; File->Print: Use (pr-)declp-region/buffer functions now.
;
; Revision 1.11  1996/01/12  16:54:31  dadams
; 1. list-buffers -> buffer-menu.  2. Kill buffer w/o "...".
; 3. File Print menus changed.
;
; Revision 1.10  1995/12/28  14:59:29  dadams
; (trivial)
;
; Revision 1.9  1995/11/28  12:49:09  dadams
; Put define-key's in first column, so imenu picks them up (cosmetic).
;
; Revision 1.8  1995/10/31  13:05:42  dadams
; (trivial - Keywords)
;
; Revision 1.7  1995/09/11  07:21:46  dadams
; Bookmarks added to Search menu.
;
; Revision 1.6  1995/09/04  13:53:26  dadams
; Changed header to GNU std.
;
; Revision 1.5  1995/08/31  07:55:27  dadams
; menu-bar-update-buffers: Abbreviate directory names, like file names
; (.../).
;
; Revision 1.4  1995/08/30  07:03:11  dadams
; Moved list-buffers up to main Buffers menu.  max-buffer-file-len :=
; 16.
;
; Revision 1.3  1995/08/29  14:50:52  dadams
; 1) Added: submenu-suffix, input-needed-suffix, remove-suffix.
; 2) Added to Search menu: grep, occur.
; 3) Put tags searches on submenu of Search.
; 4) fset -> defalias.
; 5) "Insert File" -> "Insert File..."
;
; Revision 1.2  1995/08/23  09:04:36  dadams
; 1) Added: max-buffer-file-len, menu-bar-update-buffers (adapted from
;    menu-bar.el).
; 2) Changed menu-bar-final-items order.
;
; Revision 1.1  1995/08/23  06:43:26  dadams
; Initial revision
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;; 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 2, or (at your option)
;; 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; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code: 

(require 'cl) ;; when, unless, pop, caar
(require 'menu-bar)
(when (string-match "i386" system-configuration)
  (require 'dlgopen nil t)) ;; (no error if not found): dlgopen-open-files
                            ;; `dlgopen.el' is from Binu Jose Philip
(require 'info+ nil t) ;; (no error if not found): dir-info, emacs-info, 
emacs-lisp-info,
                       ;; Info-goto-emacs-key-command-node, 
                       ;; Info-goto-emacs-command-node
(require 'help+ nil t) ;; (no error if not found): help-on-click/key
(require 'compile+ nil t) ;; (no error if not found): grep
(require 'highlight nil t) ;; (no error if not found): highlight-region, 
highlight-regexp-region, nhighlight-region
(require 'unaccent nil t) ;; (no error if not found): unaccent-region
(require 'macros+ nil t) ;; (no error if not found): apply-macro-to-region-lines
(require 'misc-cmds nil t) ;; (no error if not found): 
                           ;; exit-with-confirmation, 
kill-buffer-and-its-windows, yank-secondary
(require 'replace+ nil t) ;; (no error if not found): occur, 
query-replace-w-options, flush-lines, keep-lines
(require 'vc+ nil t) ;; (no error if not found): vc-diff, 
(require 'diff+ nil t) ;; (no error if not found): diff
(require 'apropos+ nil t) ;; (no error if not found): apropos-user-options

;;;@@@Emacs 20 (autoload 'show-calendar "calendar+"
;;;@@@Emacs 20   "Show *Calendar* buffer, generating it if not already 
present." t)
;;;@@@Emacs 20 (autoload 'calendar "calendar+"
;;;@@@Emacs 20   "Display a 3-month calendar in another window." t)
;;;@@@Emacs 20  ;; Autoloaded from `calendar+.el': calendar, show-calendar

 ;; In `files+.el', see defsubst version of switch-to-buffer-other-frame.
 ;; In `frame-cmds.el', see defsubst version of show-*Help*-buffer


(provide 'menu-bar+)

;;;;;;;;;;;;;;;;;;;;


;; REPLACES ORIGINAL in `menu-bar.el':
;; Uses -other-frame.  defun -> defsubst.
(defsubst menu-bar-select-buffer ()
  (interactive) (switch-to-buffer-other-frame last-command-event)) ;`files+.el'


;; REPLACES ORIGINAL MENU-BAR.

;;; Main MENU-BAR entries.
;; Divider before standard menus.
;;;###autoload
(defvar menu-bar-divider-menu (make-sparse-keymap "Divider"))
(define-key global-map [menu-bar divider] (cons "||" menu-bar-divider-menu))
(define-key menu-bar-divider-menu [menu-bar-divider-hint]
  '("<-- Current mode menus to left.   ||   Common menus to right -->"
    . describe-menubar))

;;;###autoload
(defun describe-menubar ()
  "Explain the menu bar, in general terms."
  (interactive)
  (with-output-to-temp-buffer "*Help*"
    (princ (substitute-command-keys
            "To the right of the menu bar divider (\"||\") are the general menus
that always appear in every buffer.  To the left of this symbol, there
may also be additional menus that are specific to the buffer's mode
\(use `\\[describe-mode]' for information on a buffer's mode).

The general menus are as follows:

    Buffers  Files  Tools  Edit  Search Mule  Frames  Help

Use the \"Frames\" menu to resize and hide/show frames.  The \"Help\" menu is an
extension of the \"Help\" menu described in the Emacs manual (`\\[info]').

For information on a menu item, use the \"This\" item in the \"Describe\"
submenu of the \"Help\" menu."))
    (print-help-return-message)
    (save-excursion
      (set-buffer standard-output)
      (help-mode)
      (buffer-string))))                ; Return the text we displayed.

;;;###autoload
(defvar menu-bar-frames-menu (make-sparse-keymap "Frames"))
(define-key global-map [menu-bar frames] (cons "Frames" menu-bar-frames-menu))

;; REPLACES ORIGINAL defined in `menu-bar.el'.
(defvar menu-bar-files-menu (make-sparse-keymap "Files"))
(define-key global-map [menu-bar files] (cons "Files" menu-bar-files-menu))

;; REPLACES ORIGINAL defined in `menu-bar.el'.
(defvar menu-bar-edit-menu (make-sparse-keymap "Edit"))
(define-key global-map [menu-bar edit] (cons "Edit" menu-bar-edit-menu))
;; Remove default bindings.

;; REPLACES ORIGINAL defined in `menu-bar.el'.
(global-unset-key [menu-bar search])
(defconst menu-bar-search-menu (make-sparse-keymap "Search"))
(define-key global-map [menu-bar search] (cons "Search" menu-bar-search-menu))

;;;@@@Emacs20 (defvar menu-bar-help-menu (make-sparse-keymap "Help")) ; Wipe 
out original.
;;;@@@Emacs20 (define-key global-map [menu-bar help-menu] (cons "?" 
menu-bar-help-menu))

;; Change main menu-bar order.
(setq menu-bar-final-items '(divider buffer files tools edit search mule frames 
help-menu))


;;; FRAMES menu.
(define-key menu-bar-frames-menu [iconify-everything]
  '("Iconify All Frames" . iconify-everything))
(define-key menu-bar-frames-menu [show-hide]
  '("Hide Frames / Show Buffers" . show-hide))
(define-key menu-bar-frames-menu [shrink-frame-to-fit]
  '("Shrink-Wrap This Frame" . shrink-frame-to-fit)) ; Defined in 
`shrink-fit.el'.


;;; FILES menu.
;; Remove some default bindings.
(global-unset-key [menu-bar files separator-buffers])
(global-unset-key [menu-bar files separator-exit])

(define-key menu-bar-files-menu [open-file]
  (if (and (fboundp 'dlgopen-open-files) (string-match "i386" 
system-configuration))
      '("Open File..." . dlgopen-open-files)
    '("Open File..." . find-file-other-frame)))
(define-key-after menu-bar-files-menu [dired]
  '("Open Directory..." . dired-other-frame) 'open-file)
(define-key-after menu-bar-files-menu [save-buffer] '("Save" . save-buffer) 
'dired)
(define-key-after menu-bar-files-menu [write-file]
  '("Save As..." . write-file) 'save-buffer)
(define-key-after menu-bar-files-menu [revert-buffer]
  '("Revert" . revert-buffer) 'write-file)
(define-key-after menu-bar-files-menu [insert-file]
  '("Insert File..." . insert-file) 'revert-buffer)
;;--------------------
(define-key-after menu-bar-files-menu [separator-frames] '("--") 'insert-file)
(define-key-after menu-bar-files-menu [one-window]
  '("One Window" . delete-other-windows) 'separator-frames)
(define-key-after menu-bar-files-menu [split-window]
  '("Split Window" . split-window-vertically) 'one-window)
(when (fboundp 'delete-frame) ; Don't use delete-frame as event name: it's a 
special event.
  (define-key-after menu-bar-files-menu [delete-this-frame]
    '("Delete Frame" . delete-frame) 'split-window)
  (define-key-after menu-bar-files-menu [make-frame-on-display]
    '("Open New Display..." . make-frame-on-display) 'delete-this-frame)
  (define-key-after menu-bar-files-menu [make-frame]
    '("Make New Frame" . make-frame) 'make-frame-on-display))
;;--------------------
(define-key-after menu-bar-files-menu [separator-exit] '("--")
  'make-frame)
(define-key-after menu-bar-files-menu [exec-cmd]
  '("Execute Command" . execute-extended-command) 'separator-exit)
(define-key-after menu-bar-files-menu [repeat-cmd]
  '("Repeat Earlier Command" . repeat-complex-command) 'exec-cmd)
(define-key-after menu-bar-files-menu [separator-exit2] '("--")
  'repeat-cmd)
(define-key menu-bar-files-menu [kill-buffer]
  '("Kill This Buffer" . kill-this-buffer))
;; Done in `menu-bar.el':
;; (put 'kill-this-buffer 'menu-enable '(kill-this-buffer-enabled-p))
(define-key menu-bar-files-menu [exit-emacs]
  '("Exit Emacs..." . exit-with-confirmation)) ; Defined in `misc-cmds.el'. 
(defsubst)


;; REPLACES ORIGINAL in `menu-bar.el':
;; Deletes buffer's windows as well.  defun -> defsubst.
(defun kill-this-buffer ()
"Delete the current buffer and delete all of its windows."
  (interactive)
  (if (and (boundp 'sub-kill-buffer-and-its-windows) ; In setup-keys.el.
           sub-kill-buffer-and-its-windows
           (fboundp 'kill-buffer-and-its-windows))
      (kill-buffer-and-its-windows (current-buffer)) ;`misc-cmds.el'
    (kill-buffer (current-buffer))))    ; <-- original defn.


;;; TOOLS menu.
;;;@@@Emacs20 ;; Remove some default bindings.
;;;@@@Emacs20 (global-unset-key [menu-bar tools separator-print])
;;;@@@Emacs20 (global-unset-key [menu-bar tools ps-print-region])
;;;@@@Emacs20 (global-unset-key [menu-bar tools ps-print-buffer])
;;;@@@Emacs20 (global-unset-key [menu-bar tools print-region])
;;;@@@Emacs20 (global-unset-key [menu-bar tools print-buffer])
;;;@@@Emacs20 
;;;@@@Emacs20 (defvar menu-bar-print-menu (make-sparse-keymap "Print"))
;;;@@@Emacs20 (define-key menu-bar-tools-menu [print] (cons "Print" 
menu-bar-print-menu))
;;;@@@Emacs20 (define-key-after menu-bar-tools-menu [separator-print] '("--") 
'print)
;;;@@@Emacs20 (define-key-after menu-bar-tools-menu [separator-cal] '("--") 
'rmail)
;;;@@@Emacs20 (define-key-after menu-bar-tools-menu [show-calendar] '("Show 
Calendar" . show-calendar) 'separator-cal)
;;;@@@Emacs20 (define-key-after menu-bar-tools-menu [calendar] '("Calendar and 
Reminders" . calendar) 'calendar)
 
;;;@@@Emacs20 ;; EDIFF submenu of TOOLS
(when (fboundp 'vc-ediff)
  (define-key menu-bar-ediff-menu [ediff-revision] ; Defined in `vc+.el'.
    '("File with Revision..." . vc-ediff))
  (define-key-after menu-bar-ediff-menu [vc-diff] ; Defined in `vc+.el'.
    '("File with Revision using Diff" . vc-diff) 'ediff-revision)
  (define-key-after menu-bar-ediff-menu [diff]
    '("Two Files using Diff..." . diff) 'ediff-files)) ; `diff+.el'

;;;@@@Emacs20 ;; PRINT submenu of TOOLS
;;;@@@Emacs20 ;; The `*-declp-*' commands are defined in `misc-cmds.el'.
;;;@@@Emacs20 (define-key menu-bar-print-menu [ps-print-region]
;;;@@@Emacs20   '("Region as Postscript" . ps-print-region-with-faces))
;;;@@@Emacs20 ;(put 'declp-region-w-switches 'menu-enable 'mark-active)
;;;@@@Emacs20 ;(define-key menu-bar-print-menu [declp-region-w-switches]
;;;@@@Emacs20 ;  '("Region with Switches..." . declp-region-w-switches))
;;;@@@Emacs20 ;(put 'pr-declp-region 'menu-enable 'mark-active)
;;;@@@Emacs20 ;(define-key menu-bar-print-menu [print-paged-region]
;;;@@@Emacs20 ;  '("Paged Region..." . pr-declp-region))
;;;@@@Emacs20 ;(put 'declp-region 'menu-enable 'mark-active)
;;;@@@Emacs20 ;(define-key menu-bar-print-menu [print-region]
;;;@@@Emacs20 ;  '("Region..." . declp-region))
;;;@@@Emacs20 ;;--------------------
;;;@@@Emacs20 (define-key menu-bar-print-menu [separator-print-buffer] '("--"))
;;;@@@Emacs20 (define-key menu-bar-print-menu [ps-print-buffer]
;;;@@@Emacs20   '("Buffer as Postscript" . ps-print-buffer-with-faces))
;;;@@@Emacs20 ;(define-key menu-bar-print-menu [declp-buffer-w-switches]
;;;@@@Emacs20 ;  '("Buffer with Switches..." . declp-buffer-w-switches))
;;;@@@Emacs20 ;(define-key menu-bar-print-menu [print-paged-buffer]
;;;@@@Emacs20 ;  '("Paged Buffer..." . pr-declp-buffer))
;;;@@@Emacs20 ;(define-key menu-bar-print-menu [print-buffer]
;;;@@@Emacs20 ;  '("Buffer..." . declp-buffer))

;;;@@@Emacs20 ;;; VERSION CONTROL submenu of TOOLS
;;;@@@Emacs20 (when (boundp 'vc-menu-map)
;;;@@@Emacs20 ;; Remove some default bindings.
;;;@@@Emacs20 (global-unset-key [menu-bar tools vc separator1])
;;;@@@Emacs20 (global-unset-key [menu-bar tools vc separator2])
;;;@@@Emacs20 (define-key vc-menu-map [vc-status-here] '("Files Here" . 
vc-status-here)))
;;;@@@Emacs20 (define-key-after vc-menu-map [vc-directory] '("Files Below" . 
vc-directory) 'vc-status-here)
;;;@@@Emacs20 (define-key-after vc-menu-map [vc-dir-separator1] '("--") 
'vc-directory)
;;;@@@Emacs20 (define-key-after vc-menu-map [ediff-revision] '("Compare with 
Version..." . vc-ediff) 'vc-dir-separator1)
;;;@@@Emacs20 (define-key-after vc-menu-map [vc-diff] '("Compare Last Version 
using Diff" . vc-diff) 'ediff-revision)
;;;@@@Emacs20 (define-key-after vc-menu-map [vc-version-other-window]
;;;@@@Emacs20   '("Show Other Version..." . vc-version-other-window) 'vc-diff)
;;;@@@Emacs20 (define-key-after vc-menu-map [vc-dir-separator2] '("--") 
'vc-version-other-window)
;;;@@@Emacs20 (define-key-after vc-menu-map [vc-rename-file] '("Rename File..." 
. vc-rename-file)
;;;@@@Emacs20   'vc-register)
;;;@@@Emacs20 (define-key vc-menu-map [vc-check-out] '("Check In/Out" . 
vc-toggle-read-only))
;;;@@@Emacs20 
;;;@@@Emacs20 (put 'vc-diff 'menu-enable '(or vc-mode vc-dired-mode (eq 
'dired-mode major-mode)))
;;;@@@Emacs20 (put 'vc-ediff 'menu-enable '(or vc-mode vc-dired-mode (eq 
'dired-mode major-mode)))
;;;@@@Emacs20 (put 'vc-version-other-window 'menu-enable '(or vc-mode 
vc-dired-mode (eq 'dired-mode major-mode)))
;;;@@@Emacs20 (put 'vc-toggle-read-only 'menu-enable '(or vc-mode 
vc-dired-mode))
;;;@@@Emacs20 (put 'vc-insert-headers 'menu-enable '(or vc-mode vc-dired-mode))
;;;@@@Emacs20 (put 'vc-register 'menu-enable '(not vc-mode)) ; vc-dired-mode is 
OK (e.g. Unregistered).
;;;@@@Emacs20 (put 'vc-rename-file 'menu-enable '(or vc-mode vc-dired-mode (eq 
'dired-mode major-mode)))
;;;@@@Emacs20 (put 'vc-revert-buffer 'menu-enable '(or vc-mode vc-dired-mode 
(eq 'dired-mode major-mode)))
;;;@@@Emacs20 (put 'vc-cancel-version 'menu-enable '(or vc-mode vc-dired-mode 
(eq 'dired-mode major-mode)))
;;;@@@Emacs20 (put 'vc-print-log 'menu-enable '(or vc-mode vc-dired-mode (eq 
'dired-mode major-mode)))
;;;@@@Emacs20 (put 'vc-update-change-log 'menu-enable (or (eq 
(vc-buffer-backend) 'RCS) vc-dired-mode (eq 'dired-mode major-mode)))


;;; EDIT menu
;; Remove some default bindings.
;;;@@@Emacs20 (global-unset-key [menu-bar edit separator-edit])

;;;@@@Emacs20 (define-key menu-bar-edit-menu [undo] '("Undo" . advertised-undo))
;;--------------------
;;;@@@Emacs20 (define-key-after menu-bar-edit-menu [separator-edit-undo] 
'("--") 'undo)
;;;@@@Emacs20 (define-key-after menu-bar-edit-menu [cut] '("Cut" . kill-region) 
'separator-edit-undo)
;;;@@@Emacs20 (define-key-after menu-bar-edit-menu [copy] '("Copy" . 
menu-bar-kill-ring-save) 'cut)
;;;@@@Emacs20 (define-key-after menu-bar-edit-menu [paste] '("Paste" . yank) 
'copy)
;;;@@@Emacs20 (define-key-after menu-bar-edit-menu [select-paste] '("Select and 
Paste" . yank-menu)
;;;@@@Emacs20   'paste)
;;;@@@Emacs20 (define-key-after menu-bar-edit-menu [clear] '("Clear" . 
delete-region) 'select-paste)
(define-key-after menu-bar-edit-menu [yank-secondary]
  '("Paste Secondary" . yank-secondary) 'clear) ; In `misc-cmds.el'
(put 'yank-secondary 'menu-enable '(x-selection-exists-p 'SECONDARY))
;;--------------------
(define-key-after menu-bar-edit-menu [separator-edit-cut] '("--")
  'yank-secondary)
(define-key-after menu-bar-edit-menu [select-all]
  '("Select All" . mark-whole-buffer) 'separator-edit-cut)
(define-key-after menu-bar-edit-menu [flush-lines] ; Defined in `replace+.el'.
  '("Delete Matching Lines..." . flush-lines) 'select-all)
(define-key-after menu-bar-edit-menu [keep-lines] ; Defined in `replace+.el'.
  '("Delete Non-Matching Lines..." . keep-lines) 'flush-lines)
;;--------------------
(define-key-after menu-bar-edit-menu [separator-edit-select-all] '("--")
  'keep-lines)
(defvar menu-bar-edit-fill-menu (make-sparse-keymap "Fill"))
;;;@@@Emacs20 (defalias 'menu-bar-edit-fill-menu (symbol-value 
'menu-bar-edit-fill-menu))
(define-key-after menu-bar-edit-menu [props] '("Text Properties" . 
facemenu-menu) 'separator-edit-select-all)
(define-key-after menu-bar-edit-menu [fill]
  (cons "Fill" menu-bar-edit-fill-menu) 'props)
(defvar menu-bar-edit-region-menu (make-sparse-keymap "Edit Region"))
(defalias 'menu-bar-edit-region-menu (symbol-value 'menu-bar-edit-region-menu))
(define-key-after menu-bar-edit-menu [region]
  (cons "Edit Region" menu-bar-edit-region-menu) 'fill)
(defvar menu-bar-edit-sort-menu (make-sparse-keymap "Sort Region"))
(defalias 'menu-bar-edit-sort-menu (symbol-value 'menu-bar-edit-sort-menu))
(define-key-after menu-bar-edit-menu [sort]
  (cons "Sort Region" menu-bar-edit-sort-menu) 'region)
;;;@@@Emacs20 (when (fboundp 'start-process)
;;;@@@Emacs20 (define-key-after menu-bar-edit-menu [spell] '("Spell" . 
ispell-menu-map) 'sort))

;; EDIT FILL submenu.
(define-key menu-bar-edit-fill-menu [fill-nonuniform-para]
  '("Fill Non-Uniform ¶'s" . fill-nonuniform-paragraphs))
(put 'fill-nonuniform-paragraphs 'menu-enable 'mark-active)
(define-key menu-bar-edit-fill-menu [fill-indiv-para]
  '("Fill Uniform ¶'s" . fill-individual-paragraphs))
(put 'fill-individual-paragraphs 'menu-enable 'mark-active)
(define-key menu-bar-edit-fill-menu [fill-region] '("Fill ¶'s" . fill-region))
(define-key menu-bar-edit-fill-menu [fill-para]
  '("Fill ¶" . fill-paragraph-ala-mode))

(defun fill-paragraph-ala-mode (&optional arg)
  "Do whatever `M-q' does, if it is bound.  Else, `fill-paragraph'.
Normally, this fills a paragraph according to the current major mode.
For example, in C Mode, `M-q' is normally bound to `c-fill-paragraph',
and in Lisp Mode, `M-q' is normally bound to `lisp-fill-paragraph'."
  (let ((map (current-local-map)))
    (or (and map (funcall (lookup-key map "\M-q") arg))
        (funcall (lookup-key (current-global-map) "\M-q") arg)
        (fill-paragraph arg))))

;; EDIT REGION submenu.
(define-key menu-bar-edit-region-menu [unaccent-region]
  '("Unaccent" . unaccent-region))      ; Defined in `unaccent'.
(put 'unaccent-region 'menu-enable 'mark-active)
(define-key menu-bar-edit-region-menu [capitalize-region]
  '("Capitalize" . capitalize-region))
(put 'capitalize-region 'menu-enable 'mark-active)
(define-key menu-bar-edit-region-menu [downcase-region]
  '("Downcase" . downcase-region))
(put 'downcase-region 'menu-enable 'mark-active)
(define-key menu-bar-edit-region-menu [upcase-region]
  '("Upcase" . upcase-region))
(put 'upcase-region 'menu-enable 'mark-active)
;;--------------------
(define-key menu-bar-edit-region-menu [separator-chars] '("--"))
(define-key menu-bar-edit-region-menu [unhighlight-region]
  '("Unhighlight". unhighlight-region))
(put 'unhighlight-region 'menu-enable 'mark-active)
(define-key menu-bar-edit-region-menu [highlight-regexp-region]
  '("Highlight Regexp..." . highlight-regexp-region))
(put 'highlight-regexp-region 'menu-enable 'mark-active)
(define-key menu-bar-edit-region-menu [highlight-region]
  '("Highlight..." . highlight-region))
(put 'highlight-region 'menu-enable 'mark-active)
;;--------------------
(define-key menu-bar-edit-region-menu [separator-highlight] '("--"))
(define-key menu-bar-edit-region-menu [untabify-region]
  '("Untabify" . untabify-region))
(put 'untabify-region 'menu-enable 'mark-active)
(define-key menu-bar-edit-region-menu [tabify-region]
  '("Tabify" . tabify-region))
(put 'tabify-region 'menu-enable 'mark-active)
(define-key menu-bar-edit-region-menu [comment-region]
  '("(Un)Comment" . comment-region))
(put 'comment-region 'menu-enable '(and mark-active comment-start))
(define-key menu-bar-edit-region-menu [center-region]
  '("Center" . center-region))
(put 'center-region 'menu-enable 'mark-active)
(define-key menu-bar-edit-region-menu [indent-rigidly-region]
  '("Rigid Indent" . indent-rigidly))
(put 'indent-rigidly 'menu-enable 'mark-active)
(define-key menu-bar-edit-region-menu [indent-region]
  '("Column/Mode Indent" . indent-region))
(put 'indent-region 'menu-enable 'mark-active)
;;--------------------
(define-key menu-bar-edit-region-menu [separator-indent] '("--"))
(define-key menu-bar-edit-region-menu [abbrevs-region]
  '("Expand Abbrevs" . expand-region-abbrevs))
(put 'expand-region-abbrevs 'menu-enable 'mark-active)
(define-key menu-bar-edit-region-menu [macro-region]
  '("Exec Keyboard Macro" . apply-macro-to-region-lines)) ; In `macros+.el'.
(put 'apply-macro-to-region-lines 'menu-enable
     '(and last-kbd-macro mark-active))

;; EDIT SORT submenu.
(define-key menu-bar-edit-sort-menu [sort-regexp-fields]
  '("Regexp Fields..." . sort-regexp-fields))
(put 'sort-regexp-fields 'menu-enable 'mark-active)
(define-key menu-bar-edit-sort-menu [sort-pages]
  '("Pages" . sort-pages))
(put 'sort-pages 'menu-enable 'mark-active)
(define-key menu-bar-edit-sort-menu [sort-paragraphs]
  '("Paragraphs" . sort-paragraphs))
(put 'sort-paragraphs 'menu-enable 'mark-active)
(define-key menu-bar-edit-sort-menu [sort-numeric-fields]
  '("Numeric Field" . sort-numeric-fields))
(put 'sort-numeric-fields 'menu-enable 'mark-active)
(define-key menu-bar-edit-sort-menu [sort-fields]
  '("Field" . sort-fields))
(put 'sort-fields 'menu-enable 'mark-active)
(define-key menu-bar-edit-sort-menu [sort-columns]
  '("Columns" . sort-columns))
(put 'sort-columns 'menu-enable 'mark-active)
(define-key menu-bar-edit-sort-menu [sort-lines]
  '("Lines" . sort-lines))
(put 'sort-lines 'menu-enable 'mark-active)
(define-key menu-bar-edit-sort-menu [reverse-region]
  '("Reverse" . reverse-region))
(put 'reverse-region 'menu-enable 'mark-active)


;;; SEARCH menu.

(defun nonincremental-repeat-word-search-forward ()
  "Search forward for the previous search string."
  (interactive)
  (word-search-forward (car search-ring)))

(defun nonincremental-repeat-word-search-backward ()
  "Search backward for the previous search string."
  (interactive)
  (word-search-backward (car search-ring)))

(define-key menu-bar-search-menu [reminder6] '(" " . %$>address@hidden))
(define-key menu-bar-search-menu [reminder5]
  (cons (substitute-command-keys
         "  Incr. Regexp Search: \\[isearch-forward-regexp], \
\\[isearch-backward-regexp]") '%$>address@hidden))
(define-key menu-bar-search-menu [reminder4]
  (cons (substitute-command-keys
         " Word Search: \\[isearch-forward] RET C-w, \\[isearch-backward] \
RET C-w") '%$>address@hidden))
(define-key menu-bar-search-menu [reminder3]
  (cons (substitute-command-keys
         "Incr. Search: \\[isearch-forward], \\[isearch-backward]  \
(\\[isearch-forward] C-h: Help)") '%$>address@hidden))
(define-key menu-bar-search-menu [reminder2]
  '("           ** Reminder **" . %$>address@hidden))
(define-key menu-bar-search-menu [reminder1] '(" " . %$>address@hidden))
(put '%$>address@hidden 'menu-enable '(not t))
;;--------------------
(define-key menu-bar-search-menu [separator-search-multiple] '("--"))
(define-key menu-bar-search-menu [bookmark]
  '("Bookmarks" . menu-bar-bookmark-map))
(defvar menu-bar-search-tags-menu (make-sparse-keymap "Tags"))
(defalias 'menu-bar-search-tags-menu
  (symbol-value 'menu-bar-search-tags-menu))
(define-key menu-bar-search-menu [tags]
  (cons "Tags" menu-bar-search-tags-menu))
(define-key menu-bar-search-menu [occur] '("Occurrences..." . occur))
(define-key menu-bar-search-menu [grep] '("Grep..." . grep)) ; In `compile.el'. 
;;--------------------
(define-key menu-bar-search-menu [separator-search-replace] '("--"))
(defvar menu-bar-search-replace-menu (make-sparse-keymap "Replace"))
(defalias 'menu-bar-search-replace-menu (symbol-value 
'menu-bar-search-replace-menu))
(define-key menu-bar-search-menu [replace]
  (cons "Replace" menu-bar-search-replace-menu))
;;--------------------
(define-key menu-bar-search-menu [separator-search-word] '("--"))
(define-key menu-bar-search-menu [repeat-word-search-back]
  '("             Again" . nonincremental-repeat-word-search-backward))
(define-key menu-bar-search-menu [word-search-back]
  '("     Backward..." . word-search-backward))
(define-key menu-bar-search-menu [repeat-word-search-fwd]
  '("             Again" . nonincremental-repeat-word-search-forward))
(define-key menu-bar-search-menu [word-search-fwd]
  '("Word Forward..." . word-search-forward))
;;--------------------
(define-key menu-bar-search-menu [separator-search-re] '("--"))
(define-key menu-bar-search-menu [repeat-regexp-back]
  '("               Again" . nonincremental-repeat-re-search-backward))
(define-key menu-bar-search-menu [re-search-backward]
  '("       Backward..." . nonincremental-re-search-backward))
(define-key menu-bar-search-menu [repeat-regexp-fwd]
  '("               Again" . nonincremental-repeat-re-search-forward))
(define-key menu-bar-search-menu [re-search-forward]
  '("Regexp Forward..." . nonincremental-re-search-forward))
;;--------------------
(define-key menu-bar-search-menu [separator-search] '("--"))
(define-key menu-bar-search-menu [repeat-search-back]
  '("               Again" . nonincremental-repeat-search-backward))
(define-key menu-bar-search-menu [search-backward]
  '("String Backward..." . nonincremental-search-backward))
(define-key menu-bar-search-menu [repeat-search-fwd]
  '("               Again" . nonincremental-repeat-search-forward))
(define-key menu-bar-search-menu [search-forward]
  '("String Forward..." . nonincremental-search-forward))

;;; SEARCH TAGS submenu.
(define-key menu-bar-search-tags-menu [tags-search]
  (cons (substitute-command-keys
         "Search Tags Files...  (again: \\[tags-loop-continue])")
        'tags-search))
(define-key menu-bar-search-tags-menu [find-tag-regexp]
  '("Find Tag Regexp..." . find-tag-regexp))
(define-key menu-bar-search-tags-menu [find-tag-other-frame]
  '("Find Tag..." . find-tag-other-frame))

;; REPLACE submenu
(define-key menu-bar-search-replace-menu [replace-regexp]
  '("       Regexp..." . replace-regexp))
(define-key menu-bar-search-replace-menu [replace-string]
  '("Global String..." . replace-string))
;;--------------------
(define-key menu-bar-search-replace-menu [separator-search-replace-global] 
'("--"))
(define-key menu-bar-search-replace-menu [tags-query-replace]
  (cons (substitute-command-keys
         "            Tags... (again: \\[tags-loop-continue])")
        'tags-query-replace))
(define-key menu-bar-search-replace-menu [map-query-replace-regexp]
  '("            Map..." . map-query-replace-regexp))
(define-key menu-bar-search-replace-menu [query-replace-regexp]
  '("      Regexp..." . query-replace-regexp))
(if (fboundp 'query-replace-w-options)  ; Defined in `replace+.el'.
    (define-key menu-bar-search-replace-menu [query-replace-w-options]
      '("Query String" . query-replace-w-options))
  (define-key menu-bar-search-replace-menu [query-replace-w-options]
    '("Query String" . query-replace)))
(put 'replace-regexp 'menu-enable '(not buffer-read-only))
(put 'replace-string 'menu-enable '(not buffer-read-only))
(put 'tags-query-replace 'menu-enable '(not buffer-read-only))
(put 'map-query-replace-regexp 'menu-enable '(not buffer-read-only))
(put 'query-replace-w-options 'menu-enable '(not buffer-read-only))
;; Done in menu-bar.el:
;; (put 'query-replace 'menu-enable '(not buffer-read-only))
;; (put 'query-replace-regexp 'menu-enable '(not buffer-read-only))


;;; HELP menu.

;;; General help
(define-key menu-bar-help-menu [separator-genl-help] '("--"))
(define-key menu-bar-help-menu [save-*Help*-buffer]
  '("Save *Help* Buffer" . save-*Help*-buffer)) ; In `help+.el'.
(define-key menu-bar-help-menu [show-*Help*-buffer]
  '("Show *Help* Buffer" . show-*Help*-buffer)) ; In `frame-cmds.el' (defsubst)
(define-key menu-bar-help-menu [help-for-help]
  '("Help on Help..." . help-for-help)) ;

;;; Remove some default bindings
(define-key menu-bar-help-menu [finder-by-keyword] nil)
(define-key menu-bar-help-menu [emacs-tutorial] nil)
(define-key menu-bar-help-menu [sep2] nil)

;;; Whoops!? submenu
(defvar menu-bar-whereami-menu (make-sparse-keymap "Whoops!?"))
(define-key menu-bar-help-menu [whereami]
  (cons "Whoops!?" menu-bar-whereami-menu))
(define-key menu-bar-whereami-menu [view-lossage]
  '("What did I do !?" . view-lossage)) ; Defined in `help.el'.
(define-key menu-bar-whereami-menu [top-level]
  '("Back to Top Level" . top-level))
(define-key menu-bar-whereami-menu [keyboard-quit]
  '("Cancel Current Action" . keyboard-quit))

;;; Apropos submenu
(defvar menu-bar-apropos-menu (make-sparse-keymap "Apropos"))
(define-key-after menu-bar-help-menu [apropos]
  (cons "Apropos" menu-bar-apropos-menu) 'separator-genl-help)
(define-key menu-bar-apropos-menu [apropos-doc] ; Defined in `apropos.el'.
  '("Symbol Descriptions..." . apropos-documentation))
(define-key menu-bar-apropos-menu [apropos-tags]
  '("Tags..." . tags-apropos))
(define-key menu-bar-apropos-menu [apropos-symbols] ; Defined in `apropos.el'
  '("Symbols..." . apropos))
(define-key menu-bar-apropos-menu [apropos-variables]
  '("All Variables..." . apropos-variable))
(when (fboundp 'apropos-user-options)
  (define-key menu-bar-apropos-menu [apropos-user-options]
    '("User Options..." . apropos-user-options)))
(define-key menu-bar-apropos-menu [apropos-command]
  '("Commands..." . apropos-command))

;;; Describe submenu
;;; Remove predefined version first.
(defconst menu-bar-describe-menu (make-sparse-keymap "Describe"))
(define-key-after menu-bar-help-menu [describe]
  (cons "Describe" menu-bar-describe-menu) 'apropos)
(when (fboundp 'help-on-click/key)
  (define-key menu-bar-describe-menu [help-on-click]
    '("This..." . help-on-click/key)))  ; Defined in `help+.el'.
(define-key-after menu-bar-describe-menu [describe-mode]
  '("Buffer Modes" . describe-mode) 'help-on-click)
(define-key-after menu-bar-describe-menu [describe-key]
  '("Key..." . describe-key) 'describe-mode)
(define-key-after menu-bar-describe-menu [describe-function]
  '("Function..." . describe-function) 'describe-key)
(define-key-after menu-bar-describe-menu [describe-variable]
  '("Variable..." . describe-variable) 'describe-function)
(define-key-after menu-bar-describe-menu [list-keybindings]
  '("All Key Bindings" . describe-bindings) 'describe-variable)
(when (fboundp 'describe-menubar)
  (define-key-after menu-bar-describe-menu [describe-menubar]
    '("Menu Bar" . describe-menubar) 'list-keybindings))
(define-key-after menu-bar-describe-menu [describe-syntax]
  '("Major Mode Syntax" . describe-syntax) 'describe-menubar)

;;; Manuals submenu.

;; REPLACES ORIGINAL defined in `menu-bar.el'.
;; Remove some default bindings.
;; Name changes.
(defconst menu-bar-manuals-menu (make-sparse-keymap "Learn More"))
(define-key-after menu-bar-help-menu [manuals]
  (cons "Learn More" menu-bar-manuals-menu) 'describe)
(define-key-after menu-bar-help-menu [separator-manuals] '("--") 'manuals)
(define-key menu-bar-manuals-menu [man]
  '("Unix Man Page..." . manual-entry))
(when (fboundp 'dir-info)
  (define-key menu-bar-manuals-menu [dir-info]
    '("All `Info' Manuals" . dir-info)))
(define-key menu-bar-manuals-menu [info]
  '("Last Accessed `Info' Manual" . info))
(define-key menu-bar-manuals-menu [emacs-faq] nil)
(define-key menu-bar-manuals-menu [emacs-news] nil)
(define-key menu-bar-manuals-menu [key] nil)
(define-key menu-bar-manuals-menu [command] nil)


;;; Emacs Lisp submenu of Manuals submenu.
(defvar menu-bar-emacs-lisp-manual-menu (make-sparse-keymap "Emacs Lisp"))
(define-key menu-bar-manuals-menu [emacs-lisp-manual]
  (cons "Emacs Lisp" menu-bar-emacs-lisp-manual-menu))
(define-key menu-bar-emacs-lisp-manual-menu [emacs-Lisp-News]
  '("Change History" . view-emacs-lisp-news)) ; Defined in `help.el'.
(define-key menu-bar-emacs-lisp-manual-menu [finder-by-keyword]
  '("Locate Libraries by Keyword" . finder-by-keyword)) ; Defined in 
`finder.el'.
(define-key menu-bar-emacs-lisp-manual-menu [locate-library] ; Defined in 
`help.el'.
  '("Locate Library..." . locate-library))
(define-key menu-bar-emacs-lisp-manual-menu [emacs-lisp-manual-separator] 
'("--"))
(when (fboundp 'emacs-lisp-info)
  (define-key menu-bar-emacs-lisp-manual-menu [emacs-lisp-info]
    '("Manual (`Info')" . emacs-lisp-info)))

;;; Emacs submenu of Manuals submenu.
(defvar menu-bar-emacs-manual-menu (make-sparse-keymap "Emacs"))
(define-key menu-bar-manuals-menu [emacs-manual]
  (cons "Emacs" menu-bar-emacs-manual-menu))
(define-key menu-bar-emacs-manual-menu [emacs-faq]
  '("FAQ" . view-emacs-FAQ))
(define-key menu-bar-emacs-manual-menu [emacs-news]
  '("Change History" . view-emacs-news))
(define-key menu-bar-emacs-manual-menu [emacs-manual-separator] '("--"))
(define-key menu-bar-emacs-manual-menu [key]
  '("Find Key in Manual" . Info-goto-emacs-key-command-node))
(define-key menu-bar-emacs-manual-menu [command]
  '("Find Command in Manual" . Info-goto-emacs-command-node))
(when (fboundp 'emacs-info)
  (define-key menu-bar-emacs-manual-menu [emacs-info]
    '("Manual (`Info')" . emacs-info)))
(define-key menu-bar-emacs-manual-menu [emacs-tutorial]
  '("Tutorial" . help-with-tutorial))

;;; Options submenu.
(define-key menu-bar-options-menu [all-options-separator] '("--"))
(define-key menu-bar-options-menu [edit-options]
  '("All Options" . edit-options))
(when (featurep 'icomplete)
  (define-key-after menu-bar-options-menu [icomplete-mode]
    (menu-bar-make-toggle toggle-icomplete-mode icomplete-mode
                          "Command Completion Clues" "Completion Clues %s")
    'all-options-separator))


;; Remove some default bindings.
;;;@@@Emacs20 (global-unset-key [menu-bar help emacs-news])
;;;@@@Emacs20 (global-unset-key [menu-bar help emacs-faq])

;;;@@@Emacs20 (define-key menu-bar-help-menu [help-on-click]
;;;@@@Emacs20   '("What's This?..." . help-on-click/key))       ; Defined in 
`help+.el'.
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [help-for-help]
;;;@@@Emacs20   '("Help on Help..." . help-for-help) 'help-on-click)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [describe-menubar]
;;;@@@Emacs20   '("Describe Menu Bar" . describe-menubar) 'help-for-help)
;;--------------------
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [separator-help-click] 
'("--")
;;;@@@Emacs20   'view-lossage)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [describe-mode]
;;;@@@Emacs20   '("Describe Mode" . describe-mode) 'separator-help-click)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [describe-syntax]
;;;@@@Emacs20   '("Describe Mode Syntax" . describe-syntax) 'describe-mode)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [describe-variable]
;;;@@@Emacs20   '("Describe Variable..." . describe-variable) 'describe-syntax)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [edit-options]
;;;@@@Emacs20   '("Show/Set Variables" . edit-options) 'describe-variable)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [describe-function]
;;;@@@Emacs20   '("Describe Function..." . describe-function) 'edit-options)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [where-is]
;;;@@@Emacs20   '("Where is Command..." . where-is) 'describe-function)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu 
[Info-goto-emacs-command-node]
;;;@@@Emacs20   '("`Info' on Command..." . Info-goto-emacs-command-node) 
'where-is) ; Defined in `info.el'.
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [describe-key]
;;;@@@Emacs20   '("Describe Key/Menu..." . describe-key) 
'Info-goto-emacs-command-node)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu 
[Info-goto-emacs-key-command-node]
;;;@@@Emacs20   '("`Info' on Key/Menu..." . Info-goto-emacs-key-command-node) 
'describe-key) ; Defined in `info.el'.
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [list-keybindings]
;;;@@@Emacs20   '("Show Key/Menu Bindings" . describe-bindings)
;;;@@@Emacs20   'Info-goto-emacs-key-command-node)
;;--------------------
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [separator-manuals] '("--")
;;;@@@Emacs20   'apropos-doc%%%%%%%%%%%%%)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [info] '("`Info' (online 
manuals)" . info) ; In `info+.el'.
;;;@@@Emacs20   'separator-manuals)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [man]
;;;@@@Emacs20   '("Unix Manual..." . manual-entry) 'info)
;;--------------------
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [separator-emacs] '("--") 
'man)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [emacs-tutorial]
;;;@@@Emacs20   '("Emacs Tutorial" . help-with-tutorial) 'separator-emacs)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [emacs-faq]
;;;@@@Emacs20   '("Emacs FAQ" . view-emacs-FAQ) 'emacs-tutorial)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [emacs-news]
;;;@@@Emacs20   '("Emacs Changes" . view-emacs-news) 'emacs-faq)
;;--------------------
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [separator-lispdoc] '("--")
;;;@@@Emacs20   'emacs-news)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [finder-by-keyword]
;;;@@@Emacs20   '("Lisp Libraries by Keyword" . finder-by-keyword) ; Defined in 
`finder.el'.
;;;@@@Emacs20   'separator-lispdoc)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [locate-library] ; Defined 
in `help.el'.
;;;@@@Emacs20   '("Locate Lisp Library..." . locate-library) 'finder-by-keyword)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [emacs-Lisp-News]
;;;@@@Emacs20   '("Emacs Lisp Changes" . view-emacs-lisp-news) ; Defined in 
`help.el'.
;;;@@@Emacs20   'locate-library)
;;--------------------
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [separator-about] '("--")
;;;@@@Emacs20   'emacs-Lisp-News)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [emacs-version]
;;;@@@Emacs20   '("Show Version" . emacs-version) 'separator-about)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [report-emacs-bug]
;;;@@@Emacs20   '("Send Bug Report..." . report-emacs-bug) 'emacs-version)
;;--------------------
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [separator-help-buffer] 
'("--")
;;;@@@Emacs20   'report-emacs-bug)
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [save-*Help*-buffer]
;;;@@@Emacs20   '("Save *Help* Buffer" . save-*Help*-buffer) 
'separator-help-buffer) ; In `help+.el'.
;;;@@@Emacs20 (define-key-after menu-bar-help-menu [show-*Help*-buffer]
;;;@@@Emacs20   '("Show *Help* Buffer" . show-*Help*-buffer) 
'save-*Help*-buffer) ; In `frame-cmds.el' (defsubst)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; `menu-bar+.el' ends here




reply via email to

[Prev in Thread] Current Thread [Next in Thread]