emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PATCH: Use parent links for customization items with no links


From: Per Abrahamsen
Subject: PATCH: Use parent links for customization items with no links
Date: Sun, 30 Nov 2003 15:13:57 +0100
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

On the Gnus developers mailing list, there were a discussion of what
to do with :link in the case where a single section in the info file
documents a number of options all belonging to the same custom group.

If you add a :link to each option, it will clutter display if you
customize the group.  On the other hand, if you only add the :link to
the group, it will not appear when you customize the individual
options.

Here is a patch to cus-edit.el to handle that case.  It will display
the links of the parent group, if the item (option/group/face) you are
customizing doesn't have any links of its own.

Ok to commit?

2003-11-30  Per Abrahamsen  <address@hidden>

        * cus-edit.el (custom-add-parent-links): Add documentation links
        for parent, if the item has none of its own.

Index: lisp/cus-edit.el
===================================================================
RCS file: /cvsroot/emacs//emacs/lisp/cus-edit.el,v
retrieving revision 1.187
diff -c -r1.187 cus-edit.el
*** lisp/cus-edit.el    1 Sep 2003 15:45:09 -0000       1.187
--- lisp/cus-edit.el    30 Nov 2003 14:03:56 -0000
***************
*** 1956,1962 ****
        (type (widget-type widget))
        (buttons (widget-get widget :buttons))
        (start (point))
!       found)
      (insert (or initial-string "Parent groups:"))
      (mapatoms (lambda (symbol)
                (let ((entry (assq name (get symbol 'custom-group))))
--- 1956,1962 ----
        (type (widget-type widget))
        (buttons (widget-get widget :buttons))
        (start (point))
!       (parents nil))
      (insert (or initial-string "Parent groups:"))
      (mapatoms (lambda (symbol)
                (let ((entry (assq name (get symbol 'custom-group))))
***************
*** 1967,1978 ****
                           :tag (custom-unlispify-tag-name symbol)
                           symbol)
                          buttons)
!                   (setq found t)))))
!     (widget-put widget :buttons buttons)
!     (if found
!       (insert "\n")
        (delete-region start (point)))
!     found))
  
  ;;; The `custom-comment' Widget.
  
--- 1967,1995 ----
                           :tag (custom-unlispify-tag-name symbol)
                           symbol)
                          buttons)
!                   (setq parents (cons symbol parents))))))
!     (and (null (get symbol 'custom-links)) ;No links of its own.
!          (= (length parents) 1)         ;A single parent.
!          (let ((links (get (car parents) 'custom-links)))
!            (when links
!              (insert "\nParent documentation: ")
!              (while links
!                (push (widget-create-child-and-convert widget (car links))
!                      buttons)
!                (setq links (cdr links))
!                (cond ((null links)
!                       (insert ".\n"))
!                      ((null (cdr links))
!                       (if many
!                           (insert ", and ")
!                         (insert " and ")))
!                      (t
!                       (insert ", ")))))))
!     (if parents
!         (insert "\n")
        (delete-region start (point)))
!     (widget-put widget :buttons buttons)
!     parents))
  
  ;;; The `custom-comment' Widget.
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]