Home » Questions » Computers [ Ask a new question ]

Boilerplate text with Emacs Gnus

Boilerplate text with Emacs Gnus

How can I make boilerplate text to use with Emacs Gnus email responses?

Asked by: Guest | Views: 212
Total answers/comments: 2
Guest [Entry]

"AbbrevMode works in Gnus.

From that link (with some edits):

Defining Abbrevs

Type the word you want to use as expansion, and then type ‘C-x a g’ and the abbreviation for it. Example:

This is the text of an opening paragraph.Esc h Ctrl-u 0 Ctrl-x a gopenReturn

Me: That's a zero after the C-u. Together they make the abbrev definition C-x a g apply to the selected region, which is a paragraph, in this case, which the M-h (Esc-h or Alt-h) selected. The abbrev definition can be made to apply only to the current major mode instead of globally by using C-x a l (that's an ""ell"" instead of the ""g"").

Saving Abbrevs

Use ‘M-x write-abbrev-file’ and just hit RET when asked for a filename. The default is “~/.abbrev_defs”. In the future, Emacs should save the abbrevs automatically when you quit Emacs.

Also, if you want abbreviations to be saved whenever you save files (C-x s) or quit emacs, add the following to your .emacs:

(setq save-abbrevs t)

Restoring Abbrevs

Use ‘M-x read-abbrev-file’ to read the abbrevs, or better yet, add the following to your ~/.emacs file:

(quietly-read-abbrev-file)

This will read the definitions from the default file, “~/.abbrev_defs”.

Using Abbrevs

‘M-x abbrev-mode’ toggles Abbrev mode. You can also put the following in your ~/.emacs file if you want it always on:

(abbrev-mode 1) Actually, you may have to do:

(setq default-abbrev-mode t) I’m not really sure why.

me again: Once abbrev-mode is on, typing an abbreviation followed by white space causes it to be immediately expanded. However, if you don't want that to happen you can leave it turned off and expand them manually like this:

openCtrl-x a e

becomes:

This is the text of an opening paragraph."
Guest [Entry]

"Gnus uses Message-Mode for creating messages, so maybe that one has some specific functions for it.

I would use a custom hook in message-setup-hook for that (which asks me what I want to be asked and create a template). Note that this hook is called for both email and usenet news, both new messages and replies. But it should be easy to distinguish these cases from the buffer content."