comparison lisp/cus-edit.el @ 18370:74558272517b

(custom-group-value-create): Use group-visibility widget. (custom-add-parent-links): Don't insert anything if no parents. Return non-nil iff do have parents.
author Richard M. Stallman <rms@gnu.org>
date Sat, 21 Jun 1997 18:51:28 +0000
parents 14b3e7eb6a17
children a32f9b2c2e0c
comparison
equal deleted inserted replaced
18369:ffdf3d404802 18370:74558272517b
1526 (t 1526 (t
1527 (insert ", ")))) 1527 (insert ", "))))
1528 (widget-put widget :buttons buttons)))) 1528 (widget-put widget :buttons buttons))))
1529 1529
1530 (defun custom-add-parent-links (widget) 1530 (defun custom-add-parent-links (widget)
1531 "Add `Parent groups: ...' to WIDGET." 1531 "Add `Parent groups: ...' to WIDGET.
1532 The value if non-nil if there are parents."
1532 (let ((name (widget-value widget)) 1533 (let ((name (widget-value widget))
1533 (type (widget-type widget)) 1534 (type (widget-type widget))
1534 (buttons (widget-get widget :buttons)) 1535 (buttons (widget-get widget :buttons))
1536 (start (point))
1535 found) 1537 found)
1536 (insert "Parent groups:") 1538 (insert "Parent groups:")
1537 (mapatoms (lambda (symbol) 1539 (mapatoms (lambda (symbol)
1538 (let ((group (get symbol 'custom-group))) 1540 (let ((group (get symbol 'custom-group)))
1539 (when (assq name group) 1541 (when (assq name group)
1544 :tag (custom-unlispify-tag-name symbol) 1546 :tag (custom-unlispify-tag-name symbol)
1545 symbol) 1547 symbol)
1546 buttons) 1548 buttons)
1547 (setq found t)))))) 1549 (setq found t))))))
1548 (widget-put widget :buttons buttons) 1550 (widget-put widget :buttons buttons)
1549 (unless found 1551 (if found
1550 (insert " (none)")) 1552 (insert "\n")
1551 (insert "\n"))) 1553 (delete-region start (point)))
1554 found))
1552 1555
1553 ;;; The `custom-variable' Widget. 1556 ;;; The `custom-variable' Widget.
1554 1557
1555 (defface custom-variable-sample-face '((t (:underline t))) 1558 (defface custom-variable-sample-face '((t (:underline t)))
1556 "Face used for unpushable variable tags." 1559 "Face used for unpushable variable tags."
2504 (if (and (eq custom-buffer-style 'links) (> level 1)) 2507 (if (and (eq custom-buffer-style 'links) (> level 1))
2505 (widget-put widget :documentation-indent 0)) 2508 (widget-put widget :documentation-indent 0))
2506 (widget-default-format-handler widget ?h)) 2509 (widget-default-format-handler widget ?h))
2507 ;; Nested style. 2510 ;; Nested style.
2508 (t ;Visible. 2511 (t ;Visible.
2512 ;; Add parent groups references above the group.
2513 (if t ;;; This should test that the buffer
2514 ;;; was made to display a group.
2515 (when (eq level 1)
2516 (if (custom-add-parent-links widget)
2517 (insert "\n"))))
2509 ;; Create level indicator. 2518 ;; Create level indicator.
2510 (insert-char ?\ (* custom-buffer-indent (1- level))) 2519 (insert-char ?\ (* custom-buffer-indent (1- level)))
2511 (insert "/- ") 2520 (insert "/- ")
2512 ;; Create tag. 2521 ;; Create tag.
2513 (let ((start (point))) 2522 (let ((start (point)))
2539 (push magic buttons)) 2548 (push magic buttons))
2540 ;; Update buttons. 2549 ;; Update buttons.
2541 (widget-put widget :buttons buttons) 2550 (widget-put widget :buttons buttons)
2542 ;; Insert documentation. 2551 ;; Insert documentation.
2543 (widget-default-format-handler widget ?h) 2552 (widget-default-format-handler widget ?h)
2544 ;; Parents and See also. 2553 ;; Parent groups.
2545 (when (eq level 1) 2554 (if nil ;;; This should test that the buffer
2546 (insert-char ?\ custom-buffer-indent) 2555 ;;; was not made to display a group.
2547 (custom-add-parent-links widget)) 2556 (when (eq level 1)
2557 (insert-char ?\ custom-buffer-indent)
2558 (custom-add-parent-links widget)))
2548 (custom-add-see-also widget 2559 (custom-add-see-also widget
2549 (make-string (* custom-buffer-indent level) 2560 (make-string (* custom-buffer-indent level)
2550 ?\ )) 2561 ?\ ))
2551 ;; Members. 2562 ;; Members.
2552 (message "Creating group...") 2563 (message "Creating group...")