545 |
(defun menu-bar-options-save () |
(defun menu-bar-options-save () |
546 |
"Save current values of Options menu items using Custom." |
"Save current values of Options menu items using Custom." |
547 |
(interactive) |
(interactive) |
548 |
(dolist (elt '(debug-on-quit debug-on-error auto-compression-mode |
(let ((need-save nil)) |
549 |
case-fold-search truncate-lines show-paren-mode |
(dolist (elt '(debug-on-quit debug-on-error auto-compression-mode |
550 |
transient-mark-mode global-font-lock-mode |
case-fold-search truncate-lines show-paren-mode |
551 |
current-language-environment default-input-method |
transient-mark-mode global-font-lock-mode |
552 |
default-frame-alist display-time-mode)) |
current-language-environment default-input-method |
553 |
(if (default-value elt) |
default-frame-alist display-time-mode)) |
554 |
(customize-save-variable elt (default-value elt)))) |
(when (customize-mark-to-save elt) |
555 |
(if (memq 'turn-on-auto-fill text-mode-hook) |
(setq need-save t))) |
556 |
(customize-save-variable 'text-mode-hook |
;; We only want to save text-mode-hook after adding or removing auto fill. |
557 |
(default-value 'text-mode-hook))) |
(and (or (memq 'turn-on-auto-fill text-mode-hook) ;Added. |
558 |
(if (featurep 'saveplace) |
;; If it is already saved, it is safe to save. |
559 |
(customize-save-variable 'save-place (default-value 'save-place))) |
(get 'text-mode-hook 'saved-value)) ;Maybe removed. |
560 |
(if (featurep 'uniquify) |
(customize-mark-to-save 'text-mode-hook) |
561 |
(customize-save-variable 'uniquify-buffer-name-style |
(setq need-save t)) |
562 |
(default-value 'uniquify-buffer-name-style)))) |
;; Avoid loading extra libraries. |
563 |
|
(and (featurep 'saveplace) |
564 |
|
(customize-mark-to-save 'save-place) |
565 |
|
(setq need-save t)) |
566 |
|
(and(featurep 'uniquify) |
567 |
|
(customize-mark-to-save 'uniquify-buffer-name-style) |
568 |
|
(setq need-save t)) |
569 |
|
;; Save if we changed anything. |
570 |
|
(when need-save |
571 |
|
(custom-save-all)))) |
572 |
|
|
573 |
(define-key menu-bar-options-menu [save] |
(define-key menu-bar-options-menu [save] |
574 |
'(menu-item "Save Options" menu-bar-options-save |
'(menu-item "Save Options" menu-bar-options-save |