Thread View: gnu.epoch.misc
2 messages
2 total messages
Started by Chris Chase
Wed, 17 Apr 1991 20:34
Auto-fill for GNUServer buffers
Author: Chris Chase
Date: Wed, 17 Apr 1991 20:34
Date: Wed, 17 Apr 1991 20:34
11 lines
954 bytes
954 bytes
I use gnuservX.el from my mail program to edit and create messages. I would like the buffers that are created to automatically have auto-fill turned on. Could someone please explain how to do this? Thank you, Chris Chase -- EE Department Princeton University chase@ee.princeton.edu
Re: Auto-fill for GNUServer buffers
Author: Alan M. Carroll
Date: Thu, 18 Apr 1991 14:13
Date: Thu, 18 Apr 1991 14:13
91 lines
3848 bytes
3848 bytes
In article <8411@idunno.Princeton.EDU>, chase@olympus.princeton.edu (Chris Chase) writes:
> I use gnuservX.el from my mail program to edit and create messages. I would like
> the buffers that are created to automatically have auto-fill turned on. Could
> someone please explain how to do this?
What I would do is use a mode for that. Here's an example XRn mode,
which should be easily adaptable for your mail program. You'd just
have to change the auto-mode name, and add a command to the mode to
set auto-fill. You might also change the header RE's, so that the To:
and Subject: fields are highlighted.
;;; The mode keymap
(defvar xrn-mode-map (make-sparse-keymap) "XRN mode keymap")
;;; This is the only key currently in the key map. I use it because it's the
;;; same as for MH-e.
(define-key xrn-mode-map "\C-c\C-c" 'server-edit)
;;; We want to mark "interesting" headers, and need a default style and
;;; attribute to mark them with (although things are set up so that other
;;; attributes can be used if desired.
;;; This is the attribute
(defvar xrn-header-attribute (reserve-attribute)
"Default Xrn attribute for headers"
)
;;; Create a style for the default attribute. If we're color, then set up
;;; foreground and background, otherwise just let it default to reverse
;;; video.
(defvar xrn-header-style
(let ((s (make-style)))
(when (< 2 (number-of-colors))
(set-style-foreground s "red")
(set-style-background s (background))
)))
;;; Put the style into the attribute so that it can be used.
(set-attribute-style xrn-header-attribute xrn-header-style)
(defvar xrn-mode-headers
(list
(cons "^[fF]ollowup-To:" xrn-header-attribute)
(cons "^Newsgroups:" xrn-header-attribute)
)
"*A list of (re . attribute) pairs for marking headers in the Xrn buffer"
)
;;; Inhibit mode inheritance
(put 'xrn-mode 'mode-class 'special)
;;; Set up the auto mode stuff, but try to avoid putting it in twice if we
;;; have to reload this file.
(let ((re "/tmp/xrn[A-Za-z]+[0-9]+$"))
(setq auto-mode-alist
(cons
(cons re 'xrn-mode) ; our mode
(delete-if ; get rid of any previous version
(eval (` '(lambda (x) (equal (, re) (car x)))))
auto-mode-alist
))))
;;; The actual mode itself.
(defun xrn-mode ()
"Switch into XRN editing mode
\\[server-edit] : Finish the edit and post"
(use-local-map xrn-mode-map)
(setq major-mode 'xrn-mode)
(setq mode-name "Xrn")
;; deal with the headers
(dolist (h xrn-mode-headers)
(let
(
(re (car h)) ;the RE to find
(attr (or (cdr h) xrn-header-attribute)) ;the attribute to use
)
(goto-char (point-min))
(while (re-search-forward re nil t)
(end-of-line)
(add-button (match-end 0) (point) attr (list 'xrn))
)))
(run-hooks 'xrn-mode-hooks)
)
--
Alan M. Carroll <-- Another victim of applied metaphysics
Epoch Development Team
Urbana Il. "I hate shopping with the reality-impaired" - Susan
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads