Mercurial > hg > xemacs-beta
comparison lisp/menubar-items.el @ 398:74fd4e045ea6 r21-2-29
Import from CVS: tag r21-2-29
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:13:30 +0200 |
parents | 6719134a07c2 |
children | 2f8bb876ab1d |
comparison
equal
deleted
inserted
replaced
397:f4aeb21a5bad | 398:74fd4e045ea6 |
---|---|
91 ["Undo" advertised-undo | 91 ["Undo" advertised-undo |
92 :active (and (not (eq buffer-undo-list t)) | 92 :active (and (not (eq buffer-undo-list t)) |
93 (or buffer-undo-list pending-undo-list)) | 93 (or buffer-undo-list pending-undo-list)) |
94 :suffix (if (or (eq last-command 'undo) | 94 :suffix (if (or (eq last-command 'undo) |
95 (eq last-command 'advertised-undo)) | 95 (eq last-command 'advertised-undo)) |
96 "More" "")] | 96 "More" "")] |
97 ["Redo" redo | 97 ["Redo" redo |
98 :included (fboundp 'redo) | 98 :included (fboundp 'redo) |
99 :active (not (or (eq buffer-undo-list t) | 99 :active (not (or (eq buffer-undo-list t) |
100 (eq last-buffer-undo-list nil) | 100 (eq last-buffer-undo-list nil) |
101 (not (or (eq last-buffer-undo-list buffer-undo-list) | 101 (not (or (eq last-buffer-undo-list buffer-undo-list) |
102 (and (null (car-safe buffer-undo-list)) | 102 (and (null (car-safe buffer-undo-list)) |
103 (eq last-buffer-undo-list | 103 (eq last-buffer-undo-list |
104 (cdr-safe buffer-undo-list))))) | 104 (cdr-safe buffer-undo-list))))) |
105 (or (eq buffer-undo-list pending-undo-list) | 105 (or (eq buffer-undo-list pending-undo-list) |
106 (eq (cdr buffer-undo-list) pending-undo-list)))) | 106 (eq (cdr buffer-undo-list) pending-undo-list)))) |
107 :suffix (if (eq last-command 'redo) "More" "")] | 107 :suffix (if (eq last-command 'redo) "More" "")] |
108 ["Cut" kill-primary-selection | 108 ["Cut" kill-primary-selection |
109 :active (selection-owner-p)] | 109 :active (selection-owner-p)] |
110 ["Copy" copy-primary-selection | 110 ["Copy" copy-primary-selection |
111 :active (selection-owner-p)] | 111 :active (selection-owner-p)] |
141 '(("Mule" | 141 '(("Mule" |
142 ("Describe language support") | 142 ("Describe language support") |
143 ("Set language environment") | 143 ("Set language environment") |
144 "--" | 144 "--" |
145 ["Toggle input method" toggle-input-method] | 145 ["Toggle input method" toggle-input-method] |
146 ["Select input method" select-input-method] | 146 ["Select input method" set-input-method] |
147 ["Describe input method" describe-input-method] | 147 ["Describe input method" describe-input-method] |
148 "--" | 148 "--" |
149 ["Describe current coding systems" | 149 ["Describe current coding systems" |
150 describe-current-coding-system] | 150 describe-current-coding-system] |
151 ["Set coding system of buffer file" | 151 ["Set coding system of buffer file" |
236 :filter (lambda (&rest junk) | 236 :filter (lambda (&rest junk) |
237 (package-get-download-menu))) | 237 (package-get-download-menu))) |
238 ["Update Package Index" package-get-update-base] | 238 ["Update Package Index" package-get-update-base] |
239 ["List & Install" pui-list-packages] | 239 ["List & Install" pui-list-packages] |
240 ["Update Installed Packages" package-get-update-all] | 240 ["Update Installed Packages" package-get-update-all] |
241 ;; hack-o-matic, we can't force a laod of package-base here | 241 ;; hack-o-matic, we can't force a load of package-base here |
242 ;; since it triggers dialog box interactions which we can't | 242 ;; since it triggers dialog box interactions which we can't |
243 ;; deal while using a menu | 243 ;; deal with while using a menu |
244 ("Using Custom" | 244 ("Using Custom" |
245 :filter (lambda (&rest junk) | 245 :filter (lambda (&rest junk) |
246 (if package-get-base | 246 (if package-get-base |
247 (cdr (custom-menu-create 'packages)) | 247 (cdr (custom-menu-create 'packages)) |
248 '(["Please load Package Index" (lamda (&rest junk) ()) nil])))) | 248 '(["Please load Package Index" (lamda (&rest junk) ()) nil])))) |
373 :active (boundp 'ps-paper-type)] | 373 :active (boundp 'ps-paper-type)] |
374 ) | 374 ) |
375 ["Color Printing" | 375 ["Color Printing" |
376 (cond (ps-print-color-p | 376 (cond (ps-print-color-p |
377 (customize-set-variable 'ps-print-color-p nil) | 377 (customize-set-variable 'ps-print-color-p nil) |
378 ;; I'm wondering whether all this muck is usefull. | 378 ;; I'm wondering whether all this muck is useful. |
379 (and (boundp 'original-face-background) | 379 (and (boundp 'original-face-background) |
380 original-face-background | 380 original-face-background |
381 (set-face-background 'default original-face-background))) | 381 (set-face-background 'default original-face-background))) |
382 (t | 382 (t |
383 (customize-set-variable 'ps-print-color-p t) | 383 (customize-set-variable 'ps-print-color-p t) |
632 (progn | 632 (progn |
633 (customize-set-variable 'bar-cursor t) | 633 (customize-set-variable 'bar-cursor t) |
634 (force-cursor-redisplay)) | 634 (force-cursor-redisplay)) |
635 :style radio | 635 :style radio |
636 :selected (eq bar-cursor t)] | 636 :selected (eq bar-cursor t)] |
637 ["Bar cursor (2 pixels)" | 637 ["Bar cursor (2 pixels)" |
638 (progn | 638 (progn |
639 (customize-set-variable 'bar-cursor 2) | 639 (customize-set-variable 'bar-cursor 2) |
640 (force-cursor-redisplay)) | 640 (force-cursor-redisplay)) |
641 :style radio | 641 :style radio |
642 :selected (and bar-cursor (not (eq bar-cursor t)))] | 642 :selected (and bar-cursor (not (eq bar-cursor t)))] |
643 "------" | 643 "------" |
644 ["Line Numbers" | 644 ["Line Numbers" |
645 (progn | 645 (progn |
646 (customize-set-variable 'line-number-mode (not line-number-mode)) | 646 (customize-set-variable 'line-number-mode (not line-number-mode)) |
647 (redraw-modeline)) | 647 (redraw-modeline)) |
648 :style toggle :selected line-number-mode] | 648 :style toggle :selected line-number-mode] |
649 ["Column Numbers" | 649 ["Column Numbers" |
650 (progn | 650 (progn |
651 (customize-set-variable 'column-number-mode | 651 (customize-set-variable 'column-number-mode |
652 (not column-number-mode)) | 652 (not column-number-mode)) |
653 (redraw-modeline)) | 653 (redraw-modeline)) |
654 :style toggle :selected column-number-mode] | 654 :style toggle :selected column-number-mode] |
655 ) | 655 ) |
656 ("Menubar Appearance" | 656 ("Menubar Appearance" |
657 ["Buffers Menu Length..." | 657 ["Buffers Menu Length..." |
658 (customize-set-variable | 658 (customize-set-variable |
659 'buffers-menu-max-size | 659 'buffers-menu-max-size |
735 (customize-set-variable 'default-toolbar-position 'right) | 735 (customize-set-variable 'default-toolbar-position 'right) |
736 :style radio | 736 :style radio |
737 :selected (eq default-toolbar-position 'right)] | 737 :selected (eq default-toolbar-position 'right)] |
738 ) | 738 ) |
739 ))) | 739 ))) |
740 ,@(if (featurep 'gutter) | |
741 '(("Gutter Appearance" | |
742 ["Visible" | |
743 (customize-set-variable 'gutter-visible-p | |
744 (not gutter-visible-p)) | |
745 :style toggle | |
746 :selected gutter-visible-p] | |
747 ("Default Location" | |
748 ["Top" | |
749 (customize-set-variable 'default-gutter-position 'top) | |
750 :style radio | |
751 :selected (eq default-gutter-position 'top)] | |
752 ["Bottom" | |
753 (customize-set-variable 'default-gutter-position 'bottom) | |
754 :style radio | |
755 :selected (eq default-gutter-position 'bottom)] | |
756 ["Left" | |
757 (customize-set-variable 'default-gutter-position 'left) | |
758 :style radio | |
759 :selected (eq default-gutter-position 'left)] | |
760 ["Right" | |
761 (customize-set-variable 'default-gutter-position 'right) | |
762 :style radio | |
763 :selected (eq default-gutter-position 'right)] | |
764 ) | |
765 ))) | |
740 ("Mouse" | 766 ("Mouse" |
741 ["Avoid Text..." | 767 ["Avoid Text..." |
742 (customize-set-variable 'mouse-avoidance-mode | 768 (customize-set-variable 'mouse-avoidance-mode |
743 (if mouse-avoidance-mode nil 'banish)) | 769 (if mouse-avoidance-mode nil 'banish)) |
744 :style toggle | 770 :style toggle |
953 ["Recent Messages" view-lossage] | 979 ["Recent Messages" view-lossage] |
954 ("Misc" | 980 ("Misc" |
955 ["No Warranty" describe-no-warranty] | 981 ["No Warranty" describe-no-warranty] |
956 ["XEmacs License" describe-copying] | 982 ["XEmacs License" describe-copying] |
957 ["The Latest Version" describe-distribution]) | 983 ["The Latest Version" describe-distribution]) |
958 ["Send Bug Report..." report-emacs-bug])))) | 984 ["Send Bug Report..." report-emacs-bug |
985 :active (fboundp 'report-emacs-bug)])))) | |
959 | 986 |
960 | 987 |
961 (defun maybe-add-init-button () | 988 (defun maybe-add-init-button () |
962 "Don't call this. | 989 "Don't call this. |
963 Adds `Load .emacs' button to menubar when starting up with -q." | 990 Adds `Load .emacs' button to menubar when starting up with -q." |
964 ;; by Stig@hackvan.com | 991 ;; by Stig@hackvan.com |
965 (cond | 992 (cond |
966 (init-file-user nil) | 993 (load-user-init-file-p nil) |
967 ((file-exists-p (expand-file-name ".emacs" "~")) | 994 ((file-exists-p (expand-file-name ".emacs" "~")) |
968 (add-menu-button nil | 995 (add-menu-button nil |
969 ["Load .emacs" | 996 ["Load .emacs" |
970 (progn (delete-menu-item '("Load .emacs")) | 997 (progn (delete-menu-item '("Load .emacs")) |
971 (load-user-init-file (user-login-name))) | 998 (load-user-init-file)) |
972 ] | 999 ] |
973 "Help")) | 1000 "Help")) |
974 (t nil))) | 1001 (t nil))) |
975 | 1002 |
976 (add-hook 'before-init-hook 'maybe-add-init-button) | 1003 (add-hook 'before-init-hook 'maybe-add-init-button) |
1079 | 1106 |
1080 (defcustom buffers-menu-sort-function | 1107 (defcustom buffers-menu-sort-function |
1081 'sort-buffers-menu-by-mode-then-alphabetically | 1108 'sort-buffers-menu-by-mode-then-alphabetically |
1082 "*If non-nil, a function to sort the list of buffers in the buffers menu. | 1109 "*If non-nil, a function to sort the list of buffers in the buffers menu. |
1083 It will be passed two arguments (two buffers to compare) and should return | 1110 It will be passed two arguments (two buffers to compare) and should return |
1084 T if the first is \"less\" than the second. One possible value is | 1111 t if the first is \"less\" than the second. One possible value is |
1085 `sort-buffers-menu-alphabetically'; another is | 1112 `sort-buffers-menu-alphabetically'; another is |
1086 `sort-buffers-menu-by-mode-then-alphabetically'." | 1113 `sort-buffers-menu-by-mode-then-alphabetically'." |
1087 :type '(choice (const :tag "None" nil) | 1114 :type '(choice (const :tag "None" nil) |
1088 function) | 1115 function) |
1089 :group 'buffers-menu) | 1116 :group 'buffers-menu) |
1113 "For use as a value of `buffers-menu-sort-function'. | 1140 "For use as a value of `buffers-menu-sort-function'. |
1114 Sorts the buffers in alphabetical order by name, but puts buffers beginning | 1141 Sorts the buffers in alphabetical order by name, but puts buffers beginning |
1115 with a star at the end of the list." | 1142 with a star at the end of the list." |
1116 (let* ((nam1 (buffer-name buf1)) | 1143 (let* ((nam1 (buffer-name buf1)) |
1117 (nam2 (buffer-name buf2)) | 1144 (nam2 (buffer-name buf2)) |
1145 (inv1p (not (null (string-match "\\` " nam1)))) | |
1146 (inv2p (not (null (string-match "\\` " nam2)))) | |
1118 (star1p (not (null (string-match "\\`*" nam1)))) | 1147 (star1p (not (null (string-match "\\`*" nam1)))) |
1119 (star2p (not (null (string-match "\\`*" nam2))))) | 1148 (star2p (not (null (string-match "\\`*" nam2))))) |
1120 (if (not (eq star1p star2p)) | 1149 (cond ((not (eq inv1p inv2p)) |
1121 (not star1p) | 1150 (not inv1p)) |
1122 (string-lessp nam1 nam2)))) | 1151 ((not (eq star1p star2p)) |
1152 (not star1p)) | |
1153 (t | |
1154 (string-lessp nam1 nam2))))) | |
1123 | 1155 |
1124 (defun sort-buffers-menu-by-mode-then-alphabetically (buf1 buf2) | 1156 (defun sort-buffers-menu-by-mode-then-alphabetically (buf1 buf2) |
1125 "For use as a value of `buffers-menu-sort-function'. | 1157 "For use as a value of `buffers-menu-sort-function'. |
1126 Sorts first by major mode and then alphabetically by name, but puts buffers | 1158 Sorts first by major mode and then alphabetically by name, but puts buffers |
1127 beginning with a star at the end of the list." | 1159 beginning with a star at the end of the list." |
1128 (let* ((nam1 (buffer-name buf1)) | 1160 (let* ((nam1 (buffer-name buf1)) |
1129 (nam2 (buffer-name buf2)) | 1161 (nam2 (buffer-name buf2)) |
1162 (inv1p (not (null (string-match "\\` " nam1)))) | |
1163 (inv2p (not (null (string-match "\\` " nam2)))) | |
1130 (star1p (not (null (string-match "\\`*" nam1)))) | 1164 (star1p (not (null (string-match "\\`*" nam1)))) |
1131 (star2p (not (null (string-match "\\`*" nam2)))) | 1165 (star2p (not (null (string-match "\\`*" nam2)))) |
1132 (mode1 (symbol-value-in-buffer 'major-mode buf1)) | 1166 (mode1 (symbol-value-in-buffer 'major-mode buf1)) |
1133 (mode2 (symbol-value-in-buffer 'major-mode buf2))) | 1167 (mode2 (symbol-value-in-buffer 'major-mode buf2))) |
1134 (cond ((not (eq star1p star2p)) (not star1p)) | 1168 (cond ((not (eq inv1p inv2p)) |
1169 (not inv1p)) | |
1170 ((not (eq star1p star2p)) | |
1171 (not star1p)) | |
1135 ((and star1p star2p (string-lessp nam1 nam2))) | 1172 ((and star1p star2p (string-lessp nam1 nam2))) |
1136 ((string-lessp mode1 mode2) t) | 1173 ((string-lessp mode1 mode2) |
1137 ((string-lessp mode2 mode1) nil) | 1174 t) |
1138 (t (string-lessp nam1 nam2))))) | 1175 ((string-lessp mode2 mode1) |
1176 nil) | |
1177 (t | |
1178 (string-lessp nam1 nam2))))) | |
1139 | 1179 |
1140 ;; this version is too slow on some machines. | 1180 ;; this version is too slow on some machines. |
1141 (defun slow-format-buffers-menu-line (buffer) | 1181 (defun slow-format-buffers-menu-line (buffer) |
1142 "For use as a value of `buffers-menu-format-buffer-line-function'. | 1182 "For use as a value of `buffers-menu-format-buffer-line-function'. |
1143 This returns a string containing a bunch of info about the buffer." | 1183 This returns a string containing a bunch of info about the buffer." |
1210 ) | 1250 ) |
1211 (vector "Save As..." | 1251 (vector "Save As..." |
1212 (list 'buffer-menu-write-file name) t) | 1252 (list 'buffer-menu-write-file name) t) |
1213 (vector "Delete Buffer" (list 'kill-buffer name) | 1253 (vector "Delete Buffer" (list 'kill-buffer name) |
1214 t))) | 1254 t))) |
1215 ;; ### We don't want buffer names to be translated, | 1255 ;; #### We don't want buffer names to be translated, |
1216 ;; ### so we put the buffer name in the suffix. | 1256 ;; #### so we put the buffer name in the suffix. |
1217 ;; ### Also, avoid losing with non-ASCII buffer names. | 1257 ;; #### Also, avoid losing with non-ASCII buffer names. |
1218 ;; ### We still lose, however, if complex-buffers-menu-p. --mrb | 1258 ;; #### We still lose, however, if complex-buffers-menu-p. --mrb |
1219 (vector "" | 1259 (vector "" |
1220 (list buffers-menu-switch-to-buffer-function | 1260 (list buffers-menu-switch-to-buffer-function |
1221 (buffer-name buffer)) | 1261 (buffer-name buffer)) |
1222 t line)))) | 1262 t line)))) |
1223 buffers))) | 1263 buffers))) |
1374 This is appended to the default items in `global-popup-menu'. | 1414 This is appended to the default items in `global-popup-menu'. |
1375 See the function `popup-menu' for a description of menu syntax.") | 1415 See the function `popup-menu' for a description of menu syntax.") |
1376 (make-variable-buffer-local 'mode-popup-menu) | 1416 (make-variable-buffer-local 'mode-popup-menu) |
1377 | 1417 |
1378 ;; In an effort to avoid massive menu clutter, this mostly worthless menu is | 1418 ;; In an effort to avoid massive menu clutter, this mostly worthless menu is |
1379 ;; superceded by any local popup menu... | 1419 ;; superseded by any local popup menu... |
1380 (setq-default mode-popup-menu default-popup-menu) | 1420 (setq-default mode-popup-menu default-popup-menu) |
1381 | 1421 |
1382 (defvar activate-popup-menu-hook nil | 1422 (defvar activate-popup-menu-hook nil |
1383 "Function or functions run before a mode-specific popup menu is made visible. | 1423 "Function or functions run before a mode-specific popup menu is made visible. |
1384 These functions are called with no arguments, and should interrogate and | 1424 These functions are called with no arguments, and should interrogate and |
1515 | 1555 |
1516 ;;; backwards compatibility | 1556 ;;; backwards compatibility |
1517 (provide 'x-menubar) | 1557 (provide 'x-menubar) |
1518 (provide 'menubar-items) | 1558 (provide 'menubar-items) |
1519 | 1559 |
1520 ;;; x-menubar.el ends here. | 1560 ;;; menubar-items.el ends here. |