Mercurial > emacs
changeset 111209:c1bfed865afd
gnus-group.el: Make gnus-group-default-list-level possibly a function.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Wed, 27 Oct 2010 22:08:36 +0000 |
parents | 7608f4a2422d |
children | 4c19a062df30 |
files | doc/misc/gnus.texi lisp/gnus/ChangeLog lisp/gnus/gnus-group.el |
diffstat | 3 files changed, 22 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/misc/gnus.texi Wed Oct 27 17:47:09 2010 -0400 +++ b/doc/misc/gnus.texi Wed Oct 27 22:08:36 2010 +0000 @@ -2415,6 +2415,9 @@ All groups with a level less than or equal to @code{gnus-group-default-list-level} will be listed in the group buffer by default. +This variable can also be a function. In that case, that function will +be called and the result will be used as value. + @vindex gnus-group-list-inactive-groups If @code{gnus-group-list-inactive-groups} is non-@code{nil}, non-active
--- a/lisp/gnus/ChangeLog Wed Oct 27 17:47:09 2010 -0400 +++ b/lisp/gnus/ChangeLog Wed Oct 27 22:08:36 2010 +0000 @@ -1,3 +1,9 @@ +2010-10-26 Julien Danjou <julien@danjou.info> + + * gnus-group.el (gnus-group-default-list-level): Add this function to + compute the default list level. + (gnus-group-default-list-level): Add possibility to use a function. + 2010-10-27 Katsumi Yamaoka <yamaoka@jpl.org> * mm-decode.el (mm-shr): Add undisplayer to MIME handle.
--- a/lisp/gnus/gnus-group.el Wed Oct 27 17:47:09 2010 -0400 +++ b/lisp/gnus/gnus-group.el Wed Oct 27 22:08:36 2010 +0000 @@ -119,10 +119,11 @@ :type 'boolean) (defcustom gnus-group-default-list-level gnus-level-subscribed - "*Default listing level. + "Default listing level. Ignored if `gnus-group-use-permanent-levels' is non-nil." :group 'gnus-group-listing - :type 'integer) + :type '(choice (integer :tag "Level") + (function :tag "Function returning level"))) (defcustom gnus-group-list-inactive-groups t "*If non-nil, inactive groups will be listed." @@ -1169,6 +1170,12 @@ (mouse-set-point e) (gnus-group-read-group nil)) +(defun gnus-group-default-list-level () + "Return the real value for `gnus-group-default-list-level'." + (if (functionp gnus-group-default-list-level) + (funcall gnus-group-default-list-level) + gnus-group-default-list-level)) + ;; Look at LEVEL and find out what the level is really supposed to be. ;; If LEVEL is non-nil, LEVEL will be returned, if not, what happens ;; will depend on whether `gnus-group-use-permanent-levels' is used. @@ -1178,13 +1185,13 @@ (or (setq gnus-group-use-permanent-levels (or level (if (numberp gnus-group-use-permanent-levels) gnus-group-use-permanent-levels - (or gnus-group-default-list-level + (or (gnus-group-default-list-level) gnus-level-subscribed)))) - gnus-group-default-list-level gnus-level-subscribed)) + (gnus-group-default-list-level) gnus-level-subscribed)) (number-or-nil level) (t - (or level gnus-group-default-list-level gnus-level-subscribed)))) + (or level (gnus-group-default-list-level) gnus-level-subscribed)))) (defun gnus-group-setup-buffer () (set-buffer (gnus-get-buffer-create gnus-group-buffer)) @@ -1230,7 +1237,7 @@ (prefix-numeric-value current-prefix-arg) (or (gnus-group-default-level nil t) - gnus-group-default-list-level + (gnus-group-default-list-level) gnus-level-subscribed)))) (unless level (setq level (car gnus-group-list-mode)