Function: gnus-group-customize

gnus-group-customize is an autoloaded, interactive and byte-compiled function defined in gnus-cus.el.gz.

Signature

(gnus-group-customize GROUP &optional TOPIC)

Documentation

Edit the group or topic on the current line.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-cus.el.gz
(defun gnus-group-customize (group &optional topic)
  "Edit the group or topic on the current line."
  (interactive (list (gnus-group-group-name) (gnus-group-topic-name))
	       gnus-group-mode)
  (let (info
	(types (mapcar (lambda (entry)
			 `(cons :format "%v%h\n"
				:doc ,(nth 2 entry)
				(const :format "" ,(nth 0 entry))
				,(nth 1 entry)))
		       (append (reverse gnus-group-parameters-more)
			       gnus-group-parameters
			       (if group
				   gnus-extra-group-parameters
				 gnus-extra-topic-parameters))))
	(agent (mapcar (lambda (entry)
                         (let ((type (nth 1 entry))
                               vcons)
                           (if (listp type)
                               (setq type (copy-sequence type)))

                           (setq vcons (cdr (memq :value type)))

                           (if (symbolp (car vcons))
                               (condition-case nil
                                   (setcar vcons (symbol-value (car vcons)))
                                 (error)))
                           `(cons :format "%v%h\n"
                                  :doc ,(nth 2 entry)
                                  (const :format "" ,(nth 0 entry))
                                  ,type)))
		       (if gnus-agent
                           gnus-agent-parameters))))
    (unless (or group topic)
      (error "No group on current line"))
    (when (and group topic)
      (error "Both a group and topic on current line"))
    (unless (or topic (setq info (gnus-get-info group)))
      (error "Killed group; can't be edited"))
    ;; Ready.
    (gnus-kill-buffer "*Gnus Customize*")
    (switch-to-buffer (gnus-get-buffer-create "*Gnus Customize*"))
    (gnus-custom-mode)
    (setq-local gnus-custom-group group)
    (setq-local gnus-custom-topic topic)
    (buffer-disable-undo)
    (widget-insert "Customize the ")
    (if group
	(widget-create 'info-link
		       :help-echo "Push me to learn more."
		       :tag "group parameters"
		       "(gnus)Group Parameters")
      (widget-create 'info-link
		     :help-echo "Push me to learn more."
		     :tag  "topic parameters"
		     "(gnus)Topic Parameters"))
    (widget-insert " for <")
    (widget-insert (or group topic))
    (widget-insert "> and press ")
    (widget-create 'push-button
		   :tag "done"
		   :help-echo "Push me when done customizing."
		   :action 'gnus-group-customize-done)
    (widget-insert ".\n\n")
    (make-local-variable 'gnus-custom-params)

    (let ((values (if group
		      (gnus-info-params info)
		    (gnus-topic-parameters topic))))

      ;; The parameters in values may contain duplicates.  This is
      ;; normally OK as assq returns the first. However, right here
      ;; every duplicate ends up being displayed.  So, rather than
      ;; display them, remove them from the list.

      (let ((tmp (setq values (copy-tree values)))
	    elem)
	(while (cdr tmp)
	  (while (setq elem (assq (caar tmp) (cdr tmp)))
	    (delq elem tmp))
	  (setq tmp (cdr tmp))))

      (setq gnus-custom-params
            (apply #'widget-create 'group
                   :value values
                   (delq nil
                         (list `(set :inline t
                                     :greedy t
                                     :tag "Parameters"
                                     :format "%t:\n%h%v"
                                     :doc "\
These special parameters are recognized by Gnus.
Check the [ ] for the parameters you want to apply to this group or
to the groups in this topic, then edit the value to suit your taste."
                                     ,@types)
                               (when gnus-agent
                                 `(set :inline t
                                       :greedy t
                                       :tag "Agent Parameters"
                                       :format "%t:\n%h%v"
                                       :doc "These agent parameters are
recognized by Gnus.  They control article selection and expiration for
use in the unplugged cache.  Check the [ ] for the parameters you want
to apply to this group or to the groups in this topic, then edit the
value to suit your taste.

For those interested, group parameters override topic parameters while
topic parameters override agent category parameters.  Underlying
category parameters are the customizable variables."  ,@agent))
                               '(repeat :inline t
                                        :tag "Variables"
                                        :format "%t:\n%h%v%i\n\n"
                                        :doc "\
Set variables local to the group you are entering.

If you want to turn threading off in `news.answers', you could put
`(gnus-show-threads nil)' in the group parameters of that group.
`gnus-show-threads' will be made into a local variable in the summary
buffer you enter, and the form nil will be `eval'uated there.

This can also be used as a group-specific hook function, if you'd
like.  If you want to hear a beep when you enter a group, you could
put something like `(dummy-variable (ding))' in the parameters of that
group.  `dummy-variable' will be set to the result of the `(ding)'
form, but who cares?"
                                        (list :format "%v" :value (nil nil)
                                              (symbol :tag "Variable")
                                              (sexp :tag
                                                    "Value")))

                               '(repeat :inline t
                                        :tag "Unknown entries"
                                        sexp))))))
    (when group
      (widget-insert "\n\nYou can also edit the ")
      (widget-create 'info-link
		     :tag "select method"
		     :help-echo "Push me to learn more about select methods."
		     "(gnus)Select Methods")
      (widget-insert " for the group.\n")
      (setq gnus-custom-method
	    (widget-create 'sexp
			   :tag "Method"
			   :value (gnus-info-method info))))
    (use-local-map widget-keymap)
    (widget-setup)
    (buffer-enable-undo)
    (goto-char (point-min))))