Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: info-gnus-english@gnu.org
Subject: Re: Modify gnus alist in .gnus. Hook?
Date: Sun, 02 Nov 2014 00:58:53 +0100	[thread overview]
Message-ID: <87d296jww2.fsf@web.de> (raw)
In-Reply-To: <87wq88p0sj.fsf@uw.edu>

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	other threads:[~2014-11-01 23:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-10 12:27 Brady Trainor
2014-11-01 23:58 ` Michael Heerdegen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d296jww2.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=info-gnus-english@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).