comparison lisp/cus-edit.el @ 92307:55f83f57568d

(custom-mode-map, custom-mode-link-map): Rename `custom-mode' to `Custom-mode' in docstrings. (custom-buffer-create-internal, customize-browse): Rename `custom-mode' to `Custom-mode'. (custom-mode-hook): Rename to `Custom-mode-hook'. (Custom-mode-hook): Renamed from `custom-mode-hook'. (custom-mode): Rename to `Custom-mode'. (Custom-mode): Renamed from `custom-mode'. Doc fix. (custom-mode): Add backward-compatible non-interactive variant of `Custom-mode' that simply calls `Custom-mode'. Mark it obsoleted. (custom-mode-hook): Mark it as obsolete alias of `Custom-mode-hook'.
author Juri Linkov <juri@jurta.org>
date Thu, 28 Feb 2008 20:45:37 +0000
parents 299387a1f305
children 01ce588fc626
comparison
equal deleted inserted replaced
92306:fc2a30344c2d 92307:55f83f57568d
478 (define-key map "q" 'Custom-buffer-done) 478 (define-key map "q" 'Custom-buffer-done)
479 (define-key map "u" 'Custom-goto-parent) 479 (define-key map "u" 'Custom-goto-parent)
480 (define-key map "n" 'widget-forward) 480 (define-key map "n" 'widget-forward)
481 (define-key map "p" 'widget-backward) 481 (define-key map "p" 'widget-backward)
482 map) 482 map)
483 "Keymap for `custom-mode'.") 483 "Keymap for `Custom-mode'.")
484 484
485 (defvar custom-mode-link-map 485 (defvar custom-mode-link-map
486 (let ((map (make-keymap))) 486 (let ((map (make-keymap)))
487 (set-keymap-parent map custom-mode-map) 487 (set-keymap-parent map custom-mode-map)
488 (define-key map [down-mouse-2] nil) 488 (define-key map [down-mouse-2] nil)
489 (define-key map [down-mouse-1] 'mouse-drag-region) 489 (define-key map [down-mouse-1] 'mouse-drag-region)
490 (define-key map [mouse-2] 'widget-move-and-invoke) 490 (define-key map [mouse-2] 'widget-move-and-invoke)
491 map) 491 map)
492 "Local keymap for links in `custom-mode'.") 492 "Local keymap for links in `Custom-mode'.")
493 493
494 (defvar custom-field-keymap 494 (defvar custom-field-keymap
495 (let ((map (copy-keymap widget-field-keymap))) 495 (let ((map (copy-keymap widget-field-keymap)))
496 (define-key map "\C-c\C-c" 'Custom-set) 496 (define-key map "\C-c\C-c" 'Custom-set)
497 (define-key map "\C-x\C-s" 'Custom-save) 497 (define-key map "\C-x\C-s" 'Custom-save)
1576 (if value 1576 (if value
1577 'custom-button-pressed 1577 'custom-button-pressed
1578 'custom-button-pressed-unraised)))) 1578 'custom-button-pressed-unraised))))
1579 1579
1580 (defun custom-buffer-create-internal (options &optional description) 1580 (defun custom-buffer-create-internal (options &optional description)
1581 (custom-mode) 1581 (Custom-mode)
1582 (let ((init-file (or custom-file user-init-file))) 1582 (let ((init-file (or custom-file user-init-file)))
1583 ;; Insert verbose help at the top of the custom buffer. 1583 ;; Insert verbose help at the top of the custom buffer.
1584 (when custom-buffer-verbose-help 1584 (when custom-buffer-verbose-help
1585 (widget-insert "Editing a setting changes only the text in this buffer." 1585 (widget-insert "Editing a setting changes only the text in this buffer."
1586 (if init-file 1586 (if init-file
1682 (interactive) 1682 (interactive)
1683 (unless group 1683 (unless group
1684 (setq group 'emacs)) 1684 (setq group 'emacs))
1685 (let ((name "*Customize Browser*")) 1685 (let ((name "*Customize Browser*"))
1686 (pop-to-buffer (custom-get-fresh-buffer name))) 1686 (pop-to-buffer (custom-get-fresh-buffer name)))
1687 (custom-mode) 1687 (Custom-mode)
1688 (widget-insert (format "\ 1688 (widget-insert (format "\
1689 %s buttons; type RET or click mouse-1 1689 %s buttons; type RET or click mouse-1
1690 on a button to invoke its action. 1690 on a button to invoke its action.
1691 Invoke [+] to expand a group, and [-] to collapse an expanded group.\n" 1691 Invoke [+] to expand a group, and [-] to collapse an expanded group.\n"
1692 (if custom-raised-buttons 1692 (if custom-raised-buttons
4593 4593
4594 (defvar tool-bar-map) 4594 (defvar tool-bar-map)
4595 4595
4596 ;;; `custom-tool-bar-map' used to be set up here. This will fail to 4596 ;;; `custom-tool-bar-map' used to be set up here. This will fail to
4597 ;;; DTRT when `display-graphic-p' returns nil during compilation. Hence 4597 ;;; DTRT when `display-graphic-p' returns nil during compilation. Hence
4598 ;;; we set this up lazily in `custom-mode'. 4598 ;;; we set this up lazily in `Custom-mode'.
4599 (defvar custom-tool-bar-map nil 4599 (defvar custom-tool-bar-map nil
4600 "Keymap for toolbar in Custom mode.") 4600 "Keymap for toolbar in Custom mode.")
4601 4601
4602 ;;; The Custom Mode. 4602 ;;; The Custom Mode.
4603 4603
4623 (if (search-forward "\nParent groups: " nil t) 4623 (if (search-forward "\nParent groups: " nil t)
4624 (let* ((button (get-char-property (point) 'button)) 4624 (let* ((button (get-char-property (point) 'button))
4625 (parent (downcase (widget-get button :tag)))) 4625 (parent (downcase (widget-get button :tag))))
4626 (customize-group parent))))) 4626 (customize-group parent)))))
4627 4627
4628 (defcustom custom-mode-hook nil 4628 (defcustom Custom-mode-hook nil
4629 "Hook called when entering Custom mode." 4629 "Hook called when entering Custom mode."
4630 :type 'hook 4630 :type 'hook
4631 :group 'custom-buffer ) 4631 :group 'custom-buffer)
4632 4632
4633 (defun custom-state-buffer-message (widget) 4633 (defun custom-state-buffer-message (widget)
4634 (if (eq (widget-get (widget-get widget :parent) :custom-state) 'modified) 4634 (if (eq (widget-get (widget-get widget :parent) :custom-state) 'modified)
4635 (message "To install your edits, invoke [State] and choose the Set operation"))) 4635 (message "To install your edits, invoke [State] and choose the Set operation")))
4636 4636
4637 (define-derived-mode custom-mode nil "Custom" 4637 (define-derived-mode Custom-mode nil "Custom"
4638 "Major mode for editing customization buffers. 4638 "Major mode for editing customization buffers.
4639 4639
4640 The following commands are available: 4640 The following commands are available:
4641 4641
4642 \\<widget-keymap>\ 4642 \\<widget-keymap>\
4652 Make text match actual option values. \\[Custom-reset-current] 4652 Make text match actual option values. \\[Custom-reset-current]
4653 Reset options to permanent settings. \\[Custom-reset-saved] 4653 Reset options to permanent settings. \\[Custom-reset-saved]
4654 Erase customizations; set options 4654 Erase customizations; set options
4655 and buffer text to the standard values. \\[Custom-reset-standard] 4655 and buffer text to the standard values. \\[Custom-reset-standard]
4656 4656
4657 Entry to this mode calls the value of `custom-mode-hook' 4657 Entry to this mode calls the value of `Custom-mode-hook'
4658 if that value is non-nil." 4658 if that value is non-nil."
4659 (use-local-map custom-mode-map) 4659 (use-local-map custom-mode-map)
4660 (easy-menu-add Custom-mode-menu) 4660 (easy-menu-add Custom-mode-menu)
4661 (when (display-graphic-p) 4661 (when (display-graphic-p)
4662 (set (make-local-variable 'tool-bar-map) 4662 (set (make-local-variable 'tool-bar-map)
4693 (set (make-local-variable 'widget-push-button-suffix) "") 4693 (set (make-local-variable 'widget-push-button-suffix) "")
4694 (set (make-local-variable 'widget-link-prefix) "") 4694 (set (make-local-variable 'widget-link-prefix) "")
4695 (set (make-local-variable 'widget-link-suffix) "")) 4695 (set (make-local-variable 'widget-link-suffix) ""))
4696 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t)) 4696 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t))
4697 4697
4698 (put 'Custom-mode 'mode-class 'special)
4699
4700 ;; backward-compatibility
4701 (defun custom-mode ()
4702 "Non-interactive variant of `Custom-mode'."
4703 (Custom-mode))
4704 (make-obsolete 'custom-mode 'Custom-mode "23.0")
4698 (put 'custom-mode 'mode-class 'special) 4705 (put 'custom-mode 'mode-class 'special)
4706 (define-obsolete-variable-alias 'custom-mode-hook 'Custom-mode-hook "23.0")
4699 4707
4700 (dolist (regexp 4708 (dolist (regexp
4701 '("^No user option defaults have been changed since Emacs " 4709 '("^No user option defaults have been changed since Emacs "
4702 "^Invalid face:? " 4710 "^Invalid face:? "
4703 "^No \\(?:customized\\|rogue\\|saved\\) user options" 4711 "^No \\(?:customized\\|rogue\\|saved\\) user options"