diff options
| author | Richard M. Stallman | 1993-05-17 04:45:03 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-05-17 04:45:03 +0000 |
| commit | 057d49d1a8fbdda3a68a38c9bb94ad9a324f89f4 (patch) | |
| tree | 9b2a98d0c418683527e45472b90a3ca02574aeef | |
| parent | 7e85c6b5d7ef52e1c69b0fb52cbcfbe8774ba9b8 (diff) | |
| download | emacs-057d49d1a8fbdda3a68a38c9bb94ad9a324f89f4.tar.gz emacs-057d49d1a8fbdda3a68a38c9bb94ad9a324f89f4.zip | |
(fill-region, kill-region, delete-region)
(kill-ring-save): Use mark-active as enable condition.
(undo): Add an enable condition.
Fix up the edit commands. Add fill-region.
| -rw-r--r-- | lisp/menu-bar.el | 65 |
1 files changed, 44 insertions, 21 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 126fb5bb7fc..214b67a89a5 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -45,11 +45,21 @@ | |||
| 45 | (define-key menu-bar-file-menu [open-file] '("Open File..." . find-file)) | 45 | (define-key menu-bar-file-menu [open-file] '("Open File..." . find-file)) |
| 46 | (define-key menu-bar-file-menu [new-frame] '("New Frame" . new-frame)) | 46 | (define-key menu-bar-file-menu [new-frame] '("New Frame" . new-frame)) |
| 47 | 47 | ||
| 48 | (define-key menu-bar-edit-menu [clear] '("Clear" . x-delete-primary-selection)) | 48 | (define-key menu-bar-edit-menu [fill] '("Fill" . fill-region)) |
| 49 | (define-key menu-bar-edit-menu [paste] '("Paste" . x-yank-clipboard-selection)) | 49 | (define-key menu-bar-edit-menu [clear] '("Clear" . delete-region)) |
| 50 | (define-key menu-bar-edit-menu [copy] '("Copy" . x-copy-primary-selection)) | 50 | (define-key menu-bar-edit-menu [paste] '("Paste" . yank)) |
| 51 | (define-key menu-bar-edit-menu [cut] '("Cut" . x-kill-primary-selection)) | 51 | (define-key menu-bar-edit-menu [copy] '("Copy" . kill-ring-save)) |
| 52 | (define-key menu-bar-edit-menu [undo] '("Undo" . advertised-undo)) | 52 | (define-key menu-bar-edit-menu [cut] '("Cut" . kill-region)) |
| 53 | (define-key menu-bar-edit-menu [undo] '("Undo" . undo)) | ||
| 54 | |||
| 55 | (put 'fill-region 'menu-enable 'mark-active) | ||
| 56 | (put 'kill-region 'menu-enable 'mark-active) | ||
| 57 | (put 'kill-ring-save 'menu-enable 'mark-active) | ||
| 58 | (put 'yank 'menu-enable '(x-selection-exists-p)) | ||
| 59 | (put 'delete-region 'menu-enable 'mark-active) | ||
| 60 | (put 'undo 'menu-enable '(if (eq last-command 'undo) | ||
| 61 | pending-undo-list | ||
| 62 | (consp buffer-undo-list))) | ||
| 53 | 63 | ||
| 54 | (define-key menu-bar-help-menu [emacs-tutorial] | 64 | (define-key menu-bar-help-menu [emacs-tutorial] |
| 55 | '("Emacs Tutorial" . help-with-tutorial)) | 65 | '("Emacs Tutorial" . help-with-tutorial)) |
| @@ -88,12 +98,6 @@ | |||
| 88 | (put 'delete-frame 'menu-enable '(cdr (visible-frame-list))) | 98 | (put 'delete-frame 'menu-enable '(cdr (visible-frame-list))) |
| 89 | (put 'kill-this-buffer 'menu-enable '(kill-this-buffer-enabled-p)) | 99 | (put 'kill-this-buffer 'menu-enable '(kill-this-buffer-enabled-p)) |
| 90 | 100 | ||
| 91 | (put 'x-kill-primary-selection 'menu-enable '(x-selection-owner-p)) | ||
| 92 | (put 'x-copy-primary-selection 'menu-enable '(x-selection-owner-p)) | ||
| 93 | (put 'x-yank-clipboard-selection 'menu-enable '(x-selection-owner-p)) | ||
| 94 | (put 'x-delete-primary-selection 'menu-enable | ||
| 95 | '(x-selection-exists-p 'CLIPBOARD)) | ||
| 96 | |||
| 97 | (put 'advertised-undo 'menu-enable | 101 | (put 'advertised-undo 'menu-enable |
| 98 | '(and (not (eq t buffer-undo-list)) | 102 | '(and (not (eq t buffer-undo-list)) |
| 99 | (if (eq last-command 'undo) | 103 | (if (eq last-command 'undo) |
| @@ -193,18 +197,37 @@ and selects that window." | |||
| 193 | ;;; mode-name | 197 | ;;; mode-name |
| 194 | ;;; (or (buffer-file-name) "")))))) | 198 | ;;; (or (buffer-file-name) "")))))) |
| 195 | 199 | ||
| 196 | ;; Give all existing frames a menu bar. | 200 | (defvar menu-bar-mode nil) |
| 197 | ;; (Except for minibuffer-only frames.) | 201 | |
| 198 | (let ((frames (frame-list))) | 202 | (defun menu-bar-mode (flag) |
| 199 | (while frames | 203 | "Toggle display of vertical scroll bars on each frame. |
| 200 | (or (eq 'only (cdr (assq 'minibuffer (frame-parameters (car frames))))) | 204 | This command applies to all frames that exist and frames to be |
| 201 | (modify-frame-parameters (car frames) '((menu-bar-lines . 1)))) | 205 | created in the future. |
| 202 | (setq frames (cdr frames)))) | 206 | With a numeric argument, if the argument is negative, |
| 207 | turn off scroll bars; otherwise, turn on scroll bars." | ||
| 208 | (interactive "P") | ||
| 209 | (setq menu-bar-mode (if (null flag) (not menu-bar-mode) | ||
| 210 | (or (not (numberp flag)) (>= flag 0)))) | ||
| 211 | (let ((parameter (assq 'menu-bar-lines default-frame-alist))) | ||
| 212 | (if (consp parameter) | ||
| 213 | (setcdr parameter (if menu-bar-mode 1 0)) | ||
| 214 | (setq default-frame-alist | ||
| 215 | (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0)) | ||
| 216 | default-frame-alist)))) | ||
| 217 | (let ((frames (frame-list))) | ||
| 218 | (while frames | ||
| 219 | ;; Turn menu bar on or off in existing frames. | ||
| 220 | ;; (Except for minibuffer-only frames.) | ||
| 221 | (or (eq 'only (cdr (assq 'minibuffer (frame-parameters (car frames))))) | ||
| 222 | (modify-frame-parameters | ||
| 223 | (car frames) | ||
| 224 | (list (if menu-bar-mode | ||
| 225 | '(menu-bar-lines . 1) | ||
| 226 | '(menu-bar-lines . 0))))) | ||
| 227 | (setq frames (cdr frames))))) | ||
| 203 | 228 | ||
| 204 | ;; Make frames created from now on have a menu bar. | 229 | ;; Make frames created from now on have a menu bar. |
| 205 | (or (assq 'menu-bar-lines default-frame-alist) | 230 | (menu-bar-mode t) |
| 206 | (setq default-frame-alist | ||
| 207 | (cons '(menu-bar-lines . 1) default-frame-alist))) | ||
| 208 | 231 | ||
| 209 | (provide 'menu-bar) | 232 | (provide 'menu-bar) |
| 210 | 233 | ||