530 |
(substring help 1) ".") |
(substring help 1) ".") |
531 |
(interactive) |
(interactive) |
532 |
(if ,(if body `(progn . ,body) |
(if ,(if body `(progn . ,body) |
533 |
`(setq ,variable (not ,variable))) |
`(progn |
534 |
(message ,message "enabled") |
(custom-load-symbol ',variable) |
535 |
|
(let ((set (or (get ',variable 'custom-set) 'set-default)) |
536 |
|
(get (or (get ',variable 'custom-get) 'default-value))) |
537 |
|
(funcall set ',variable (not (funcall get ',variable)))))) |
538 |
|
(message ,message "enabled") |
539 |
(message ,message "disabled"))) |
(message ,message "disabled"))) |
540 |
'(menu-item ,doc ,name |
;; The function `customize-mark-as-set' must only be called when |
541 |
|
;; a variable is set interactively, as the purpose is to mark it |
542 |
|
;; as a candidate for "Save Options", and we do not want to save |
543 |
|
;; options the user have already set explicitly in his init |
544 |
|
;; file. Unfortunately, he could very likely call the function |
545 |
|
;; defined above there. So we put `customize-mark-as-set' in a |
546 |
|
;; lambda expression. |
547 |
|
;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11. |
548 |
|
'(menu-item ,doc (lambda () |
549 |
|
(interactive) |
550 |
|
(,name) |
551 |
|
(customize-mark-as-set ',variable)) |
552 |
:help ,help |
:help ,help |
553 |
:button (:toggle . (and (boundp ',variable) ,variable))))) |
:button (:toggle . (and (default-boundp ',variable) |
554 |
|
(default-value ',variable)))))) |
555 |
|
|
556 |
;;; Assemble all the top-level items of the "Options" menu |
;;; Assemble all the top-level items of the "Options" menu |
557 |
(define-key menu-bar-options-menu [customize] |
(define-key menu-bar-options-menu [customize] |
562 |
"Save current values of Options menu items using Custom." |
"Save current values of Options menu items using Custom." |
563 |
(interactive) |
(interactive) |
564 |
(let ((need-save nil)) |
(let ((need-save nil)) |
565 |
(dolist (elt '(debug-on-quit debug-on-error auto-compression-mode |
;; These are set with `customize-set-variable'. |
566 |
|
(dolist (elt '(line-number-mode column-number-mode scroll-bar-mode |
567 |
|
debug-on-quit debug-on-error menu-bar-mode tool-bar-mode |
568 |
|
save-place uniquify-buffer-name-style |
569 |
case-fold-search truncate-lines show-paren-mode |
case-fold-search truncate-lines show-paren-mode |
570 |
transient-mark-mode global-font-lock-mode |
transient-mark-mode global-font-lock-mode |
571 |
current-language-environment default-input-method |
display-time-mode auto-compression-mode |
572 |
default-frame-alist display-time-mode |
;; Saving `text-mode-hook' is somewhat questionable, |
573 |
line-number-mode column-number-mode)) |
;; as we might get more than we bargain for, if |
574 |
|
;; other code may has added hooks as well. |
575 |
|
;; Nonetheless, not saving it would like be confuse |
576 |
|
;; more often. |
577 |
|
;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11. |
578 |
|
text-mode-hook)) |
579 |
|
(and (get elt 'customized-value) |
580 |
|
(customize-mark-to-save elt) |
581 |
|
(setq need-save t))) |
582 |
|
;; These are set with other functions. |
583 |
|
(dolist (elt '(current-language-environment default-input-method)) |
584 |
(when (customize-mark-to-save elt) |
(when (customize-mark-to-save elt) |
585 |
(setq need-save t))) |
(setq need-save t))) |
|
;; We only want to save text-mode-hook after adding or removing auto fill. |
|
|
(and (or (memq 'turn-on-auto-fill text-mode-hook) ;Added. |
|
|
;; If it is already saved, it is safe to save. |
|
|
(get 'text-mode-hook 'saved-value)) ;Maybe removed. |
|
|
(customize-mark-to-save 'text-mode-hook) |
|
|
(setq need-save t)) |
|
|
;; Avoid loading extra libraries. |
|
|
(and (featurep 'saveplace) |
|
|
(customize-mark-to-save 'save-place) |
|
|
(setq need-save t)) |
|
|
(and (featurep 'uniquify) |
|
|
(customize-mark-to-save 'uniquify-buffer-name-style) |
|
|
(setq need-save t)) |
|
586 |
;; Save if we changed anything. |
;; Save if we changed anything. |
587 |
(when need-save |
(when need-save |
588 |
(custom-save-all)))) |
(custom-save-all)))) |
619 |
(message "Display-time mode disabled."))) |
(message "Display-time mode disabled."))) |
620 |
|
|
621 |
(define-key menu-bar-showhide-menu [showhide-date-time] |
(define-key menu-bar-showhide-menu [showhide-date-time] |
622 |
'(menu-item "Date and time" showhide-date-time |
'(menu-item "Date and time" (lambda () |
623 |
|
(interactive) |
624 |
|
(showhide-date-time) |
625 |
|
(customize-mark-as-set 'display-time-mode)) |
626 |
:help "Display date and time in the mode-line" |
:help "Display date and time in the mode-line" |
627 |
:button (:toggle . display-time-mode))) |
:button (:toggle . display-time-mode))) |
628 |
|
|
631 |
|
|
632 |
(defvar menu-bar-showhide-scroll-bar-menu (make-sparse-keymap "Scroll-bar")) |
(defvar menu-bar-showhide-scroll-bar-menu (make-sparse-keymap "Scroll-bar")) |
633 |
|
|
|
(defun menu-bar-scroll-bar-right () |
|
|
"Turn on the scroll-bar on the right side." |
|
|
(interactive) |
|
|
(set-scroll-bar-mode 'right)) |
|
|
|
|
|
(defun menu-bar-scroll-bar-left () |
|
|
"Turn on the scroll-bar on the left side." |
|
|
(interactive) |
|
|
(set-scroll-bar-mode 'left)) |
|
|
|
|
|
(defun menu-bar-scroll-bar-none () |
|
|
"Turn off the scroll-bar." |
|
|
(interactive) |
|
|
(set-scroll-bar-mode nil)) |
|
|
|
|
634 |
(define-key menu-bar-showhide-scroll-bar-menu [right] |
(define-key menu-bar-showhide-scroll-bar-menu [right] |
635 |
'(menu-item "On the Right" menu-bar-scroll-bar-right |
'(menu-item "On the Right" |
636 |
|
(lambda () |
637 |
|
(interactive) |
638 |
|
(customize-set-variable 'scroll-bar-mode 'right)) |
639 |
:help "Scroll-bar on the right side" |
:help "Scroll-bar on the right side" |
640 |
:visible window-system |
:visible window-system |
641 |
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars (frame-parameters))) 'right)))) |
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars |
642 |
|
(frame-parameters))) 'right)))) |
643 |
|
|
644 |
(define-key menu-bar-showhide-scroll-bar-menu [left] |
(define-key menu-bar-showhide-scroll-bar-menu [left] |
645 |
'(menu-item "On the Left" menu-bar-scroll-bar-left |
'(menu-item "On the Left" |
646 |
|
(lambda () |
647 |
|
(interactive) |
648 |
|
(customize-set-variable 'scroll-bar-mode 'left)) |
649 |
:help "Scroll-bar on the left side" |
:help "Scroll-bar on the left side" |
650 |
:visible window-system |
:visible window-system |
651 |
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars (frame-parameters))) 'left)))) |
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars |
652 |
|
(frame-parameters))) 'left)))) |
653 |
|
|
654 |
(define-key menu-bar-showhide-scroll-bar-menu [none] |
(define-key menu-bar-showhide-scroll-bar-menu [none] |
655 |
'(menu-item "None" menu-bar-scroll-bar-none |
'(menu-item "None" |
656 |
|
(lambda () |
657 |
|
(interactive) |
658 |
|
(customize-set-variable 'scroll-bar-mode nil)) |
659 |
:help "Turn off scroll-bar" |
:help "Turn off scroll-bar" |
660 |
:visible window-system |
:visible window-system |
661 |
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars (frame-parameters))) nil)))) |
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars |
662 |
|
(frame-parameters))) nil)))) |
663 |
|
|
664 |
(define-key menu-bar-showhide-menu [showhide-scroll-bar] |
(define-key menu-bar-showhide-menu [showhide-scroll-bar] |
665 |
(list 'menu-item "Scroll-Bar" menu-bar-showhide-scroll-bar-menu |
(list 'menu-item "Scroll-Bar" menu-bar-showhide-scroll-bar-menu |
675 |
(message "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear."))) |
(message "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear."))) |
676 |
|
|
677 |
(define-key menu-bar-showhide-menu [showhide-menu-bar] |
(define-key menu-bar-showhide-menu [showhide-menu-bar] |
678 |
'(menu-item "Menu-bar" showhide-menu-bar |
'(menu-item "Menu-bar" |
679 |
|
(lambda () |
680 |
|
(interactive) |
681 |
|
(showhide-menu-bar) |
682 |
|
(customize-mark-as-set 'menu-bar-mode)) |
683 |
:help "Toggle menu-bar on/off" |
:help "Toggle menu-bar on/off" |
684 |
:button (:toggle . menu-bar-mode))) |
:button (:toggle . menu-bar-mode))) |
685 |
|
|
691 |
(message "Tool-bar mode disabled."))) |
(message "Tool-bar mode disabled."))) |
692 |
|
|
693 |
(define-key menu-bar-showhide-menu [showhide-tool-bar] |
(define-key menu-bar-showhide-menu [showhide-tool-bar] |
694 |
'(menu-item "Tool-bar" showhide-tool-bar |
'(menu-item "Tool-bar" |
695 |
|
(lambda () |
696 |
|
(interactive) |
697 |
|
(showhide-tool-bar) |
698 |
|
(customize-mark-as-set 'tool-bar-mode)) |
699 |
:help "Turn tool-bar on/off" |
:help "Turn tool-bar on/off" |
700 |
:visible window-system |
:visible window-system |
701 |
:button (:toggle . tool-bar-mode))) |
:button (:toggle . tool-bar-mode))) |
736 |
'("--")) |
'("--")) |
737 |
(define-key menu-bar-options-menu [toggle-auto-compression] |
(define-key menu-bar-options-menu [toggle-auto-compression] |
738 |
'(menu-item "Automatic File De/compression" |
'(menu-item "Automatic File De/compression" |
739 |
auto-compression-mode |
(lambda () |
740 |
:help "Transparently decompress compressed files" |
(interactive) |
741 |
:button (:toggle . (rassq 'jka-compr-handler |
(auto-compression-mode) |
742 |
file-name-handler-alist)))) |
(customize-mark-as-set 'auto-compression-mode)) |
743 |
|
:help "Transparently decompress compressed files" |
744 |
|
:button (:toggle . (rassq 'jka-compr-handler |
745 |
|
file-name-handler-alist)))) |
746 |
(define-key menu-bar-options-menu [save-place] |
(define-key menu-bar-options-menu [save-place] |
747 |
(menu-bar-make-toggle toggle-save-place-globally save-place |
(menu-bar-make-toggle toggle-save-place-globally save-place |
748 |
"Save Place in Files between Sessions" |
"Save Place in Files between Sessions" |
749 |
"Saving place in files %s" |
"Saving place in files %s" |
750 |
"Save Emacs state for next session" |
"Save Emacs state for next session")) |
751 |
(require 'saveplace) |
|
|
(setq-default save-place |
|
|
(not (default-value save-place))))) |
|
752 |
(define-key menu-bar-options-menu [uniquify] |
(define-key menu-bar-options-menu [uniquify] |
753 |
(menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style |
(menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style |
754 |
"Use Directory Names in Buffer Names" |
"Use Directory Names in Buffer Names" |
758 |
(setq uniquify-buffer-name-style |
(setq uniquify-buffer-name-style |
759 |
(if (not uniquify-buffer-name-style) |
(if (not uniquify-buffer-name-style) |
760 |
'forward)))) |
'forward)))) |
761 |
|
|
762 |
(define-key menu-bar-options-menu [edit-options-separator] |
(define-key menu-bar-options-menu [edit-options-separator] |
763 |
'("--")) |
'("--")) |
764 |
(define-key menu-bar-options-menu [case-fold-search] |
(define-key menu-bar-options-menu [case-fold-search] |
768 |
"Ignore letter-case in search")) |
"Ignore letter-case in search")) |
769 |
(define-key menu-bar-options-menu [auto-fill-mode] |
(define-key menu-bar-options-menu [auto-fill-mode] |
770 |
'(menu-item "Word Wrap in Text Modes (Auto Fill)" |
'(menu-item "Word Wrap in Text Modes (Auto Fill)" |
771 |
toggle-text-mode-auto-fill |
(lambda () |
772 |
|
(interactive) |
773 |
|
(toggle-text-mode-auto-fill) |
774 |
|
;; This is somewhat questionable, as `text-mode-hook' |
775 |
|
;; might have changed outside customize. |
776 |
|
;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11. |
777 |
|
(customize-mark-as-set 'text-mode-hook)) |
778 |
:help "Automatically fill text between left and right margins" |
:help "Automatically fill text between left and right margins" |
779 |
:button (:toggle . (member 'turn-on-auto-fill text-mode-hook)))) |
:button (:toggle . (member 'turn-on-auto-fill text-mode-hook)))) |
780 |
(define-key menu-bar-options-menu [truncate-lines] |
(define-key menu-bar-options-menu [truncate-lines] |
782 |
toggle-truncate-lines truncate-lines |
toggle-truncate-lines truncate-lines |
783 |
"Truncate Long Lines in this Buffer" "Long Line Truncation %s" |
"Truncate Long Lines in this Buffer" "Long Line Truncation %s" |
784 |
"Truncate long lines on the screen" |
"Truncate long lines on the screen" |
785 |
(prog1 (setq truncate-lines (not truncate-lines)) |
;; FIXME: We should define a :set method for `truncate-lines' to do |
786 |
|
;; the `buffer-modified-p' stuff. |
787 |
|
;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11. |
788 |
|
(prog1 (setq-default truncate-lines (not truncate-lines)) |
789 |
(set-buffer-modified-p (buffer-modified-p))))) |
(set-buffer-modified-p (buffer-modified-p))))) |
790 |
(define-key menu-bar-options-menu [highlight-separator] |
(define-key menu-bar-options-menu [highlight-separator] |
791 |
'("--")) |
'("--")) |
793 |
(menu-bar-make-toggle toggle-highlight-paren-mode show-paren-mode |
(menu-bar-make-toggle toggle-highlight-paren-mode show-paren-mode |
794 |
"Paren Match Highlighting (Show Paren mode)" |
"Paren Match Highlighting (Show Paren mode)" |
795 |
"Show Paren mode %s" |
"Show Paren mode %s" |
796 |
"Highlight matching/mismatched parentheses at cursor" |
"Highlight matching/mismatched parentheses at cursor")) |
|
(show-paren-mode))) |
|
797 |
(define-key menu-bar-options-menu [transient-mark-mode] |
(define-key menu-bar-options-menu [transient-mark-mode] |
798 |
(menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode |
(menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode |
799 |
"Active Region Highlighting (Transient Mark mode)" |
"Active Region Highlighting (Transient Mark mode)" |
803 |
(menu-bar-make-toggle toggle-global-lazy-font-lock-mode global-font-lock-mode |
(menu-bar-make-toggle toggle-global-lazy-font-lock-mode global-font-lock-mode |
804 |
"Syntax Highlighting (Global Font Lock mode)" |
"Syntax Highlighting (Global Font Lock mode)" |
805 |
"Global Font Lock mode %s" |
"Global Font Lock mode %s" |
806 |
"Colorize text based on language syntax" |
"Colorize text based on language syntax")) |
|
(global-font-lock-mode))) |
|
807 |
|
|
808 |
|
|
809 |
;; The "Tools" menu items |
;; The "Tools" menu items |
1436 |
:type 'boolean |
:type 'boolean |
1437 |
:group 'frames) |
:group 'frames) |
1438 |
|
|
1439 |
|
;;; `menu-bar-mode' doesn't really have a standard value, as it depend |
1440 |
|
;;; on where and how Emacs was started. By removing the standard |
1441 |
|
;;; value, we ensure that customize will always save it. |
1442 |
|
;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11. |
1443 |
|
(put 'menu-bar-mode 'standard-value nil) |
1444 |
|
|
1445 |
(defun menu-bar-mode (&optional flag) |
(defun menu-bar-mode (&optional flag) |
1446 |
"Toggle display of a menu bar on each frame. |
"Toggle display of a menu bar on each frame. |
1447 |
This command applies to all frames that exist and frames to be |
This command applies to all frames that exist and frames to be |