comparison lisp/cus-edit.el @ 86334:005ad07af670

(custom-mode): Define with `define-derived-mode'. Set `show-trailing-whitespace' to nil.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 22 Nov 2007 16:49:47 +0000
parents 74f276f67957
children a4cfa0059507 53108e6cea98
comparison
equal deleted inserted replaced
86333:3360920fa85b 86334:005ad07af670
4502 4502
4503 (defun custom-state-buffer-message (widget) 4503 (defun custom-state-buffer-message (widget)
4504 (if (eq (widget-get (widget-get widget :parent) :custom-state) 'modified) 4504 (if (eq (widget-get (widget-get widget :parent) :custom-state) 'modified)
4505 (message "To install your edits, invoke [State] and choose the Set operation"))) 4505 (message "To install your edits, invoke [State] and choose the Set operation")))
4506 4506
4507 (defun custom-mode () 4507 (define-derived-mode custom-mode nil "Custom"
4508 "Major mode for editing customization buffers. 4508 "Major mode for editing customization buffers.
4509 4509
4510 The following commands are available: 4510 The following commands are available:
4511 4511
4512 \\<widget-keymap>\ 4512 \\<widget-keymap>\
4524 Erase customizations; set options 4524 Erase customizations; set options
4525 and buffer text to the standard values. \\[Custom-reset-standard] 4525 and buffer text to the standard values. \\[Custom-reset-standard]
4526 4526
4527 Entry to this mode calls the value of `custom-mode-hook' 4527 Entry to this mode calls the value of `custom-mode-hook'
4528 if that value is non-nil." 4528 if that value is non-nil."
4529 (kill-all-local-variables)
4530 (setq major-mode 'custom-mode
4531 mode-name "Custom")
4532 (use-local-map custom-mode-map) 4529 (use-local-map custom-mode-map)
4533 (easy-menu-add Custom-mode-menu) 4530 (easy-menu-add Custom-mode-menu)
4534 (set (make-local-variable 'tool-bar-map) custom-tool-bar-map) 4531 (set (make-local-variable 'tool-bar-map) custom-tool-bar-map)
4535 (make-local-variable 'custom-options) 4532 (make-local-variable 'custom-options)
4536 (make-local-variable 'custom-local-buffer) 4533 (make-local-variable 'custom-local-buffer)
4537 (make-local-variable 'widget-documentation-face) 4534 (make-local-variable 'widget-documentation-face)
4538 (setq widget-documentation-face 'custom-documentation) 4535 (setq widget-documentation-face 'custom-documentation)
4539 (make-local-variable 'widget-button-face) 4536 (make-local-variable 'widget-button-face)
4540 (setq widget-button-face custom-button) 4537 (setq widget-button-face custom-button)
4538 (setq show-trailing-whitespace nil)
4541 4539
4542 ;; We need this because of the "More" button on docstrings. 4540 ;; We need this because of the "More" button on docstrings.
4543 ;; Otherwise clicking on "More" can push point offscreen, which 4541 ;; Otherwise clicking on "More" can push point offscreen, which
4544 ;; causes the window to recenter on point, which pushes the 4542 ;; causes the window to recenter on point, which pushes the
4545 ;; newly-revealed docstring offscreen; which is annoying. -- cyd. 4543 ;; newly-revealed docstring offscreen; which is annoying. -- cyd.
4553 (when custom-raised-buttons 4551 (when custom-raised-buttons
4554 (set (make-local-variable 'widget-push-button-prefix) "") 4552 (set (make-local-variable 'widget-push-button-prefix) "")
4555 (set (make-local-variable 'widget-push-button-suffix) "") 4553 (set (make-local-variable 'widget-push-button-suffix) "")
4556 (set (make-local-variable 'widget-link-prefix) "") 4554 (set (make-local-variable 'widget-link-prefix) "")
4557 (set (make-local-variable 'widget-link-suffix) "")) 4555 (set (make-local-variable 'widget-link-suffix) ""))
4558 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t) 4556 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t))
4559 (run-mode-hooks 'custom-mode-hook))
4560 4557
4561 (put 'custom-mode 'mode-class 'special) 4558 (put 'custom-mode 'mode-class 'special)
4562 4559
4563 (dolist (regexp 4560 (dolist (regexp
4564 '("^No user option defaults have been changed since Emacs " 4561 '("^No user option defaults have been changed since Emacs "