Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Modify gnus alist in .gnus. Hook?
@ 2014-10-10 12:27 Brady Trainor
  2014-11-01 23:58 ` Michael Heerdegen
  0 siblings, 1 reply; 2+ messages in thread
From: Brady Trainor @ 2014-10-10 12:27 UTC (permalink / raw)
  To: info-gnus-english


I managed to shorten the group name used in `gnus-group-line-format',
but not sure how to set it up for use in my .gnus.el. 

Either a hook or eval-after-load, but I'm failing on both. 

Here is my modification: 

--8<---------------cut here---------------start------------->8---
(add-to-list 'gnus-group-line-format-alist
             `(?z (gnus-short-group-name gnus-tmp-qualified-group) ?s))
--8<---------------cut here---------------end--------------->8---

A minimal change to the group-line-format would be the z in the
otherwise default: 

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

I tried lines like

--8<---------------cut here---------------start------------->8---
(add-hook 'gnus-started-hook
          `(add-to-list 'gnus-group-line-format-alist
                        `(?z (gnus-short-group-name
                              gnus-tmp-qualified-group) ?s))
                              )
--8<---------------cut here---------------end--------------->8---

but this did not work.           


--
Brady



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Modify gnus alist in .gnus. Hook?
  2014-10-10 12:27 Modify gnus alist in .gnus. Hook? Brady Trainor
@ 2014-11-01 23:58 ` Michael Heerdegen
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Heerdegen @ 2014-11-01 23:58 UTC (permalink / raw)
  To: info-gnus-english

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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-01 23:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-10 12:27 Modify gnus alist in .gnus. Hook? Brady Trainor
2014-11-01 23:58 ` Michael Heerdegen

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).