www.delorie.com/gnu/docs/emacs/mh-e_59.html   search  
Buy the book!


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.2 Editing Multimedia Messages

The variable mh-mime-content-types contains a list of the currently valid content types. They are listed in the table in 3.3 Editing a Draft. If you encounter a new content type, you can add it like this:

(setq mh-mime-content-types (append mh-mime-content-types

Emacs macros can be used to insert enriched text directives like `<bold>'. The following code will make, for example, C-c t b insert the `<bold>' directive.

Emacs macros for entering enriched text

(defvar enriched-text-types '(("b" . "bold") ("i" . "italic")
                              ("f" . "fixed") ("s" . "smaller")
                              ("B" . "bigger") ("u" . "underline")
                              ("c" . "center"))
  "Alist of (final-character . directive) choices for add-enriched-text.
Additional types can be found in RFC 1563.")

(defun add-enriched-text (begin end)
  "Add enriched text directives around region.
The directive used comes from the list enriched-text-types and is
specified by the last keystroke of the command.  When called from Lisp,
arguments are BEGIN and END."
  (interactive "r")
  ;; Set type to the directive indicated by the last keystroke.
  (let ((type (cdr (assoc (char-to-string (logior last-input-char ?`))
    (save-restriction              ; restores state from narrow-to-region
      (narrow-to-region begin end) ; narrow view to region
      (goto-char (point-min))      ; move to beginning of text
      (insert "<" type ">")        ; insert beginning directive
      (goto-char (point-max))      ; move to end of text
      (insert "</" type ">"))))    ; insert terminating directive

To use the function add-enriched-text, first create key bindings for it (see section 3.2 Sending Mail). Then, set the mark with C-@ or C-SPC, type in the text to be highlighted, and type C-c t b. This adds `<bold>' where you set the mark and adds `</bold>' at the location of your cursor, giving you something like: `You should be <bold>very</bold>'. You may also be interested in investigating sgml-mode. Readying multimedia messages for sending  

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003