Gnus Manual. Node: Article Buttons

PREVArticle Washing UPArticle Treatment NEXTArticle Date

3.17.5: Article Buttons

People often include references to other stuff in articles, and it would be nice if Gnus could just fetch whatever it is that people talk about with the minimum of fuzz when you hit RET or use the middle mouse button on these references.

Gnus adds buttons to certain standard references by default: Well-formed URLs, mail addresses and Message-IDs. This is controlled by two variables, one that handles article bodies and one that handles article heads:

gnus-button-alist

This is an alist where each entry has this form:

(REGEXP BUTTON-PAR USE-P FUNCTION DATA-PAR)
regexp

All text that match this regular expression will be considered an external reference. Here's a typical regexp that matches embedded URLs: `<URL:\\([^\n\r>]*\\)>'.

button-par

Gnus has to know which parts of the matches is to be highlighted. This is a number that says what sub-expression of the regexp is to be highlighted. If you want it all highlighted, you use 0 here.

use-p

This form will be evaled, and if the result is non-nil, this is considered a match. This is useful if you want extra sifting to avoid false matches.

function

This function will be called when you click on this button.

data-par

As with button-par, this is a sub-expression number, but this one says which part of the match is to be sent as data to function.

So the full entry for buttonizing URLs is then

("<URL:\\([^\n\r>]*\\)>" 0 t gnus-button-url 1)
gnus-header-button-alist

This is just like the other alist, except that it is applied to the article head only, and that each entry has an additional element that is used to say what headers to apply the buttonize coding to:

(HEADER REGEXP BUTTON-PAR USE-P FUNCTION DATA-PAR)

HEADER is a regular expression.

gnus-button-url-regexp

A regular expression that matches embedded URLs. It is used in the default values of the variables above.

gnus-article-button-face

Face used on buttons.

gnus-article-mouse-face

Face used when the mouse cursor is over a button.

See Customizing Articles, for how to buttonize articles automatically.

PREVArticle Washing UPArticle Treatment NEXTArticle Date