gnus-Group-mode-hook
-
Called with no arguments after initializing Group Mode if its value is
non-
nil
. This hook is intended to customize Group Mode only
once. It is possible to define or change the NNTP server as you like in
this hook since the hook is called before GNUS is connected to an NNTP
server.
gnus-Subject-mode-hook
-
Called with no arguments after initializing Subject Mode if its value is
non-
nil
. This hook is intended to customize Subject Mode only
once. All sorts of searches in Subject Mode normally ignore the case of
the text they are searching through. If you do not want to ignore the
case, set the variable case-fold-search
to nil
in this
hook.
The following example shows how to assign the functions
gnus-Subject-next-group
and gnus-Subject-prev-group
to
keys in Subject Mode.
(setq gnus-Subject-mode-hook
'(lambda ()
(local-set-key "\C-cn" 'gnus-Subject-next-group)
(local-set-key "\C-cp" 'gnus-Subject-prev-group)))
gnus-Article-mode-hook
-
Called with no arguments after initializing Article Mode if its value is
non-
nil
. This hook is intended to customize Article Mode only
once.
Displaying the current time in the mode line of buffers is disabled in
the Article buffer and the Subject buffer to show information on the
current newsgroup and the current article. If you want to display the
current time in the mode line of the Article buffer, make the variable
global-mode-string
no longer have a separate value in the buffer
as follows:
(setq gnus-Article-mode-hook
'(lambda ()
(kill-local-variable 'global-mode-string)))
gnus-Kill-file-mode-hook
-
Called with no arguments after initializing KILL-File Mode if its
value is non-
nil
.
gnus-Browse-killed-mode-hook
-
Called with no arguments after initializing Browse-Killed Mode if its
value is non-
nil
.
gnus-Open-server-hook
-
Called with no arguments just before opening a connection to NNTP server
if its value is non-
nil
.
gnus-Startup-hook
-
Called with no arguments after an NNTP server is successfully connected
to if its value is non-
nil
. It is possible to change the behavior
of GNUS according to the server.
gnus-Group-prepare-hook
-
Called with no arguments after a list of newsgroups is prepared in the
Newsgroup buffer. This hook is intended to modify the buffer.
gnus-Subject-prepare-hook
-
Called with no arguments after list of subjects is prepared in the
Subject buffer. This hook is intended to modify the buffer.
gnus-Article-prepare-hook
-
Called with no arguments after an article is prepared in the Article
buffer. This hook is intended to modify the buffer. For example, kanji
code conversion or un-ROT13-ing can be done in this hook.
gnus-Select-group-hook
-
Called with no arguments when a newsgroup is selected. This hook is
intended to change the behavior of GNUS according to the selected
newsgroup.
The following is an example of sorting the headers listed in the Subject
buffer by date and then by subject. Preceding `Re:' of subjects is
ignored while comparing subjects.
(setq gnus-Select-group-hook
'(lambda ()
;; First of all, sort by date.
(gnus-sort-headers
'(lambda (a b)
(gnus-date-lessp (gnus-header-date a)
(gnus-header-date b))))
;; Then sort by subject ignoring `Re:'.
(gnus-sort-headers
'(lambda (a b)
(gnus-string-lessp
(gnus-simplify-subject
(gnus-header-subject a) 're-only)
(gnus-simplify-subject
(gnus-header-subject b) 're-only)
)))))
The following is an example of simplifying subjects like the
gnus-Subject-next-same-subject
command does:
(setq gnus-Select-group-hook
'(lambda ()
(mapcar (function
(lambda (header)
(nntp-set-header-subject
header
(gnus-simplify-subject
(gnus-header-subject header) 're-only))))
gnus-newsgroup-headers)))
In some newsgroups, author names are meaningless. It is possible to
prevent listing author names in the Subject buffer as follows:
(setq gnus-Select-group-hook
'(lambda ()
(cond ((string-equal "comp.sources.unix"
gnus-newsgroup-name)
(setq gnus-optional-headers
(function gnus-optional-lines)))
(t
(setq gnus-optional-headers
(function
gnus-optional-lines-and-from))))))
gnus-Select-article-hook
-
Called with no arguments when an article is selected if its value is
non-
nil
.
The default hook definition shows conversation thread subtrees of the
selected article automatically as follows:
(setq gnus-Select-article-hook
'(lambda ()
(gnus-Subject-show-thread)))
It is possible to run Rmail on a digest article automatically as
follows:
(setq gnus-Select-article-hook
'(lambda ()
(gnus-Subject-show-thread)
(cond ((string-equal "comp.sys.sun"
gnus-newsgroup-name)
(gnus-Subject-rmail-digest))
((and (string-equal "comp.text"
gnus-newsgroup-name)
(string-match "^TeXhax Digest"
(gnus-header-subject
gnus-current-headers)))
(gnus-Subject-rmail-digest)
))))
gnus-Select-digest-hook
-
Called with no arguments when reading digest messages using Rmail if its
value is non-
nil
. This hook is intended to modify an article so
that Rmail can work with it. See section Reading Digest Articles, for more
information on digest articles.
The following example is the default hook definition to modify
incomplete digest articles:
(setq gnus-Select-digest-hook
'(lambda ()
;; Reply-To: is required by
;; `undigestify-rmail-message'.
(or (mail-position-on-field "Reply-to" t)
(progn
(mail-position-on-field "Reply-to")
(insert (gnus-fetch-field "From"))))))
gnus-Rmail-digest-hook
-
Called with no arguments when reading digest messages using Rmail if its
value is non-
nil
. This hook is intended to customize Rmail Mode
for reading digest articles.
gnus-Apply-kill-hook
-
Called with no arguments when a newsgroup is selected and the Subject
buffer is prepared if its value is non-
nil
. This hook is intended
to apply KILL files to the selected newsgroup. It is set to the
function gnus-apply-kill-file
by default.
Since a general KILL file is too heavy to use only for a few newsgroups,
a lighter hook function is recommended. For example, if you'd like to
apply kills to articles which contain the string `rmgroup' in
subject in newsgroup `control', you can use the following
hook:
(setq gnus-Apply-kill-hook
'(lambda ()
(cond ((string-match "control" gnus-newsgroup-name)
(gnus-kill "Subject" "rmgroup")
(gnus-expunge "X")))))
See section KILL File, for more information on KILL files.
gnus-Mark-article-hook
-
Called with no arguments when an article is selected for the first time
if its value is non-
nil
. The hook is intended to mark an article
as read (or unread) automatically when it is selected.
The following example is the default definition of the hook:
(setq gnus-Mark-article-hook
'(lambda ()
;; Mark the selected article as read.
(or (memq gnus-current-article gnus-newsgroup-marked)
(gnus-Subject-mark-as-read gnus-current-article))
;; Put "+" on the current subject.
(gnus-Subject-set-current-mark "+")
))
It is possible to mark as unread (`-') instead when an article is
selected as follows:
(setq gnus-Mark-article-hook
'(lambda ()
;; Mark the selected article as unread.
(gnus-Subject-mark-as-unread gnus-current-article)
;; Put "+" on the current subject.
(gnus-Subject-set-current-mark "+")
))
gnus-Inews-article-hook
-
Called with no arguments before posting an article if its value is
non-
nil
. This hook is called just before sending an article to
the NNTP server or calling the `inews' program, while the hook
news-inews-hook
is called before preparing article headers. This
hook is intended to run special encoding programs such as kanji code
conversion on the article.
gnus-Exit-group-hook
-
Called with no arguments when exiting the current newsgroup if its value
is non-
nil
. If your machine is so slow that exiting from Subject
Mode takes a long time, you can inhibit marking articles as read by
using cross-reference information in the `Xref:' field by setting
the variable gnus-newsgroup-headers
to nil
in this
hook.
gnus-Exit-gnus-hook
-
Called with no arguments when exiting GNUS if its value is
non-
nil
. If you want to clear out Emacs buffers which were
created by GNUS and remain afterwards, you can use this hook.
The following example shows how to kill a buffer which was used for
posting news.
(setq gnus-Exit-gnus-hook
'(lambda ()
;; Kill a buffer used for posting news.
(and (get-buffer "*post-news*")
(kill-buffer "*post-news*"))))
gnus-Suspend-gnus-hook
-
Called with no arguments when suspending GNUS if its value is
non-
nil
. The purpose is the same as the hook
gnus-Exit-gnus-hook
.
gnus-Save-newsrc-hook
-
Called with no arguments before saving the startup file `.newsrc'
if its value is non-
nil
. This hook is intended to change the way
of backing up the startup file.
nntp-server-hook
-
Called with no arguments when the connection between Emacs and the NNTP
server is established if its value is non-
nil
. This hook is
intended to change the kanji code of a buffer associated with the
stream. Use the variable nntp-server-name
to refer to the name
of the NNTP server in this hook. See section Kanji Handling, for more
information.