unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* PATCH: Use parent links for customization items with no links
@ 2003-11-30 14:13 Per Abrahamsen
  0 siblings, 0 replies; only message in thread
From: Per Abrahamsen @ 2003-11-30 14:13 UTC (permalink / raw)


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  <abraham@dina.kvl.dk>

	* 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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-11-30 14:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-30 14:13 PATCH: Use parent links for customization items with no links Per Abrahamsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).