comparison lisp/cus-edit.el @ 79659:a4773f405434

(custom-add-parent-links): New arg DOC-INITIAL-STRING. Defaults for INITIAL-STRING and DOC-INITIAL-STRING do not include `parent'. (custom-group-value-create): Pass two args to custom-add-parent-links.
author Richard M. Stallman <rms@gnu.org>
date Mon, 31 Dec 2007 03:42:51 +0000
parents 4feb30a8db36
children 6fa5fc37cfee
comparison
equal deleted inserted replaced
79658:25632103272c 79659:a4773f405434
2311 (insert " and "))) 2311 (insert " and ")))
2312 (t 2312 (t
2313 (insert ", ")))) 2313 (insert ", "))))
2314 (widget-put widget :buttons buttons)))) 2314 (widget-put widget :buttons buttons))))
2315 2315
2316 (defun custom-add-parent-links (widget &optional initial-string) 2316 (defun custom-add-parent-links (widget &optional initial-string
2317 doc-initial-string)
2317 "Add \"Parent groups: ...\" to WIDGET if the group has parents. 2318 "Add \"Parent groups: ...\" to WIDGET if the group has parents.
2318 The value is non-nil if any parents were found. 2319 The value is non-nil if any parents were found.
2319 If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"." 2320 If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"."
2320 (let ((name (widget-value widget)) 2321 (let ((name (widget-value widget))
2321 (type (widget-type widget)) 2322 (type (widget-type widget))
2322 (buttons (widget-get widget :buttons)) 2323 (buttons (widget-get widget :buttons))
2323 (start (point)) 2324 (start (point))
2324 (parents nil)) 2325 (parents nil))
2325 (insert (or initial-string "Parent groups:")) 2326 (insert (or initial-string "Groups:"))
2326 (mapatoms (lambda (symbol) 2327 (mapatoms (lambda (symbol)
2327 (when (member (list name type) (get symbol 'custom-group)) 2328 (when (member (list name type) (get symbol 'custom-group))
2328 (insert " ") 2329 (insert " ")
2329 (push (widget-create-child-and-convert 2330 (push (widget-create-child-and-convert
2330 widget 'custom-group-link 2331 widget 'custom-group-link
2341 (get (car parents) 'custom-links)))) 2342 (get (car parents) 'custom-links))))
2342 (many (> (length links) 2))) 2343 (many (> (length links) 2)))
2343 (when links 2344 (when links
2344 (let ((pt (point)) 2345 (let ((pt (point))
2345 (left-margin (+ left-margin 2))) 2346 (left-margin (+ left-margin 2)))
2346 (insert "\nParent documentation: ") 2347 (insert "\n" (or doc-initial-string "Group documentation:") " ")
2347 (while links 2348 (while links
2348 (push (widget-create-child-and-convert 2349 (push (widget-create-child-and-convert
2349 widget (car links) 2350 widget (car links)
2350 :button-face 'custom-link 2351 :button-face 'custom-link
2351 :mouse-face 'highlight 2352 :mouse-face 'highlight
3942 ;; Add parent groups references above the group. 3943 ;; Add parent groups references above the group.
3943 (if t ;;; This should test that the buffer 3944 (if t ;;; This should test that the buffer
3944 ;;; was made to display a group. 3945 ;;; was made to display a group.
3945 (when (eq level 1) 3946 (when (eq level 1)
3946 (if (custom-add-parent-links widget 3947 (if (custom-add-parent-links widget
3947 "Parent groups:") 3948 "Parent groups:"
3949 "Parent group documentation:")
3948 (insert "\n")))) 3950 (insert "\n"))))
3949 ;; Create level indicator. 3951 ;; Create level indicator.
3950 (insert-char ?\ (* custom-buffer-indent (1- level))) 3952 (insert-char ?\ (* custom-buffer-indent (1- level)))
3951 (insert "/- ") 3953 (insert "/- ")
3952 ;; Create tag. 3954 ;; Create tag.