From: Julien Danjou Date: Wed, 27 Oct 2010 22:08:36 +0000 (+0000) Subject: gnus-group.el: Make gnus-group-default-list-level possibly a function. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~45^2~434 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=11a5db4a62a5d29f9419db6658f818b9a4d499cc;p=emacs.git gnus-group.el: Make gnus-group-default-list-level possibly a function. --- diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index e08805f38e1..e0a3ca280b5 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -2415,6 +2415,9 @@ one with the best level. 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 diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 3e569c7265d..f4dde8b660b 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,9 @@ +2010-10-26 Julien Danjou + + * 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 * mm-decode.el (mm-shr): Add undisplayer to MIME handle. diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 1d73b44b8b6..3f3cd24963f 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -119,10 +119,11 @@ If nil, only list groups that have unread articles." :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 @@ The following commands are available: (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 @@ The following commands are available: (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 @@ Also see the `gnus-group-use-permanent-levels' variable." (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)