info-gnus-english
[Top][All Lists]
Advanced

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

Re: Modify gnus alist in .gnus. Hook?


From: Michael Heerdegen
Subject: Re: Modify gnus alist in .gnus. Hook?
Date: Sun, 02 Nov 2014 00:58:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Brady Trainor <algebrat@uw.edu> writes:

> (add-hook 'gnus-started-hook
>           `(add-to-list 'gnus-group-line-format-alist
>                         `(?z (gnus-short-group-name
>                               gnus-tmp-qualified-group) ?s))
>                               )

That's wrong.  Hook elements must be functions (no matter whether named
or anonymous) - but you added an expression that evaluates to a list.
See (info "(elisp) Hooks").

Some more hints (although not crucial): use normal quoting when you
don't need backquote's unquoting (`,').  And there is already an entry
for ?z in the association list, you try to add a second entry for it.

I would do it like this:

--8<---------------cut here---------------start------------->8---
(add-hook
 'gnus-started-hook
 (lambda ()
   (assq-delete-all ?z gnus-group-line-format-alist)
   (push '(?z
           (gnus-short-group-name gnus-tmp-qualified-group)
           ?s)
         gnus-group-line-format-alist)))

(setq gnus-group-line-format "%M%S%p%P%5y:%B%(%z%)\n")
--8<---------------cut here---------------end--------------->8---

In Emacs 25, there will be a setf'able `alist-get' function that will
make modifying alists a bit more comfortable.  Don't care about that
info if you don't know what setf is.


HTH,

Michael.




reply via email to

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