diff options
| author | Per Abrahamsen | 2002-02-11 16:47:55 +0000 |
|---|---|---|
| committer | Per Abrahamsen | 2002-02-11 16:47:55 +0000 |
| commit | 4f9b90604146129d6fa6095a810119d2776df09b (patch) | |
| tree | 303b51ff8cc2cca0a0e2099f2a691198e5762c74 | |
| parent | 89f8199fc86ab99581d7cf8894700af188824914 (diff) | |
| download | emacs-4f9b90604146129d6fa6095a810119d2776df09b.tar.gz emacs-4f9b90604146129d6fa6095a810119d2776df09b.zip | |
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
* toolbar/tool-bar.el (tool-bar-mode): Removed standard value.
* menu-bar.el (menu-bar-mode): Ditto.
* cus-edit.el (customize-mark-to-save): Always save variables
without a standard value.
* menu-bar.el (menu-bar-make-toggle): Made it aware of customize.
(menu-bar-options-save): Ditto.
(menu-bar-showhide-menu): Ditto.
(menu-bar-options-menu): Ditto.
(menu-bar-scroll-bar-right, menu-bar-scroll-bar-left,
menu-bar-scroll-bar-none): Removed.
(menu-bar-showhide-scroll-bar-menu): Use customize aware lambda
expressions instead.
* cus-edit.el (customize-set-value): Return value.
(customize-set-variable): Ditto.
(customize-save-variable): Ditto.
(customize-set-variable): Load dependencies before setting value.
(custom-load-symbol): Autoload it.
(customize-mark-as-set): New function.
| -rw-r--r-- | lisp/ChangeLog | 23 | ||||
| -rw-r--r-- | lisp/cus-edit.el | 57 | ||||
| -rw-r--r-- | lisp/menu-bar.el | 157 | ||||
| -rw-r--r-- | lisp/toolbar/tool-bar.el | 8 |
4 files changed, 172 insertions, 73 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f8ded26244b..3c7a17ff6de 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,26 @@ | |||
| 1 | 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk> | ||
| 2 | |||
| 3 | * toolbar/tool-bar.el (tool-bar-mode): Removed standard value. | ||
| 4 | * menu-bar.el (menu-bar-mode): Ditto. | ||
| 5 | * cus-edit.el (customize-mark-to-save): Always save variables | ||
| 6 | without a standard value. | ||
| 7 | |||
| 8 | * menu-bar.el (menu-bar-make-toggle): Made it aware of customize. | ||
| 9 | (menu-bar-options-save): Ditto. | ||
| 10 | (menu-bar-showhide-menu): Ditto. | ||
| 11 | (menu-bar-options-menu): Ditto. | ||
| 12 | (menu-bar-scroll-bar-right, menu-bar-scroll-bar-left, | ||
| 13 | menu-bar-scroll-bar-none): Removed. | ||
| 14 | (menu-bar-showhide-scroll-bar-menu): Use customize aware lambda | ||
| 15 | expressions instead. | ||
| 16 | |||
| 17 | * cus-edit.el (customize-set-value): Return value. | ||
| 18 | (customize-set-variable): Ditto. | ||
| 19 | (customize-save-variable): Ditto. | ||
| 20 | (customize-set-variable): Load dependencies before setting value. | ||
| 21 | (custom-load-symbol): Autoload it. | ||
| 22 | (customize-mark-as-set): New function. | ||
| 23 | |||
| 1 | 2002-02-11 Eli Zaretskii <eliz@is.elta.co.il> | 24 | 2002-02-11 Eli Zaretskii <eliz@is.elta.co.il> |
| 2 | 25 | ||
| 3 | * cus-start.el: Don't warn about "x-*" symbols when building a | 26 | * cus-start.el: Don't warn about "x-*" symbols when building a |
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index a5cb2071eb9..f624aa73adf 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el | |||
| @@ -748,7 +748,7 @@ it as the third element in the list." | |||
| 748 | 748 | ||
| 749 | ;;;###autoload | 749 | ;;;###autoload |
| 750 | (defun customize-set-value (var val &optional comment) | 750 | (defun customize-set-value (var val &optional comment) |
| 751 | "Set VARIABLE to VALUE. VALUE is a Lisp object. | 751 | "Set VARIABLE to VALUE, and return VALUE. VALUE is a Lisp object. |
| 752 | 752 | ||
| 753 | If VARIABLE has a `variable-interactive' property, that is used as if | 753 | If VARIABLE has a `variable-interactive' property, that is used as if |
| 754 | it were the arg to `interactive' (which see) to interactively read the value. | 754 | it were the arg to `interactive' (which see) to interactively read the value. |
| @@ -761,15 +761,16 @@ If given a prefix (or a COMMENT argument), also prompt for a comment." | |||
| 761 | "Set %s to value: " | 761 | "Set %s to value: " |
| 762 | current-prefix-arg)) | 762 | current-prefix-arg)) |
| 763 | 763 | ||
| 764 | (set var val) | ||
| 765 | (cond ((string= comment "") | 764 | (cond ((string= comment "") |
| 766 | (put var 'variable-comment nil)) | 765 | (put var 'variable-comment nil)) |
| 767 | (comment | 766 | (comment |
| 768 | (put var 'variable-comment comment)))) | 767 | (put var 'variable-comment comment))) |
| 768 | (set var val)) | ||
| 769 | 769 | ||
| 770 | ;;;###autoload | 770 | ;;;###autoload |
| 771 | (defun customize-set-variable (variable value &optional comment) | 771 | (defun customize-set-variable (variable value &optional comment) |
| 772 | "Set the default for VARIABLE to VALUE. VALUE is a Lisp object. | 772 | "Set the default for VARIABLE to VALUE, and return VALUE. |
| 773 | VALUE is a Lisp object. | ||
| 773 | 774 | ||
| 774 | If VARIABLE has a `custom-set' property, that is used for setting | 775 | If VARIABLE has a `custom-set' property, that is used for setting |
| 775 | VARIABLE, otherwise `set-default' is used. | 776 | VARIABLE, otherwise `set-default' is used. |
| @@ -787,6 +788,7 @@ If given a prefix (or a COMMENT argument), also prompt for a comment." | |||
| 787 | (interactive (custom-prompt-variable "Set variable: " | 788 | (interactive (custom-prompt-variable "Set variable: " |
| 788 | "Set customized value for %s to: " | 789 | "Set customized value for %s to: " |
| 789 | current-prefix-arg)) | 790 | current-prefix-arg)) |
| 791 | (custom-load-symbol variable) | ||
| 790 | (funcall (or (get variable 'custom-set) 'set-default) variable value) | 792 | (funcall (or (get variable 'custom-set) 'set-default) variable value) |
| 791 | (put variable 'customized-value (list (custom-quote value))) | 793 | (put variable 'customized-value (list (custom-quote value))) |
| 792 | (cond ((string= comment "") | 794 | (cond ((string= comment "") |
| @@ -794,11 +796,14 @@ If given a prefix (or a COMMENT argument), also prompt for a comment." | |||
| 794 | (put variable 'customized-variable-comment nil)) | 796 | (put variable 'customized-variable-comment nil)) |
| 795 | (comment | 797 | (comment |
| 796 | (put variable 'variable-comment comment) | 798 | (put variable 'variable-comment comment) |
| 797 | (put variable 'customized-variable-comment comment)))) | 799 | (put variable 'customized-variable-comment comment))) |
| 800 | value) | ||
| 798 | 801 | ||
| 799 | ;;;###autoload | 802 | ;;;###autoload |
| 800 | (defun customize-save-variable (var value &optional comment) | 803 | (defun customize-save-variable (var value &optional comment) |
| 801 | "Set the default for VARIABLE to VALUE, and save it for future sessions. | 804 | "Set the default for VARIABLE to VALUE, and save it for future sessions. |
| 805 | Return VALUE. | ||
| 806 | |||
| 802 | If VARIABLE has a `custom-set' property, that is used for setting | 807 | If VARIABLE has a `custom-set' property, that is used for setting |
| 803 | VARIABLE, otherwise `set-default' is used. | 808 | VARIABLE, otherwise `set-default' is used. |
| 804 | 809 | ||
| @@ -823,7 +828,8 @@ If given a prefix (or a COMMENT argument), also prompt for a comment." | |||
| 823 | (comment | 828 | (comment |
| 824 | (put var 'variable-comment comment) | 829 | (put var 'variable-comment comment) |
| 825 | (put var 'saved-variable-comment comment))) | 830 | (put var 'saved-variable-comment comment))) |
| 826 | (custom-save-all)) | 831 | (custom-save-all) |
| 832 | value) | ||
| 827 | 833 | ||
| 828 | ;;;###autoload | 834 | ;;;###autoload |
| 829 | (defun customize () | 835 | (defun customize () |
| @@ -1815,6 +1821,7 @@ and `face'." | |||
| 1815 | (defvar custom-load-recursion nil | 1821 | (defvar custom-load-recursion nil |
| 1816 | "Hack to avoid recursive dependencies.") | 1822 | "Hack to avoid recursive dependencies.") |
| 1817 | 1823 | ||
| 1824 | ;;;###autoload | ||
| 1818 | (defun custom-load-symbol (symbol) | 1825 | (defun custom-load-symbol (symbol) |
| 1819 | "Load all dependencies for SYMBOL." | 1826 | "Load all dependencies for SYMBOL." |
| 1820 | (unless custom-load-recursion | 1827 | (unless custom-load-recursion |
| @@ -3750,22 +3757,22 @@ or (if there were none) at the end of the buffer." | |||
| 3750 | "Mark SYMBOL for later saving. | 3757 | "Mark SYMBOL for later saving. |
| 3751 | 3758 | ||
| 3752 | If the default value of SYMBOL is different from the standard value, | 3759 | If the default value of SYMBOL is different from the standard value, |
| 3753 | set the 'saved-value' property to a list whose car evaluates to the | 3760 | set the `saved-value' property to a list whose car evaluates to the |
| 3754 | default value. Otherwise, set it til nil. | 3761 | default value. Otherwise, set it til nil. |
| 3755 | 3762 | ||
| 3756 | To actually save the value, call 'custom-save-all'. | 3763 | To actually save the value, call `custom-save-all'. |
| 3757 | 3764 | ||
| 3758 | Return non-nil iff the 'saved-value' property actually changed." | 3765 | Return non-nil iff the `saved-value' property actually changed." |
| 3759 | (let* ((get (or (get symbol 'custom-get) 'default-value)) | 3766 | (let* ((get (or (get symbol 'custom-get) 'default-value)) |
| 3760 | (value (funcall get symbol)) | 3767 | (value (funcall get symbol)) |
| 3761 | (saved (get symbol 'saved-value)) | 3768 | (saved (get symbol 'saved-value)) |
| 3762 | (standard (get symbol 'standard-value)) | 3769 | (standard (get symbol 'standard-value)) |
| 3763 | (comment (get symbol 'customized-variable-comment))) | 3770 | (comment (get symbol 'customized-variable-comment))) |
| 3764 | ;; Save default value iff different from standard value. | 3771 | ;; Save default value iff different from standard value. |
| 3765 | (if (and standard | 3772 | (if (or (null standard) |
| 3766 | (not (condition-case nil | 3773 | (not (equal value (condition-case nil |
| 3767 | (equal value (eval (car standard))) | 3774 | (eval (car standard)) |
| 3768 | (error nil)))) | 3775 | (error nil))))) |
| 3769 | (put symbol 'saved-value (list (custom-quote value))) | 3776 | (put symbol 'saved-value (list (custom-quote value))) |
| 3770 | (put symbol 'saved-value nil)) | 3777 | (put symbol 'saved-value nil)) |
| 3771 | ;; Clear customized information (set, but not saved). | 3778 | ;; Clear customized information (set, but not saved). |
| @@ -3775,6 +3782,30 @@ Return non-nil iff the 'saved-value' property actually changed." | |||
| 3775 | (put symbol 'saved-variable-comment comment)) | 3782 | (put symbol 'saved-variable-comment comment)) |
| 3776 | (not (equal saved (get symbol 'saved-value))))) | 3783 | (not (equal saved (get symbol 'saved-value))))) |
| 3777 | 3784 | ||
| 3785 | ;;;###autoload | ||
| 3786 | (defun customize-mark-as-set (symbol) | ||
| 3787 | "Mark current value of SYMBOL as being set from customize. | ||
| 3788 | |||
| 3789 | If the default value of SYMBOL is different from the saved value if any, | ||
| 3790 | or else if it is different from the standard value, set the | ||
| 3791 | `customized-value' property to a list whose car evaluates to the | ||
| 3792 | default value. Otherwise, set it til nil. | ||
| 3793 | |||
| 3794 | Return non-nil iff the `customized-value' property actually changed." | ||
| 3795 | (let* ((get (or (get symbol 'custom-get) 'default-value)) | ||
| 3796 | (value (funcall get symbol)) | ||
| 3797 | (customized (get symbol 'customized-value)) | ||
| 3798 | (old (or (get symbol 'saved-value) (get symbol 'standard-value)))) | ||
| 3799 | ;; Mark default value as set iff different from old value. | ||
| 3800 | (if (or (null old) | ||
| 3801 | (not (equal value (condition-case nil | ||
| 3802 | (eval (car old)) | ||
| 3803 | (error nil))))) | ||
| 3804 | (put symbol 'customized-value (list (custom-quote value))) | ||
| 3805 | (put symbol 'customized-value nil)) | ||
| 3806 | ;; Changed? | ||
| 3807 | (not (equal customized (get symbol 'customized-value))))) | ||
| 3808 | |||
| 3778 | ;;; The Customize Menu. | 3809 | ;;; The Customize Menu. |
| 3779 | 3810 | ||
| 3780 | ;;; Menu support | 3811 | ;;; Menu support |
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 77f32f3d5e4..4c8c2a5c2eb 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -530,12 +530,28 @@ Do the same for the keys of the same name." | |||
| 530 | (substring help 1) ".") | 530 | (substring help 1) ".") |
| 531 | (interactive) | 531 | (interactive) |
| 532 | (if ,(if body `(progn . ,body) | 532 | (if ,(if body `(progn . ,body) |
| 533 | `(setq ,variable (not ,variable))) | 533 | `(progn |
| 534 | (message ,message "enabled") | 534 | (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") | ||
| 535 | (message ,message "disabled"))) | 539 | (message ,message "disabled"))) |
| 536 | '(menu-item ,doc ,name | 540 | ;; 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)) | ||
| 537 | :help ,help | 552 | :help ,help |
| 538 | :button (:toggle . (and (boundp ',variable) ,variable))))) | 553 | :button (:toggle . (and (default-boundp ',variable) |
| 554 | (default-value ',variable)))))) | ||
| 539 | 555 | ||
| 540 | ;;; Assemble all the top-level items of the "Options" menu | 556 | ;;; Assemble all the top-level items of the "Options" menu |
| 541 | (define-key menu-bar-options-menu [customize] | 557 | (define-key menu-bar-options-menu [customize] |
| @@ -546,27 +562,27 @@ Do the same for the keys of the same name." | |||
| 546 | "Save current values of Options menu items using Custom." | 562 | "Save current values of Options menu items using Custom." |
| 547 | (interactive) | 563 | (interactive) |
| 548 | (let ((need-save nil)) | 564 | (let ((need-save nil)) |
| 549 | (dolist (elt '(debug-on-quit debug-on-error auto-compression-mode | 565 | ;; 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 | ||
| 550 | case-fold-search truncate-lines show-paren-mode | 569 | case-fold-search truncate-lines show-paren-mode |
| 551 | transient-mark-mode global-font-lock-mode | 570 | transient-mark-mode global-font-lock-mode |
| 552 | current-language-environment default-input-method | 571 | display-time-mode auto-compression-mode |
| 553 | default-frame-alist display-time-mode | 572 | ;; Saving `text-mode-hook' is somewhat questionable, |
| 554 | line-number-mode column-number-mode)) | 573 | ;; 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)) | ||
| 555 | (when (customize-mark-to-save elt) | 584 | (when (customize-mark-to-save elt) |
| 556 | (setq need-save t))) | 585 | (setq need-save t))) |
| 557 | ;; We only want to save text-mode-hook after adding or removing auto fill. | ||
| 558 | (and (or (memq 'turn-on-auto-fill text-mode-hook) ;Added. | ||
| 559 | ;; If it is already saved, it is safe to save. | ||
| 560 | (get 'text-mode-hook 'saved-value)) ;Maybe removed. | ||
| 561 | (customize-mark-to-save 'text-mode-hook) | ||
| 562 | (setq need-save t)) | ||
| 563 | ;; Avoid loading extra libraries. | ||
| 564 | (and (featurep 'saveplace) | ||
| 565 | (customize-mark-to-save 'save-place) | ||
| 566 | (setq need-save t)) | ||
| 567 | (and (featurep 'uniquify) | ||
| 568 | (customize-mark-to-save 'uniquify-buffer-name-style) | ||
| 569 | (setq need-save t)) | ||
| 570 | ;; Save if we changed anything. | 586 | ;; Save if we changed anything. |
| 571 | (when need-save | 587 | (when need-save |
| 572 | (custom-save-all)))) | 588 | (custom-save-all)))) |
| @@ -603,7 +619,10 @@ Do the same for the keys of the same name." | |||
| 603 | (message "Display-time mode disabled."))) | 619 | (message "Display-time mode disabled."))) |
| 604 | 620 | ||
| 605 | (define-key menu-bar-showhide-menu [showhide-date-time] | 621 | (define-key menu-bar-showhide-menu [showhide-date-time] |
| 606 | '(menu-item "Date and time" showhide-date-time | 622 | '(menu-item "Date and time" (lambda () |
| 623 | (interactive) | ||
| 624 | (showhide-date-time) | ||
| 625 | (customize-mark-as-set 'display-time-mode)) | ||
| 607 | :help "Display date and time in the mode-line" | 626 | :help "Display date and time in the mode-line" |
| 608 | :button (:toggle . display-time-mode))) | 627 | :button (:toggle . display-time-mode))) |
| 609 | 628 | ||
| @@ -612,38 +631,35 @@ Do the same for the keys of the same name." | |||
| 612 | 631 | ||
| 613 | (defvar menu-bar-showhide-scroll-bar-menu (make-sparse-keymap "Scroll-bar")) | 632 | (defvar menu-bar-showhide-scroll-bar-menu (make-sparse-keymap "Scroll-bar")) |
| 614 | 633 | ||
| 615 | (defun menu-bar-scroll-bar-right () | ||
| 616 | "Turn on the scroll-bar on the right side." | ||
| 617 | (interactive) | ||
| 618 | (set-scroll-bar-mode 'right)) | ||
| 619 | |||
| 620 | (defun menu-bar-scroll-bar-left () | ||
| 621 | "Turn on the scroll-bar on the left side." | ||
| 622 | (interactive) | ||
| 623 | (set-scroll-bar-mode 'left)) | ||
| 624 | |||
| 625 | (defun menu-bar-scroll-bar-none () | ||
| 626 | "Turn off the scroll-bar." | ||
| 627 | (interactive) | ||
| 628 | (set-scroll-bar-mode nil)) | ||
| 629 | |||
| 630 | (define-key menu-bar-showhide-scroll-bar-menu [right] | 634 | (define-key menu-bar-showhide-scroll-bar-menu [right] |
| 631 | '(menu-item "On the Right" menu-bar-scroll-bar-right | 635 | '(menu-item "On the Right" |
| 636 | (lambda () | ||
| 637 | (interactive) | ||
| 638 | (customize-set-variable 'scroll-bar-mode 'right)) | ||
| 632 | :help "Scroll-bar on the right side" | 639 | :help "Scroll-bar on the right side" |
| 633 | :visible window-system | 640 | :visible window-system |
| 634 | :button (:radio . (eq (cdr (assq 'vertical-scroll-bars (frame-parameters))) 'right)))) | 641 | :button (:radio . (eq (cdr (assq 'vertical-scroll-bars |
| 642 | (frame-parameters))) 'right)))) | ||
| 635 | 643 | ||
| 636 | (define-key menu-bar-showhide-scroll-bar-menu [left] | 644 | (define-key menu-bar-showhide-scroll-bar-menu [left] |
| 637 | '(menu-item "On the Left" menu-bar-scroll-bar-left | 645 | '(menu-item "On the Left" |
| 646 | (lambda () | ||
| 647 | (interactive) | ||
| 648 | (customize-set-variable 'scroll-bar-mode 'left)) | ||
| 638 | :help "Scroll-bar on the left side" | 649 | :help "Scroll-bar on the left side" |
| 639 | :visible window-system | 650 | :visible window-system |
| 640 | :button (:radio . (eq (cdr (assq 'vertical-scroll-bars (frame-parameters))) 'left)))) | 651 | :button (:radio . (eq (cdr (assq 'vertical-scroll-bars |
| 652 | (frame-parameters))) 'left)))) | ||
| 641 | 653 | ||
| 642 | (define-key menu-bar-showhide-scroll-bar-menu [none] | 654 | (define-key menu-bar-showhide-scroll-bar-menu [none] |
| 643 | '(menu-item "None" menu-bar-scroll-bar-none | 655 | '(menu-item "None" |
| 656 | (lambda () | ||
| 657 | (interactive) | ||
| 658 | (customize-set-variable 'scroll-bar-mode nil)) | ||
| 644 | :help "Turn off scroll-bar" | 659 | :help "Turn off scroll-bar" |
| 645 | :visible window-system | 660 | :visible window-system |
| 646 | :button (:radio . (eq (cdr (assq 'vertical-scroll-bars (frame-parameters))) nil)))) | 661 | :button (:radio . (eq (cdr (assq 'vertical-scroll-bars |
| 662 | (frame-parameters))) nil)))) | ||
| 647 | 663 | ||
| 648 | (define-key menu-bar-showhide-menu [showhide-scroll-bar] | 664 | (define-key menu-bar-showhide-menu [showhide-scroll-bar] |
| 649 | (list 'menu-item "Scroll-Bar" menu-bar-showhide-scroll-bar-menu | 665 | (list 'menu-item "Scroll-Bar" menu-bar-showhide-scroll-bar-menu |
| @@ -659,7 +675,11 @@ Do the same for the keys of the same name." | |||
| 659 | (message "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear."))) | 675 | (message "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear."))) |
| 660 | 676 | ||
| 661 | (define-key menu-bar-showhide-menu [showhide-menu-bar] | 677 | (define-key menu-bar-showhide-menu [showhide-menu-bar] |
| 662 | '(menu-item "Menu-bar" showhide-menu-bar | 678 | '(menu-item "Menu-bar" |
| 679 | (lambda () | ||
| 680 | (interactive) | ||
| 681 | (showhide-menu-bar) | ||
| 682 | (customize-mark-as-set 'menu-bar-mode)) | ||
| 663 | :help "Toggle menu-bar on/off" | 683 | :help "Toggle menu-bar on/off" |
| 664 | :button (:toggle . menu-bar-mode))) | 684 | :button (:toggle . menu-bar-mode))) |
| 665 | 685 | ||
| @@ -671,7 +691,11 @@ Do the same for the keys of the same name." | |||
| 671 | (message "Tool-bar mode disabled."))) | 691 | (message "Tool-bar mode disabled."))) |
| 672 | 692 | ||
| 673 | (define-key menu-bar-showhide-menu [showhide-tool-bar] | 693 | (define-key menu-bar-showhide-menu [showhide-tool-bar] |
| 674 | '(menu-item "Tool-bar" showhide-tool-bar | 694 | '(menu-item "Tool-bar" |
| 695 | (lambda () | ||
| 696 | (interactive) | ||
| 697 | (showhide-tool-bar) | ||
| 698 | (customize-mark-as-set 'tool-bar-mode)) | ||
| 675 | :help "Turn tool-bar on/off" | 699 | :help "Turn tool-bar on/off" |
| 676 | :visible window-system | 700 | :visible window-system |
| 677 | :button (:toggle . tool-bar-mode))) | 701 | :button (:toggle . tool-bar-mode))) |
| @@ -712,18 +736,19 @@ Do the same for the keys of the same name." | |||
| 712 | '("--")) | 736 | '("--")) |
| 713 | (define-key menu-bar-options-menu [toggle-auto-compression] | 737 | (define-key menu-bar-options-menu [toggle-auto-compression] |
| 714 | '(menu-item "Automatic File De/compression" | 738 | '(menu-item "Automatic File De/compression" |
| 715 | auto-compression-mode | 739 | (lambda () |
| 716 | :help "Transparently decompress compressed files" | 740 | (interactive) |
| 717 | :button (:toggle . (rassq 'jka-compr-handler | 741 | (auto-compression-mode) |
| 718 | file-name-handler-alist)))) | 742 | (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)))) | ||
| 719 | (define-key menu-bar-options-menu [save-place] | 746 | (define-key menu-bar-options-menu [save-place] |
| 720 | (menu-bar-make-toggle toggle-save-place-globally save-place | 747 | (menu-bar-make-toggle toggle-save-place-globally save-place |
| 721 | "Save Place in Files between Sessions" | 748 | "Save Place in Files between Sessions" |
| 722 | "Saving place in files %s" | 749 | "Saving place in files %s" |
| 723 | "Save Emacs state for next session" | 750 | "Save Emacs state for next session")) |
| 724 | (require 'saveplace) | 751 | |
| 725 | (setq-default save-place | ||
| 726 | (not (default-value save-place))))) | ||
| 727 | (define-key menu-bar-options-menu [uniquify] | 752 | (define-key menu-bar-options-menu [uniquify] |
| 728 | (menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style | 753 | (menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style |
| 729 | "Use Directory Names in Buffer Names" | 754 | "Use Directory Names in Buffer Names" |
| @@ -733,6 +758,7 @@ Do the same for the keys of the same name." | |||
| 733 | (setq uniquify-buffer-name-style | 758 | (setq uniquify-buffer-name-style |
| 734 | (if (not uniquify-buffer-name-style) | 759 | (if (not uniquify-buffer-name-style) |
| 735 | 'forward)))) | 760 | 'forward)))) |
| 761 | |||
| 736 | (define-key menu-bar-options-menu [edit-options-separator] | 762 | (define-key menu-bar-options-menu [edit-options-separator] |
| 737 | '("--")) | 763 | '("--")) |
| 738 | (define-key menu-bar-options-menu [case-fold-search] | 764 | (define-key menu-bar-options-menu [case-fold-search] |
| @@ -742,7 +768,13 @@ Do the same for the keys of the same name." | |||
| 742 | "Ignore letter-case in search")) | 768 | "Ignore letter-case in search")) |
| 743 | (define-key menu-bar-options-menu [auto-fill-mode] | 769 | (define-key menu-bar-options-menu [auto-fill-mode] |
| 744 | '(menu-item "Word Wrap in Text Modes (Auto Fill)" | 770 | '(menu-item "Word Wrap in Text Modes (Auto Fill)" |
| 745 | toggle-text-mode-auto-fill | 771 | (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)) | ||
| 746 | :help "Automatically fill text between left and right margins" | 778 | :help "Automatically fill text between left and right margins" |
| 747 | :button (:toggle . (member 'turn-on-auto-fill text-mode-hook)))) | 779 | :button (:toggle . (member 'turn-on-auto-fill text-mode-hook)))) |
| 748 | (define-key menu-bar-options-menu [truncate-lines] | 780 | (define-key menu-bar-options-menu [truncate-lines] |
| @@ -750,7 +782,10 @@ Do the same for the keys of the same name." | |||
| 750 | toggle-truncate-lines truncate-lines | 782 | toggle-truncate-lines truncate-lines |
| 751 | "Truncate Long Lines in this Buffer" "Long Line Truncation %s" | 783 | "Truncate Long Lines in this Buffer" "Long Line Truncation %s" |
| 752 | "Truncate long lines on the screen" | 784 | "Truncate long lines on the screen" |
| 753 | (prog1 (setq truncate-lines (not truncate-lines)) | 785 | ;; 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)) | ||
| 754 | (set-buffer-modified-p (buffer-modified-p))))) | 789 | (set-buffer-modified-p (buffer-modified-p))))) |
| 755 | (define-key menu-bar-options-menu [highlight-separator] | 790 | (define-key menu-bar-options-menu [highlight-separator] |
| 756 | '("--")) | 791 | '("--")) |
| @@ -758,8 +793,7 @@ Do the same for the keys of the same name." | |||
| 758 | (menu-bar-make-toggle toggle-highlight-paren-mode show-paren-mode | 793 | (menu-bar-make-toggle toggle-highlight-paren-mode show-paren-mode |
| 759 | "Paren Match Highlighting (Show Paren mode)" | 794 | "Paren Match Highlighting (Show Paren mode)" |
| 760 | "Show Paren mode %s" | 795 | "Show Paren mode %s" |
| 761 | "Highlight matching/mismatched parentheses at cursor" | 796 | "Highlight matching/mismatched parentheses at cursor")) |
| 762 | (show-paren-mode))) | ||
| 763 | (define-key menu-bar-options-menu [transient-mark-mode] | 797 | (define-key menu-bar-options-menu [transient-mark-mode] |
| 764 | (menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode | 798 | (menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode |
| 765 | "Active Region Highlighting (Transient Mark mode)" | 799 | "Active Region Highlighting (Transient Mark mode)" |
| @@ -769,8 +803,7 @@ Do the same for the keys of the same name." | |||
| 769 | (menu-bar-make-toggle toggle-global-lazy-font-lock-mode global-font-lock-mode | 803 | (menu-bar-make-toggle toggle-global-lazy-font-lock-mode global-font-lock-mode |
| 770 | "Syntax Highlighting (Global Font Lock mode)" | 804 | "Syntax Highlighting (Global Font Lock mode)" |
| 771 | "Global Font Lock mode %s" | 805 | "Global Font Lock mode %s" |
| 772 | "Colorize text based on language syntax" | 806 | "Colorize text based on language syntax")) |
| 773 | (global-font-lock-mode))) | ||
| 774 | 807 | ||
| 775 | 808 | ||
| 776 | ;; The "Tools" menu items | 809 | ;; The "Tools" menu items |
| @@ -1403,6 +1436,12 @@ use either \\[customize] or the function `menu-bar-mode'." | |||
| 1403 | :type 'boolean | 1436 | :type 'boolean |
| 1404 | :group 'frames) | 1437 | :group 'frames) |
| 1405 | 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 | |||
| 1406 | (defun menu-bar-mode (&optional flag) | 1445 | (defun menu-bar-mode (&optional flag) |
| 1407 | "Toggle display of a menu bar on each frame. | 1446 | "Toggle display of a menu bar on each frame. |
| 1408 | This command applies to all frames that exist and frames to be | 1447 | This command applies to all frames that exist and frames to be |
diff --git a/lisp/toolbar/tool-bar.el b/lisp/toolbar/tool-bar.el index c4e548ef7e7..3d2ded136f5 100644 --- a/lisp/toolbar/tool-bar.el +++ b/lisp/toolbar/tool-bar.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; tool-bar.el --- setting up the tool bar | 1 | ;;; tool-bar.el --- setting up the tool bar |
| 2 | ;; | 2 | ;; |
| 3 | ;; Copyright (C) 2000, 2001 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. |
| 4 | ;; | 4 | ;; |
| 5 | ;; Author: Dave Love <fx@gnu.org> | 5 | ;; Author: Dave Love <fx@gnu.org> |
| 6 | ;; Keywords: mouse frames | 6 | ;; Keywords: mouse frames |
| @@ -67,6 +67,12 @@ conveniently adding tool bar items." | |||
| 67 | (= 1 (length (default-value 'tool-bar-map)))) ; not yet setup | 67 | (= 1 (length (default-value 'tool-bar-map)))) ; not yet setup |
| 68 | (tool-bar-setup)))) | 68 | (tool-bar-setup)))) |
| 69 | 69 | ||
| 70 | ;;; `tool-bar-mode' doesn't really have a standard value, as it depend | ||
| 71 | ;;; on where and how Emacs was started. By removing the standard | ||
| 72 | ;;; value, we ensure that customize will always save it. | ||
| 73 | ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11. | ||
| 74 | (put 'tool-bar-mode 'standard-value nil) | ||
| 75 | |||
| 70 | (defvar tool-bar-map (make-sparse-keymap) | 76 | (defvar tool-bar-map (make-sparse-keymap) |
| 71 | "Keymap for the tool bar. | 77 | "Keymap for the tool bar. |
| 72 | Define this locally to override the global tool bar.") | 78 | Define this locally to override the global tool bar.") |