aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2002-08-15 20:15:20 +0000
committerRichard M. Stallman2002-08-15 20:15:20 +0000
commit277e0f9d8f0829cbffcb1a6c63ae35c8bb68d93e (patch)
tree0a91e83e4d15047fe8fe067c297e5bb01951f9af
parent6b98185f8b443f82127f4e4f8b8211542db14a3b (diff)
downloademacs-277e0f9d8f0829cbffcb1a6c63ae35c8bb68d93e.tar.gz
emacs-277e0f9d8f0829cbffcb1a6c63ae35c8bb68d93e.zip
(menu-bar-next-tag-other-window, menu-bar-next-tag)
(menu-bar-right-scroll-bar, menu-bar-left-scroll-bar) (menu-bar-no-scroll-bar, menu-bar-toggle-auto-compression) (menu-bar-toggle-cua-mode, menu-bar-read-mail) (menu-bar-help-extra-packages, help-with-tutorial-spec-language) (menu-bar-text-mode-auto-fill): New commands, used in menu bar menus instead of lambda expressions. (menu-bar-showhide-fringe-menu-customize-left) (menu-bar-showhide-fringe-menu-customize-right) (menu-bar-showhide-fringe-menu-customize-disable) (menu-bar-showhide-fringe-menu-customize-reset): Doc fixes. (menu-bar-options-menu): Use toggle-truncate-lines. (showhide-date-time): Call customize-mark-as-set.
-rw-r--r--lisp/menu-bar.el166
1 files changed, 99 insertions, 67 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index ed79718db48..b1c0d9d831c 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -352,13 +352,24 @@ A large number or nil slows down menu responsiveness."
352 :help "Find function/variables whose names match regexp")) 352 :help "Find function/variables whose names match regexp"))
353(define-key menu-bar-goto-menu [next-tag-otherw] 353(define-key menu-bar-goto-menu [next-tag-otherw]
354 '(menu-item "Next Tag in Other Window" 354 '(menu-item "Next Tag in Other Window"
355 (lambda () (interactive) (find-tag-other-window nil t)) 355 menu-bar-next-tag-other-window
356 :enable (and (boundp 'tags-location-ring) 356 :enable (and (boundp 'tags-location-ring)
357 (not (ring-empty-p tags-location-ring))) 357 (not (ring-empty-p tags-location-ring)))
358 :help "Find next function/variable matching last tag name in another window")) 358 :help "Find next function/variable matching last tag name in another window"))
359
360(defun menu-bar-next-tag-other-window ()
361 "Find the next definition of the tag already specified."
362 (interactive)
363 (find-tag-other-window nil t))
364
365(defun menu-bar-next-tag ()
366 "Find the next definition of the tag already specified."
367 (interactive)
368 (find-tag nil t))
369
359(define-key menu-bar-goto-menu [next-tag] 370(define-key menu-bar-goto-menu [next-tag]
360 '(menu-item "Find Next Tag" 371 '(menu-item "Find Next Tag"
361 (lambda () (interactive) (find-tag nil t)) 372 menu-bar-next-tag
362 :enable (and (boundp 'tags-location-ring) 373 :enable (and (boundp 'tags-location-ring)
363 (not (ring-empty-p tags-location-ring))) 374 (not (ring-empty-p tags-location-ring)))
364 :help "Find next function/variable matching last tag name")) 375 :help "Find next function/variable matching last tag name"))
@@ -631,13 +642,11 @@ Do the same for the keys of the same name."
631 (interactive) 642 (interactive)
632 (if (display-time-mode) 643 (if (display-time-mode)
633 (message "Display-time mode enabled.") 644 (message "Display-time mode enabled.")
634 (message "Display-time mode disabled."))) 645 (message "Display-time mode disabled."))
646 (customize-mark-as-set 'display-time-mode))
635 647
636(define-key menu-bar-showhide-menu [showhide-date-time] 648(define-key menu-bar-showhide-menu [showhide-date-time]
637 '(menu-item "Date and Time" (lambda () 649 '(menu-item "Date and Time" showhide-date-time
638 (interactive)
639 (showhide-date-time)
640 (customize-mark-as-set 'display-time-mode))
641 :help "Display date and time in the mode line" 650 :help "Display date and time in the mode line"
642 :button (:toggle . display-time-mode))) 651 :button (:toggle . display-time-mode)))
643 652
@@ -666,7 +675,7 @@ Do the same for the keys of the same name."
666 :visible (display-graphic-p))) 675 :visible (display-graphic-p)))
667 676
668(defun menu-bar-showhide-fringe-menu-customize-reset () 677(defun menu-bar-showhide-fringe-menu-customize-reset ()
669 "Reset the default fringe mode." 678 "Reset the fringe mode: display fringes on both sides of a window."
670 (interactive) 679 (interactive)
671 (customize-set-variable 'fringe-mode nil)) 680 (customize-set-variable 'fringe-mode nil))
672 681
@@ -674,11 +683,10 @@ Do the same for the keys of the same name."
674 '(menu-item "Default" menu-bar-showhide-fringe-menu-customize-reset 683 '(menu-item "Default" menu-bar-showhide-fringe-menu-customize-reset
675 :help "Default width fringe on both left and right side" 684 :help "Default width fringe on both left and right side"
676 :visible (display-graphic-p) 685 :visible (display-graphic-p)
677 :button (:radio . (or (not (boundp 'fringe-mode)) 686 :button (:radio . (eq fringe-mode nil))))
678 (eq fringe-mode nil)))))
679 687
680(defun menu-bar-showhide-fringe-menu-customize-left () 688(defun menu-bar-showhide-fringe-menu-customize-left ()
681 "Make fringes appear only on the left." 689 "Display fringes only on the left of each window."
682 (interactive) 690 (interactive)
683 (require 'fringe) 691 (require 'fringe)
684 (customize-set-variable 'fringe-mode '(nil . 0))) 692 (customize-set-variable 'fringe-mode '(nil . 0)))
@@ -687,11 +695,10 @@ Do the same for the keys of the same name."
687 '(menu-item "On the Left" menu-bar-showhide-fringe-menu-customize-left 695 '(menu-item "On the Left" menu-bar-showhide-fringe-menu-customize-left
688 :help "Fringe only on the left side" 696 :help "Fringe only on the left side"
689 :visible (display-graphic-p) 697 :visible (display-graphic-p)
690 :button (:radio . (and (boundp 'fringe-mode) 698 :button (:radio . (equal fringe-mode '(nil . 0)))))
691 (equal fringe-mode '(nil . 0))))))
692 699
693(defun menu-bar-showhide-fringe-menu-customize-right () 700(defun menu-bar-showhide-fringe-menu-customize-right ()
694 "Make fringes appear only on the right." 701 "Display fringes only on the right of each window."
695 (interactive) 702 (interactive)
696 (require 'fringe) 703 (require 'fringe)
697 (customize-set-variable 'fringe-mode '(0 . nil))) 704 (customize-set-variable 'fringe-mode '(0 . nil)))
@@ -700,11 +707,10 @@ Do the same for the keys of the same name."
700 '(menu-item "On the Right" menu-bar-showhide-fringe-menu-customize-right 707 '(menu-item "On the Right" menu-bar-showhide-fringe-menu-customize-right
701 :help "Fringe only on the right side" 708 :help "Fringe only on the right side"
702 :visible (display-graphic-p) 709 :visible (display-graphic-p)
703 :button (:radio . (and (boundp 'fringe-mode) 710 :button (:radio . (equal fringe-mode '(0 . nil)))))
704 (equal fringe-mode '(0 . nil))))))
705 711
706(defun menu-bar-showhide-fringe-menu-customize-disable () 712(defun menu-bar-showhide-fringe-menu-customize-disable ()
707 "Make fringes disappear." 713 "Do not display window fringes."
708 (interactive) 714 (interactive)
709 (require 'fringe) 715 (require 'fringe)
710 (customize-set-variable 'fringe-mode 0)) 716 (customize-set-variable 'fringe-mode 0))
@@ -713,8 +719,7 @@ Do the same for the keys of the same name."
713 '(menu-item "None" menu-bar-showhide-fringe-menu-customize-disable 719 '(menu-item "None" menu-bar-showhide-fringe-menu-customize-disable
714 :help "Turn off fringe" 720 :help "Turn off fringe"
715 :visible (display-graphic-p) 721 :visible (display-graphic-p)
716 :button (:radio . (and (boundp 'fringe-mode) 722 :button (:radio . (eq fringe-mode 0))))
717 (eq fringe-mode 0)))))
718 723
719(define-key menu-bar-showhide-menu [showhide-fringe] 724(define-key menu-bar-showhide-menu [showhide-fringe]
720 (list 'menu-item "Fringe" menu-bar-showhide-fringe-menu 725 (list 'menu-item "Fringe" menu-bar-showhide-fringe-menu
@@ -725,34 +730,42 @@ Do the same for the keys of the same name."
725 730
726(define-key menu-bar-showhide-scroll-bar-menu [right] 731(define-key menu-bar-showhide-scroll-bar-menu [right]
727 '(menu-item "On the Right" 732 '(menu-item "On the Right"
728 (lambda () 733 menu-bar-right-scroll-bar
729 (interactive)
730 (customize-set-variable 'scroll-bar-mode 'right))
731 :help "Scroll-bar on the right side" 734 :help "Scroll-bar on the right side"
732 :visible (display-graphic-p) 735 :visible (display-graphic-p)
733 :button (:radio . (eq (cdr (assq 'vertical-scroll-bars 736 :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
734 (frame-parameters))) 'right)))) 737 (frame-parameters))) 'right))))
738(defun menu-bar-right-scroll-bar ()
739 "Display scroll bars on the right of each window."
740 (interactive)
741 (customize-set-variable 'scroll-bar-mode 'right))
735 742
736(define-key menu-bar-showhide-scroll-bar-menu [left] 743(define-key menu-bar-showhide-scroll-bar-menu [left]
737 '(menu-item "On the Left" 744 '(menu-item "On the Left"
738 (lambda () 745 menu-bar-left-scroll-bar
739 (interactive)
740 (customize-set-variable 'scroll-bar-mode 'left))
741 :help "Scroll-bar on the left side" 746 :help "Scroll-bar on the left side"
742 :visible (display-graphic-p) 747 :visible (display-graphic-p)
743 :button (:radio . (eq (cdr (assq 'vertical-scroll-bars 748 :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
744 (frame-parameters))) 'left)))) 749 (frame-parameters))) 'left))))
745 750
751(defun menu-bar-left-scroll-bar ()
752 "Display scroll bars on the left of each window."
753 (interactive)
754 (customize-set-variable 'scroll-bar-mode 'right))
755
746(define-key menu-bar-showhide-scroll-bar-menu [none] 756(define-key menu-bar-showhide-scroll-bar-menu [none]
747 '(menu-item "None" 757 '(menu-item "None"
748 (lambda () 758 menu-bar-no-scroll-bar
749 (interactive)
750 (customize-set-variable 'scroll-bar-mode nil))
751 :help "Turn off scroll-bar" 759 :help "Turn off scroll-bar"
752 :visible (display-graphic-p) 760 :visible (display-graphic-p)
753 :button (:radio . (eq (cdr (assq 'vertical-scroll-bars 761 :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
754 (frame-parameters))) nil)))) 762 (frame-parameters))) nil))))
755 763
764(defun menu-bar-no-scroll-bar ()
765 "Turn off scroll bars."
766 (interactive)
767 (customize-set-variable 'scroll-bar-mode nil))
768
756(define-key menu-bar-showhide-menu [showhide-scroll-bar] 769(define-key menu-bar-showhide-menu [showhide-scroll-bar]
757 (list 'menu-item "Scroll-bar" menu-bar-showhide-scroll-bar-menu 770 (list 'menu-item "Scroll-bar" menu-bar-showhide-scroll-bar-menu
758 :visible `(display-graphic-p) 771 :visible `(display-graphic-p)
@@ -822,13 +835,19 @@ Do the same for the keys of the same name."
822 '("--")) 835 '("--"))
823(define-key menu-bar-options-menu [toggle-auto-compression] 836(define-key menu-bar-options-menu [toggle-auto-compression]
824 '(menu-item "Automatic File De/compression" 837 '(menu-item "Automatic File De/compression"
825 (lambda () 838 menu-bar-toggle-auto-compression-mode
826 (interactive)
827 (auto-compression-mode)
828 (customize-mark-as-set 'auto-compression-mode))
829 :help "Transparently decompress compressed files" 839 :help "Transparently decompress compressed files"
830 :button (:toggle . (rassq 'jka-compr-handler 840 :button (:toggle . (rassq 'jka-compr-handler
831 file-name-handler-alist)))) 841 file-name-handler-alist))))
842
843(defun menu-bar-toggle-auto-compression ()
844 "Toggle automatic file compression and uncompression.
845With prefix argument ARG, turn auto compression on if positive, else off.
846Returns the new status of auto compression (non-nil means on)."
847 (interactive)
848 (auto-compression-mode)
849 (customize-mark-as-set 'auto-compression-mode))
850
832(define-key menu-bar-options-menu [save-place] 851(define-key menu-bar-options-menu [save-place]
833 (menu-bar-make-toggle toggle-save-place-globally save-place 852 (menu-bar-make-toggle toggle-save-place-globally save-place
834 "Save Place in Files between Sessions" 853 "Save Place in Files between Sessions"
@@ -850,40 +869,46 @@ Do the same for the keys of the same name."
850 '("--")) 869 '("--"))
851(define-key menu-bar-options-menu [cua-mode] 870(define-key menu-bar-options-menu [cua-mode]
852 '(menu-item "CUA-style cut and paste" 871 '(menu-item "CUA-style cut and paste"
853 (lambda () 872 menu-bar-toggle-cua-mode
854 (interactive)
855 (cua-mode nil)
856 (customize-mark-as-set 'cua-mode)
857 (message "CUA-style cut and paste %s"
858 (if cua-mode "enabled" "disabled")))
859 :help "Use C-z/C-x/C-c/C-v keys for undo/cut/copy/paste" 873 :help "Use C-z/C-x/C-c/C-v keys for undo/cut/copy/paste"
860 :button (:toggle . cua-mode))) 874 :button (:toggle . cua-mode)))
875
876(defun menu-bar-toggle-cua-mode ()
877 "Toggle CUA key-binding mode.
878When enabled, using shifted movement keys will activate the region (and
879highlight the region using `transient-mark-mode'), and typed text replaces
880the active selection. C-z, C-x, C-c, and C-v will undo, cut, copy, and
881paste (in addition to the normal Emacs bindings)."
882 (interactive)
883 (cua-mode nil)
884 (customize-mark-as-set 'cua-mode)
885 (message "CUA-style cut and paste %s"
886 (if cua-mode "enabled" "disabled")))
887
861(define-key menu-bar-options-menu [case-fold-search] 888(define-key menu-bar-options-menu [case-fold-search]
862 (menu-bar-make-toggle toggle-case-fold-search case-fold-search 889 (menu-bar-make-toggle toggle-case-fold-search case-fold-search
863 "Case-Insensitive Search" 890 "Case-Insensitive Search"
864 "Case-Insensitive Search %s" 891 "Case-Insensitive Search %s"
865 "Ignore letter-case in search")) 892 "Ignore letter-case in search"))
893
894(defun menu-bar-text-mode-auto-fill ()
895 (interactive)
896 (toggle-text-mode-auto-fill)
897 ;; This is somewhat questionable, as `text-mode-hook'
898 ;; might have changed outside customize.
899 ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11.
900 (customize-mark-as-set 'text-mode-hook))
901
866(define-key menu-bar-options-menu [auto-fill-mode] 902(define-key menu-bar-options-menu [auto-fill-mode]
867 '(menu-item "Word Wrap in Text Modes" 903 '(menu-item "Word Wrap in Text Modes"
868 (lambda () 904 menu-bar-text-mode-auto-fill
869 (interactive)
870 (toggle-text-mode-auto-fill)
871 ;; This is somewhat questionable, as `text-mode-hook'
872 ;; might have changed outside customize.
873 ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11.
874 (customize-mark-as-set 'text-mode-hook))
875 :help "Automatically fill text between left and right margins (Auto Fill)" 905 :help "Automatically fill text between left and right margins (Auto Fill)"
876 :button (:toggle . (if (listp text-mode-hook) 906 :button (:toggle . (if (listp text-mode-hook)
877 (member 'turn-on-auto-fill text-mode-hook) 907 (member 'turn-on-auto-fill text-mode-hook)
878 (eq 'turn-on-auto-fill text-mode-hook))))) 908 (eq 'turn-on-auto-fill text-mode-hook)))))
879(define-key menu-bar-options-menu [truncate-lines] 909(define-key menu-bar-options-menu [truncate-lines]
880 '(menu-item "Truncate Long Lines in this Buffer" 910 '(menu-item "Truncate Long Lines in this Buffer"
881 (lambda () 911 toggle-truncate-lines
882 (interactive)
883 (setq truncate-lines (not truncate-lines))
884 (set-buffer-modified-p (buffer-modified-p))
885 (message "Truncate long lines %s"
886 (if truncate-lines "enabled" "disabled")))
887 :help "Truncate long lines on the screen" 912 :help "Truncate long lines on the screen"
888 :button (:toggle . truncate-lines))) 913 :button (:toggle . truncate-lines)))
889 914
@@ -996,11 +1021,15 @@ Do the same for the keys of the same name."
996(define-key menu-bar-tools-menu [rmail] 1021(define-key menu-bar-tools-menu [rmail]
997 (list 1022 (list
998 'menu-item `(format "Read Mail (with %s)" (read-mail-item-name)) 1023 'menu-item `(format "Read Mail (with %s)" (read-mail-item-name))
999 (lambda () 1024 'menu-bar-read-mail
1000 (interactive)
1001 (call-interactively read-mail-command))
1002 :visible `(and read-mail-command (not (eq read-mail-command 'ignore))) 1025 :visible `(and read-mail-command (not (eq read-mail-command 'ignore)))
1003 :help "Read your mail and reply to it")) 1026 :help "Read your mail and reply to it"))
1027
1028(defun menu-bar-read-mail ()
1029 "Read manu using `read-mail-command'."
1030 (interactive)
1031 (call-interactively read-mail-command))
1032
1004(define-key menu-bar-tools-menu [gnus] 1033(define-key menu-bar-tools-menu [gnus]
1005 '(menu-item "Read Net News (Gnus)" gnus 1034 '(menu-item "Read Net News (Gnus)" gnus
1006 :help "Read network news groups")) 1035 :help "Read network news groups"))
@@ -1121,11 +1150,6 @@ key (or menu-item)"))
1121 (interactive) 1150 (interactive)
1122 (info "eintr")) 1151 (info "eintr"))
1123 1152
1124(defun menu-bar-read-emacs-man ()
1125 "Display Emacs User Manual in Info mode."
1126 (interactive)
1127 (info "emacs"))
1128
1129(defun search-emacs-glossary () 1153(defun search-emacs-glossary ()
1130 "Display the Glossary node of the Emacs manual in Info mode." 1154 "Display the Glossary node of the Emacs manual in Info mode."
1131 (interactive) 1155 (interactive)
@@ -1215,13 +1239,15 @@ key (or menu-item)"))
1215 :help "How to get latest versions of Emacs")) 1239 :help "How to get latest versions of Emacs"))
1216(define-key menu-bar-help-menu [more] 1240(define-key menu-bar-help-menu [more]
1217 '(menu-item "Find Extra Packages" 1241 '(menu-item "Find Extra Packages"
1218 (lambda () 1242 menu-bar-help-extra-packages
1219 (interactive)
1220 (let (enable-local-variables)
1221 (view-file (expand-file-name "MORE.STUFF"
1222 data-directory))
1223 (goto-address)))
1224 :help "Where to find some extra packages and possible updates")) 1243 :help "Where to find some extra packages and possible updates"))
1244(defun menu-bar-help-extra-packages ()
1245 "Display help about some additional packages available for Emacs."
1246 (interactive)
1247 (let (enable-local-variables)
1248 (view-file (expand-file-name "MORE.STUFF"
1249 data-directory))
1250 (goto-address)))
1225(define-key menu-bar-help-menu [about] 1251(define-key menu-bar-help-menu [about]
1226 '(menu-item "About Emacs" display-splash-screen 1252 '(menu-item "About Emacs" display-splash-screen
1227 :help "Display version number, copyright info, and basic help")) 1253 :help "Display version number, copyright info, and basic help"))
@@ -1234,7 +1260,7 @@ key (or menu-item)"))
1234 (list 'menu-item "More Manuals" menu-bar-manuals-menu 1260 (list 'menu-item "More Manuals" menu-bar-manuals-menu
1235 :help "Search and browse on-line manuals")) 1261 :help "Search and browse on-line manuals"))
1236(define-key menu-bar-help-menu [emacs-manual] 1262(define-key menu-bar-help-menu [emacs-manual]
1237 '(menu-item "Read the Emacs Manual" menu-bar-read-emacs-man 1263 '(menu-item "Read the Emacs Manual" info-emacs-manual
1238 :help "Full documentation of Emacs features")) 1264 :help "Full documentation of Emacs features"))
1239(define-key menu-bar-help-menu [describe] 1265(define-key menu-bar-help-menu [describe]
1240 (list 'menu-item "Describe" menu-bar-describe-menu 1266 (list 'menu-item "Describe" menu-bar-describe-menu
@@ -1254,9 +1280,15 @@ key (or menu-item)"))
1254 :help "New features of this version")) 1280 :help "New features of this version"))
1255(define-key menu-bar-help-menu [emacs-faq] 1281(define-key menu-bar-help-menu [emacs-faq]
1256 '(menu-item "Emacs FAQ" view-emacs-FAQ)) 1282 '(menu-item "Emacs FAQ" view-emacs-FAQ))
1283
1284(defun help-with-tutorial-spec-language ()
1285 "Use the Emacs tutorial, specifying which language you want."
1286 (interactive)
1287 (help-with-tutorial t))
1288
1257(define-key menu-bar-help-menu [emacs-tutorial-language-specific] 1289(define-key menu-bar-help-menu [emacs-tutorial-language-specific]
1258 '(menu-item "Emacs Tutorial (choose language)..." 1290 '(menu-item "Emacs Tutorial (choose language)..."
1259 (lambda () (interactive) (help-with-tutorial t)) 1291 help-with-tutorial-spec-language
1260 :help "Learn how to use Emacs (choose a language)")) 1292 :help "Learn how to use Emacs (choose a language)"))
1261(define-key menu-bar-help-menu [emacs-tutorial] 1293(define-key menu-bar-help-menu [emacs-tutorial]
1262 '(menu-item "Emacs Tutorial" help-with-tutorial 1294 '(menu-item "Emacs Tutorial" help-with-tutorial