emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Re: Save Options vs. default-input-method


From: Per Abrahamsen
Subject: Re: [PATCH] Re: Save Options vs. default-input-method
Date: Mon, 11 Feb 2002 18:15:15 +0100
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.1 (i686-pc-linux-gnu)

Richard Stallman <address@hidden> writes:

>     The change I installed means that "Save Options" will save those
>     options whose default-value is different from their standard-value.
>     It does not care _why_ they are different.  But if they are different
>     because the user has an explicit "setq" in his .emacs, saving is a bad
>     idea.
>
> I see.
>
> It seems like a good idea--please go ahead.

Ok, I commited a patch below.  It makes all the non-mule options use
customize-set-variable or equivalent, and makes 'Save options' only
save those options modified by customize-set-variable or equivalent.

Some notes:

* The "Truncate Long Lines in This Buffer" option now set the default
  value, instead of the buffer specific value, which mean the name is
  misleading.  However, the old code attempted to save the value, and
  you can't save a buffer specific value.  So either the name should
  be changed, or we should not save the variable.  Opinions?

* The code no longer tries to save default-frame-alist.  Instead, it
  saves the more specific menu-bar-mode, tool-bar-mode and
  scroll-bar-mode.   

  However, 'menu-bar-mode' and 'tool-bar-mode' have
  the standard value nil, while in reality it they are usually enabled
  by default.  There are two obvious ways to solve this:

  - Fix the standard value.

  - Remove the standard value. 

  Removing the standard value mean you can no longer choose "Erase
  customization" from customize, but it ensures that the option is
  always saved.  Usually, options are only saved when different from
  their standard value.  This is usually sufficient, but not when the
  (real) standard value depend on how you start Emacs.

  I chose to remove the standard value to make it work, but there are
  many other options with a similar problem, and we should have a
  principal decision.  Maybe a combination of both, where we set the
  standard value to reflect reality, but also set a special flag that
  forces that value to be saved even when identical to the standard value?

* Most menu item are created with menu-bar-make-toggle.  This
  creates a toggle-foobar function for each foobar variable.  I
  decided to leave these alone, since they may conceivable be used in
  ".emacs" files, in which case the option should not be saved.  I
  created a new function customize-mark-as-set to mark the current
  default value as being set by customized after the fact.

* In general, I made the code obey the :get, :set and :require
  defcustom directives.


Index: lisp/ChangeLog
===================================================================
RCS file: /cvsroot/emacs//emacs/lisp/ChangeLog,v
retrieving revision 1.3433
diff -c -r1.3433 ChangeLog
*** lisp/ChangeLog      11 Feb 2002 07:07:25 -0000      1.3433
--- lisp/ChangeLog      11 Feb 2002 16:44:19 -0000
***************
*** 1,3 ****
--- 1,27 ----
+ 2002-02-11  Per Abrahamsen  <address@hidden>
+ 
+       * 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.
+ 
  2002-02-11  Eli Zaretskii  <address@hidden>
  
        * cus-start.el: Don't warn about "x-*" symbols when building a
Index: lisp/cus-edit.el
===================================================================
RCS file: /cvsroot/emacs//emacs/lisp/cus-edit.el,v
retrieving revision 1.143
diff -c -r1.143 cus-edit.el
*** lisp/cus-edit.el    7 Feb 2002 17:32:18 -0000       1.143
--- lisp/cus-edit.el    11 Feb 2002 16:44:19 -0000
***************
*** 748,754 ****
  
  ;;;###autoload
  (defun customize-set-value (var val &optional comment)
!   "Set VARIABLE to VALUE.  VALUE is a Lisp object.
  
  If VARIABLE has a `variable-interactive' property, that is used as if
  it were the arg to `interactive' (which see) to interactively read the value.
--- 748,754 ----
  
  ;;;###autoload
  (defun customize-set-value (var val &optional comment)
!   "Set VARIABLE to VALUE, and return VALUE.  VALUE is a Lisp object.
  
  If VARIABLE has a `variable-interactive' property, that is used as if
  it were the arg to `interactive' (which see) to interactively read the value.
***************
*** 761,775 ****
                                       "Set %s to value: "
                                       current-prefix-arg))
     
-   (set var val)
    (cond ((string= comment "")
         (put var 'variable-comment nil))
        (comment
!        (put var 'variable-comment comment))))
  
  ;;;###autoload
  (defun customize-set-variable (variable value &optional comment)
!   "Set the default for VARIABLE to VALUE.  VALUE is a Lisp object.
  
  If VARIABLE has a `custom-set' property, that is used for setting
  VARIABLE, otherwise `set-default' is used.
--- 761,776 ----
                                       "Set %s to value: "
                                       current-prefix-arg))
     
    (cond ((string= comment "")
         (put var 'variable-comment nil))
        (comment
!        (put var 'variable-comment comment)))
!   (set var val))
  
  ;;;###autoload
  (defun customize-set-variable (variable value &optional comment)
!   "Set the default for VARIABLE to VALUE, and return VALUE.
! VALUE is a Lisp object.
  
  If VARIABLE has a `custom-set' property, that is used for setting
  VARIABLE, otherwise `set-default' is used.
***************
*** 787,792 ****
--- 788,794 ----
    (interactive (custom-prompt-variable "Set variable: "
                                       "Set customized value for %s to: "
                                       current-prefix-arg))
+   (custom-load-symbol variable)
    (funcall (or (get variable 'custom-set) 'set-default) variable value)
    (put variable 'customized-value (list (custom-quote value)))
    (cond ((string= comment "")
***************
*** 794,804 ****
         (put variable 'customized-variable-comment nil))
        (comment
         (put variable 'variable-comment comment)
!        (put variable 'customized-variable-comment comment))))
  
  ;;;###autoload
  (defun customize-save-variable (var value &optional comment)
    "Set the default for VARIABLE to VALUE, and save it for future sessions.
  If VARIABLE has a `custom-set' property, that is used for setting
  VARIABLE, otherwise `set-default' is used.
  
--- 796,809 ----
         (put variable 'customized-variable-comment nil))
        (comment
         (put variable 'variable-comment comment)
!        (put variable 'customized-variable-comment comment)))
!   value)
  
  ;;;###autoload
  (defun customize-save-variable (var value &optional comment)
    "Set the default for VARIABLE to VALUE, and save it for future sessions.
+ Return VALUE.
+ 
  If VARIABLE has a `custom-set' property, that is used for setting
  VARIABLE, otherwise `set-default' is used.
  
***************
*** 823,829 ****
        (comment
         (put var 'variable-comment comment)
         (put var 'saved-variable-comment comment)))
!   (custom-save-all))
  
  ;;;###autoload
  (defun customize ()
--- 828,835 ----
        (comment
         (put var 'variable-comment comment)
         (put var 'saved-variable-comment comment)))
!   (custom-save-all)
!   value)
  
  ;;;###autoload
  (defun customize ()
***************
*** 1815,1820 ****
--- 1821,1827 ----
  (defvar custom-load-recursion nil
    "Hack to avoid recursive dependencies.")
  
+ ;;;###autoload
  (defun custom-load-symbol (symbol)
    "Load all dependencies for SYMBOL."
    (unless custom-load-recursion
***************
*** 3750,3771 ****
    "Mark SYMBOL for later saving.
  
  If the default value of SYMBOL is different from the standard value, 
! set the 'saved-value' property to a list whose car evaluates to the
  default value. Otherwise, set it til nil.
  
! To actually save the value, call 'custom-save-all'.
  
! Return non-nil iff the 'saved-value' property actually changed."
    (let* ((get (or (get symbol 'custom-get) 'default-value))
         (value (funcall get symbol))
         (saved (get symbol 'saved-value))
         (standard (get symbol 'standard-value))
         (comment (get symbol 'customized-variable-comment)))
      ;; Save default value iff different from standard value.
!     (if (and standard 
!            (not (condition-case nil
!                     (equal value (eval (car standard)))
!                   (error nil))))
        (put symbol 'saved-value (list (custom-quote value)))
        (put symbol 'saved-value nil))
      ;; Clear customized information (set, but not saved).
--- 3757,3778 ----
    "Mark SYMBOL for later saving.
  
  If the default value of SYMBOL is different from the standard value, 
! set the `saved-value' property to a list whose car evaluates to the
  default value. Otherwise, set it til nil.
  
! To actually save the value, call `custom-save-all'.
  
! Return non-nil iff the `saved-value' property actually changed."
    (let* ((get (or (get symbol 'custom-get) 'default-value))
         (value (funcall get symbol))
         (saved (get symbol 'saved-value))
         (standard (get symbol 'standard-value))
         (comment (get symbol 'customized-variable-comment)))
      ;; Save default value iff different from standard value.
!     (if (or (null standard)
!           (not (equal value (condition-case nil
!                                 (eval (car standard))
!                               (error nil)))))
        (put symbol 'saved-value (list (custom-quote value)))
        (put symbol 'saved-value nil))
      ;; Clear customized information (set, but not saved).
***************
*** 3774,3779 ****
--- 3781,3810 ----
      (when comment
        (put symbol 'saved-variable-comment comment))
      (not (equal saved (get symbol 'saved-value)))))
+ 
+ ;;;###autoload
+ (defun customize-mark-as-set (symbol)
+   "Mark current value of SYMBOL as being set from customize.
+ 
+ If the default value of SYMBOL is different from the saved value if any, 
+ or else if it is different from the standard value, set the
+ `customized-value' property to a list whose car evaluates to the 
+ default value. Otherwise, set it til nil.
+ 
+ Return non-nil iff the `customized-value' property actually changed."
+   (let* ((get (or (get symbol 'custom-get) 'default-value))
+        (value (funcall get symbol))
+        (customized (get symbol 'customized-value))
+        (old (or (get symbol 'saved-value) (get symbol 'standard-value))))
+     ;; Mark default value as set iff different from old value.
+     (if (or (null old)
+           (not (equal value (condition-case nil 
+                                 (eval (car old))
+                               (error nil)))))
+       (put symbol 'customized-value (list (custom-quote value)))
+       (put symbol 'customized-value nil))
+     ;; Changed?
+     (not (equal customized (get symbol 'customized-value)))))
  
  ;;; The Customize Menu.
  
Index: lisp/menu-bar.el
===================================================================
RCS file: /cvsroot/emacs//emacs/lisp/menu-bar.el,v
retrieving revision 1.197
diff -c -r1.197 menu-bar.el
*** lisp/menu-bar.el    10 Feb 2002 17:26:14 -0000      1.197
--- lisp/menu-bar.el    11 Feb 2002 16:44:20 -0000
***************
*** 530,541 ****
                (substring help 1) ".")
         (interactive)
         (if ,(if body `(progn . ,body)
!             `(setq ,variable (not ,variable)))
!          (message ,message "enabled")
         (message ,message "disabled")))
!      '(menu-item ,doc ,name
                 :help ,help
!                  :button (:toggle . (and (boundp ',variable) ,variable)))))
  
  ;;; Assemble all the top-level items of the "Options" menu
  (define-key menu-bar-options-menu [customize]
--- 530,557 ----
                (substring help 1) ".")
         (interactive)
         (if ,(if body `(progn . ,body)
!             `(progn 
!                (custom-load-symbol ',variable)
!                (let ((set (or (get ',variable 'custom-set) 'set-default))
!                      (get (or (get ',variable 'custom-get) 'default-value)))
!                  (funcall set ',variable (not (funcall get ',variable))))))
!          (message ,message "enabled")
         (message ,message "disabled")))
!      ;; The function `customize-mark-as-set' must only be called when
!      ;; a variable is set interactively, as the purpose is to mark it
!      ;; as a candidate for "Save Options", and we do not want to save
!      ;; options the user have already set explicitly in his init
!      ;; file.  Unfortunately, he could very likely call the function
!      ;; defined above there.  So we put `customize-mark-as-set' in a
!      ;; lambda expression. 
!      ;; -- Per Abrahamsen <address@hidden> 2002-02-11.
!      '(menu-item ,doc (lambda ()
!                       (interactive)
!                       (,name)
!                       (customize-mark-as-set ',variable))
                 :help ,help
!                  :button (:toggle . (and (default-boundp ',variable)
!                                        (default-value ',variable))))))
  
  ;;; Assemble all the top-level items of the "Options" menu
  (define-key menu-bar-options-menu [customize]
***************
*** 546,572 ****
    "Save current values of Options menu items using Custom."
    (interactive)
    (let ((need-save nil))
!     (dolist (elt '(debug-on-quit debug-on-error auto-compression-mode
                   case-fold-search truncate-lines show-paren-mode
                   transient-mark-mode global-font-lock-mode
!                  current-language-environment default-input-method
!                  default-frame-alist display-time-mode
!                  line-number-mode column-number-mode))
        (when (customize-mark-to-save elt)
        (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))
      ;; Save if we changed anything.
      (when need-save
        (custom-save-all))))
--- 562,588 ----
    "Save current values of Options menu items using Custom."
    (interactive)
    (let ((need-save nil))
!     ;; These are set with `customize-set-variable'.
!     (dolist (elt '(line-number-mode column-number-mode scroll-bar-mode
!                  debug-on-quit debug-on-error menu-bar-mode tool-bar-mode
!                  save-place uniquify-buffer-name-style
                   case-fold-search truncate-lines show-paren-mode
                   transient-mark-mode global-font-lock-mode
!                  display-time-mode auto-compression-mode
!                  ;; Saving `text-mode-hook' is somewhat questionable,
!                  ;; as we might get more than we bargain for, if
!                  ;; other code may has added hooks as well.
!                  ;; Nonetheless, not saving it would like be confuse
!                  ;; more often.
!                  ;; -- Per Abrahamsen <address@hidden> 2002-02-11.
!                  text-mode-hook))
!       (and (get elt 'customized-value)
!          (customize-mark-to-save elt)
!          (setq need-save t)))
!     ;; These are set with other functions.
!     (dolist (elt '(current-language-environment default-input-method))
        (when (customize-mark-to-save elt)
        (setq need-save t)))
      ;; Save if we changed anything.
      (when need-save
        (custom-save-all))))
***************
*** 603,609 ****
      (message "Display-time mode disabled.")))
  
  (define-key menu-bar-showhide-menu [showhide-date-time]
!   '(menu-item "Date and time" showhide-date-time
              :help "Display date and time in the mode-line"
              :button (:toggle . display-time-mode)))
  
--- 619,628 ----
      (message "Display-time mode disabled.")))
  
  (define-key menu-bar-showhide-menu [showhide-date-time]
!   '(menu-item "Date and time" (lambda ()
!                               (interactive)
!                               (showhide-date-time)
!                               (customize-mark-as-set 'display-time-mode))
              :help "Display date and time in the mode-line"
              :button (:toggle . display-time-mode)))
  
***************
*** 612,649 ****
  
  (defvar menu-bar-showhide-scroll-bar-menu (make-sparse-keymap "Scroll-bar"))
  
- (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))
- 
  (define-key menu-bar-showhide-scroll-bar-menu [right]
!   '(menu-item "On the Right" menu-bar-scroll-bar-right
              :help "Scroll-bar on the right side"
              :visible window-system
!             :button (:radio . (eq (cdr (assq 'vertical-scroll-bars 
(frame-parameters))) 'right))))
  
  (define-key menu-bar-showhide-scroll-bar-menu [left]
!   '(menu-item "On the Left" menu-bar-scroll-bar-left
              :help "Scroll-bar on the left side"
              :visible window-system
!             :button (:radio . (eq (cdr (assq 'vertical-scroll-bars 
(frame-parameters))) 'left))))
  
  (define-key menu-bar-showhide-scroll-bar-menu [none]
!   '(menu-item "None" menu-bar-scroll-bar-none
              :help "Turn off scroll-bar"
              :visible window-system
!             :button (:radio . (eq (cdr (assq 'vertical-scroll-bars 
(frame-parameters))) nil))))
  
  (define-key menu-bar-showhide-menu [showhide-scroll-bar]
    (list 'menu-item "Scroll-Bar" menu-bar-showhide-scroll-bar-menu
--- 631,665 ----
  
  (defvar menu-bar-showhide-scroll-bar-menu (make-sparse-keymap "Scroll-bar"))
  
  (define-key menu-bar-showhide-scroll-bar-menu [right]
!   '(menu-item "On the Right" 
!             (lambda ()
!               (interactive)
!               (customize-set-variable 'scroll-bar-mode 'right))
              :help "Scroll-bar on the right side"
              :visible window-system
!             :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
!                                              (frame-parameters))) 'right))))
  
  (define-key menu-bar-showhide-scroll-bar-menu [left]
!   '(menu-item "On the Left"      
!             (lambda ()
!               (interactive)
!               (customize-set-variable 'scroll-bar-mode 'left))
              :help "Scroll-bar on the left side"
              :visible window-system
!             :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
!                                              (frame-parameters))) 'left))))
  
  (define-key menu-bar-showhide-scroll-bar-menu [none]
!   '(menu-item "None" 
!             (lambda ()
!               (interactive)
!               (customize-set-variable 'scroll-bar-mode nil))
              :help "Turn off scroll-bar"
              :visible window-system
!             :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
!                                              (frame-parameters))) nil))))
  
  (define-key menu-bar-showhide-menu [showhide-scroll-bar]
    (list 'menu-item "Scroll-Bar" menu-bar-showhide-scroll-bar-menu
***************
*** 659,665 ****
      (message "Menu-bar mode disabled.  Use M-x menu-bar-mode to make the menu 
bar appear.")))
  
  (define-key menu-bar-showhide-menu [showhide-menu-bar]
!   '(menu-item "Menu-bar" showhide-menu-bar
              :help "Toggle menu-bar on/off"
              :button (:toggle . menu-bar-mode)))
  
--- 675,685 ----
      (message "Menu-bar mode disabled.  Use M-x menu-bar-mode to make the menu 
bar appear.")))
  
  (define-key menu-bar-showhide-menu [showhide-menu-bar]
!   '(menu-item "Menu-bar" 
!             (lambda ()
!               (interactive)
!               (showhide-menu-bar)
!               (customize-mark-as-set 'menu-bar-mode))
              :help "Toggle menu-bar on/off"
              :button (:toggle . menu-bar-mode)))
  
***************
*** 671,677 ****
      (message "Tool-bar mode disabled.")))
  
  (define-key menu-bar-showhide-menu [showhide-tool-bar]
!   '(menu-item "Tool-bar" showhide-tool-bar
              :help "Turn tool-bar on/off"
              :visible window-system
              :button (:toggle . tool-bar-mode)))
--- 691,701 ----
      (message "Tool-bar mode disabled.")))
  
  (define-key menu-bar-showhide-menu [showhide-tool-bar]
!   '(menu-item "Tool-bar" 
!             (lambda ()
!               (interactive)
!               (showhide-tool-bar)
!               (customize-mark-as-set 'tool-bar-mode))
              :help "Turn tool-bar on/off"
              :visible window-system
              :button (:toggle . tool-bar-mode)))
***************
*** 712,729 ****
    '("--"))
  (define-key menu-bar-options-menu [toggle-auto-compression]
    '(menu-item "Automatic File De/compression"
!              auto-compression-mode
!            :help "Transparently decompress compressed files"
!              :button (:toggle . (rassq 'jka-compr-handler
!                                      file-name-handler-alist))))
  (define-key menu-bar-options-menu [save-place]
    (menu-bar-make-toggle toggle-save-place-globally save-place
                        "Save Place in Files between Sessions"
                        "Saving place in files %s"
!                       "Save Emacs state for next session"
!                         (require 'saveplace)
!                       (setq-default save-place
!                                     (not (default-value save-place)))))
  (define-key menu-bar-options-menu [uniquify]
    (menu-bar-make-toggle toggle-uniquify-buffer-names 
uniquify-buffer-name-style
                        "Use Directory Names in Buffer Names"
--- 736,754 ----
    '("--"))
  (define-key menu-bar-options-menu [toggle-auto-compression]
    '(menu-item "Automatic File De/compression"
!             (lambda ()
!               (interactive)
!               (auto-compression-mode)
!               (customize-mark-as-set 'auto-compression-mode))
!             :help "Transparently decompress compressed files"
!             :button (:toggle . (rassq 'jka-compr-handler
!                                       file-name-handler-alist))))
  (define-key menu-bar-options-menu [save-place]
    (menu-bar-make-toggle toggle-save-place-globally save-place
                        "Save Place in Files between Sessions"
                        "Saving place in files %s"
!                       "Save Emacs state for next session"))
! 
  (define-key menu-bar-options-menu [uniquify]
    (menu-bar-make-toggle toggle-uniquify-buffer-names 
uniquify-buffer-name-style
                        "Use Directory Names in Buffer Names"
***************
*** 733,738 ****
--- 758,764 ----
                        (setq uniquify-buffer-name-style
                              (if (not uniquify-buffer-name-style)
                                  'forward))))
+ 
  (define-key menu-bar-options-menu [edit-options-separator]
    '("--"))
  (define-key menu-bar-options-menu [case-fold-search]
***************
*** 742,748 ****
                        "Ignore letter-case in search"))
  (define-key menu-bar-options-menu [auto-fill-mode]
    '(menu-item "Word Wrap in Text Modes (Auto Fill)"
!               toggle-text-mode-auto-fill
              :help "Automatically fill text between left and right margins"
                :button (:toggle . (member 'turn-on-auto-fill text-mode-hook))))
  (define-key menu-bar-options-menu [truncate-lines]
--- 768,780 ----
                        "Ignore letter-case in search"))
  (define-key menu-bar-options-menu [auto-fill-mode]
    '(menu-item "Word Wrap in Text Modes (Auto Fill)"
!               (lambda ()
!               (interactive)
!               (toggle-text-mode-auto-fill)
!               ;; This is somewhat questionable, as `text-mode-hook'
!               ;; might have changed outside customize.  
!               ;; -- Per Abrahamsen <address@hidden> 2002-02-11.
!               (customize-mark-as-set 'text-mode-hook))
              :help "Automatically fill text between left and right margins"
                :button (:toggle . (member 'turn-on-auto-fill text-mode-hook))))
  (define-key menu-bar-options-menu [truncate-lines]
***************
*** 750,756 ****
     toggle-truncate-lines truncate-lines
     "Truncate Long Lines in this Buffer" "Long Line Truncation %s"
     "Truncate long lines on the screen"
!    (prog1 (setq truncate-lines (not truncate-lines))
       (set-buffer-modified-p (buffer-modified-p)))))
  (define-key menu-bar-options-menu [highlight-separator]
    '("--"))
--- 782,791 ----
     toggle-truncate-lines truncate-lines
     "Truncate Long Lines in this Buffer" "Long Line Truncation %s"
     "Truncate long lines on the screen"
!    ;; FIXME: We should define a :set method for `truncate-lines' to do
!    ;; the `buffer-modified-p' stuff.
!    ;; -- Per Abrahamsen <address@hidden> 2002-02-11.
!    (prog1 (setq-default truncate-lines (not truncate-lines))
       (set-buffer-modified-p (buffer-modified-p)))))
  (define-key menu-bar-options-menu [highlight-separator]
    '("--"))
***************
*** 758,765 ****
    (menu-bar-make-toggle toggle-highlight-paren-mode show-paren-mode
                        "Paren Match Highlighting (Show Paren mode)"
                        "Show Paren mode %s"
!                       "Highlight matching/mismatched parentheses at cursor"
!                       (show-paren-mode)))
  (define-key menu-bar-options-menu [transient-mark-mode]
    (menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode
                        "Active Region Highlighting (Transient Mark mode)"
--- 793,799 ----
    (menu-bar-make-toggle toggle-highlight-paren-mode show-paren-mode
                        "Paren Match Highlighting (Show Paren mode)"
                        "Show Paren mode %s"
!                       "Highlight matching/mismatched parentheses at cursor"))
  (define-key menu-bar-options-menu [transient-mark-mode]
    (menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode
                        "Active Region Highlighting (Transient Mark mode)"
***************
*** 769,776 ****
    (menu-bar-make-toggle toggle-global-lazy-font-lock-mode 
global-font-lock-mode
                        "Syntax Highlighting (Global Font Lock mode)"
                        "Global Font Lock mode %s"
!                       "Colorize text based on language syntax"
!                       (global-font-lock-mode)))
  
  
  ;; The "Tools" menu items
--- 803,809 ----
    (menu-bar-make-toggle toggle-global-lazy-font-lock-mode 
global-font-lock-mode
                        "Syntax Highlighting (Global Font Lock mode)"
                        "Global Font Lock mode %s"
!                       "Colorize text based on language syntax"))
  
  
  ;; The "Tools" menu items
***************
*** 1402,1407 ****
--- 1435,1446 ----
    :initialize 'custom-initialize-default
    :type 'boolean
    :group 'frames)
+ 
+ ;;; `menu-bar-mode' doesn't really have a standard value, as it depend
+ ;;; on where and how Emacs was started.  By removing the standard
+ ;;; value, we ensure that customize will always save it.
+ ;; -- Per Abrahamsen <address@hidden> 2002-02-11.
+ (put 'menu-bar-mode 'standard-value nil)
  
  (defun menu-bar-mode (&optional flag)
    "Toggle display of a menu bar on each frame.
Index: lisp/toolbar/tool-bar.el
===================================================================
RCS file: /cvsroot/emacs//emacs/lisp/toolbar/tool-bar.el,v
retrieving revision 1.23
diff -c -r1.23 tool-bar.el
*** lisp/toolbar/tool-bar.el    30 Aug 2001 06:50:59 -0000      1.23
--- lisp/toolbar/tool-bar.el    11 Feb 2002 16:44:20 -0000
***************
*** 1,6 ****
  ;;; tool-bar.el --- setting up the tool bar
  ;;
! ;; Copyright (C) 2000, 2001 Free Software Foundation, Inc.
  ;;
  ;; Author: Dave Love <address@hidden>
  ;; Keywords: mouse frames
--- 1,6 ----
  ;;; tool-bar.el --- setting up the tool bar
  ;;
! ;; Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
  ;;
  ;; Author: Dave Love <address@hidden>
  ;; Keywords: mouse frames
***************
*** 66,71 ****
--- 66,77 ----
                (display-graphic-p)
                (= 1 (length (default-value 'tool-bar-map)))) ; not yet setup
           (tool-bar-setup))))
+ 
+ ;;; `tool-bar-mode' doesn't really have a standard value, as it depend
+ ;;; on where and how Emacs was started.  By removing the standard
+ ;;; value, we ensure that customize will always save it.
+ ;; -- Per Abrahamsen <address@hidden> 2002-02-11.
+ (put 'tool-bar-mode 'standard-value nil)
  
  (defvar tool-bar-map (make-sparse-keymap)
    "Keymap for the tool bar.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]