Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
    
Can you elaborate? –  Trey Jackson Jul 31 '09 at 16:21
    
I would like to save three or four common responses, choose one, make small edits, and post or email the result. –  Richard Hoskins Jul 31 '09 at 17:21
add comment

4 Answers

up vote 4 down vote accepted
+50

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.

share|improve this answer
2  
No, I mean Emacs Gnus. –  Richard Hoskins Jul 22 '09 at 4:07
1  
en.wikipedia.org/wiki/Gnus –  Richard Hoskins Jul 22 '09 at 4:08
    
abbrev-mode works in Gnus. –  Peter Salazar Feb 19 at 2:39
add comment

You could also try YASnippet which would allow you to tab complete parts of boiler plate text where required.

share|improve this answer
add comment

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.

share|improve this answer
add comment

At its simplest, you can do something like this:

(setq my-F3-keymap (make-sparse-keymap))
(global-set-key [(f3)] my-F3-keymap)

(define-key my-F3-keymap [(n)]
  (function
   (lambda ()
     "insert now is..."
     (interactive)
     (insert "Now is the time for all good men to come to the aid of their country."))))

(define-key my-F3-keymap [(N)]
  (function
   (lambda ()
     "insert now is... with newlines"
     (interactive)
     (insert "Now is the time\nfor all good men\nto come to the aid\nof their country."))))

(define-key my-F3-keymap [(f)]
  (function
   (lambda ()
     "insert external file contents"
     (interactive)
     (insert-file "c:/temp/foo.html"))))
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.