Bug fix for vc-dispatcher split.
[bpt/emacs.git] / lisp / menu-bar.el
index 00f7678..0ba1a0b 100644 (file)
 
 ;;; Code:
 
-;;; User options:
-
-(defcustom buffers-menu-max-size 10
-  "*Maximum number of entries which may appear on the Buffers menu.
-If this is 10, then only the ten most-recently-selected buffers are shown.
-If this is nil, then all buffers are shown.
-A large number or nil slows down menu responsiveness."
-  :type '(choice integer
-                (const :tag "All" nil))
-  :group 'mouse)
-
 ;; Don't clobber an existing menu-bar keymap, to preserve any menu-bar key
 ;; definitions made in loaddefs.el.
 (or (lookup-key global-map [menu-bar])
@@ -1141,6 +1130,73 @@ mail status in mode line"))
   '(menu-item "5x5" 5x5
              :help "Fill in all the squares on a 5x5 board"))
 
+(defvar menu-bar-encryption-decryption-menu
+  (make-sparse-keymap "Encryption/Decryption"))
+
+(define-key menu-bar-tools-menu [encryption-decryption]
+  (list 'menu-item "Encryption/Decryption" menu-bar-encryption-decryption-menu))
+
+(define-key menu-bar-tools-menu [separator-encryption-decryption]
+  '("--"))
+
+(define-key menu-bar-encryption-decryption-menu [insert-keys]
+  '(menu-item "Insert Keys" epa-insert-keys
+             :help "Insert public keys after the current point"))
+
+(define-key menu-bar-encryption-decryption-menu [export-keys]
+  '(menu-item "Export Keys" epa-export-keys
+             :help "Export public keys to a file"))
+
+(define-key menu-bar-encryption-decryption-menu [import-keys-region]
+  '(menu-item "Import Keys from Region" epa-import-keys-region
+             :help "Import public keys from the current region"))
+
+(define-key menu-bar-encryption-decryption-menu [import-keys]
+  '(menu-item "Import Keys from File..." epa-import-keys
+             :help "Import public keys from a file"))
+
+(define-key menu-bar-encryption-decryption-menu [list-keys]
+  '(menu-item "List Keys" epa-list-keys
+             :help "Browse your public keyring"))
+
+(define-key menu-bar-encryption-decryption-menu [separator-keys]
+  '("--"))
+
+(define-key menu-bar-encryption-decryption-menu [sign-region]
+  '(menu-item "Sign Region" epa-sign-region
+             :help "Create digital signature of the current region"))
+
+(define-key menu-bar-encryption-decryption-menu [verify-region]
+  '(menu-item "Verify Region" epa-verify-region
+             :help "Verify digital signature of the current region"))
+
+(define-key menu-bar-encryption-decryption-menu [encrypt-region]
+  '(menu-item "Encrypt Region" epa-encrypt-region
+             :help "Encrypt the current region"))
+
+(define-key menu-bar-encryption-decryption-menu [decrypt-region]
+  '(menu-item "Decrypt Region" epa-decrypt-region
+             :help "Decrypt the current region"))
+
+(define-key menu-bar-encryption-decryption-menu [separator-file]
+  '("--"))
+
+(define-key menu-bar-encryption-decryption-menu [sign-file]
+  '(menu-item "Sign File..." epa-sign-file
+             :help "Create digital signature of a file"))
+
+(define-key menu-bar-encryption-decryption-menu [verify-file]
+  '(menu-item "Verify File..." epa-verify-file
+             :help "Verify digital signature of a file"))
+
+(define-key menu-bar-encryption-decryption-menu [encrypt-file]
+  '(menu-item "Encrypt File..." epa-encrypt-file
+             :help "Encrypt a file"))
+
+(define-key menu-bar-encryption-decryption-menu [decrypt-file]
+  '(menu-item "Decrypt File..." epa-decrypt-file
+             :help "Decrypt a file"))
+
 (define-key menu-bar-tools-menu [simple-calculator]
   '(menu-item "Simple Calculator" calculator
              :help "Invoke the Emacs built-in quick calculator"))
@@ -1482,7 +1538,7 @@ using `abort-recursive-edit'."
 (defcustom yank-menu-length 20
   "*Maximum length to display in the yank-menu."
   :type 'integer
-  :group 'mouse)
+  :group 'menu)
 
 (defun menu-bar-update-yank-menu (string old)
   (let ((front (car (cdr yank-menu)))
@@ -1519,6 +1575,26 @@ The menu shows all the killed text sequences stored in `kill-ring'."
   (insert last-command-event))
 
 \f
+;;; Buffers Menu
+
+(defcustom buffers-menu-max-size 10
+  "*Maximum number of entries which may appear on the Buffers menu.
+If this is 10, then only the ten most-recently-selected buffers are shown.
+If this is nil, then all buffers are shown.
+A large number or nil slows down menu responsiveness."
+  :type '(choice integer
+                (const :tag "All" nil))
+  :group 'menu)
+
+(defcustom buffers-menu-buffer-name-length 30
+  "*Maximum length of the buffer name on the Buffers menu.
+If this is a number, then buffer names are truncated to this length.
+If this is nil, then buffer names are shown in full.
+A large number or nil makes the menu too wide."
+  :type '(choice integer
+                (const :tag "Full length" nil))
+  :group 'menu)
+
 (defcustom buffers-menu-show-directories 'unless-uniquify
   "If non-nil, show directories in the Buffers menu for buffers that have them.
 The special value `unless-uniquify' means that directories will be shown
@@ -1606,11 +1682,16 @@ Buffers menu is regenerated."
                      (unless (eq ?\s (aref name 0))
                        (push (menu-bar-update-buffers-1
                               (cons buf
-                                    (if (> (length name) 27)
-                                        (concat (substring name 0 12)
-                                                "..."
-                                                (substring name -12))
-                                      name)))
+                                   (if (and (integerp buffers-menu-buffer-name-length)
+                                            (> (length name) buffers-menu-buffer-name-length))
+                                       (concat
+                                        (substring
+                                         name 0 (/ buffers-menu-buffer-name-length 2))
+                                        "..."
+                                        (substring
+                                         name (- (/ buffers-menu-buffer-name-length 2))))
+                                     name)
+                                    ))
                              alist))))
                 ;; Now make the actual list of items.
                  (let ((buffers-vec (make-vector (length alist) nil))