From: | Richard Pieri <ratinox@***.NEU.EDU> |
---|---|
Subject: | shadowtalk.el for emacs |
Date: | Mon, 21 Jun 1993 19:44:01 EDT |
go through a lot of work to reformat your messages in the "shadowtalk"
style. And I know that some of you who do use GNU Emacs to do it. Well,
have I got an offer for you. Put the following code in your ~/.emacs file,
or load it (or autoload it) as you like. Then compose a message, set point
and mark around the text you want to reformat, and type M-x
shadowtalk-region. There ya go.]<<<<<
--Ratinox (19:41:28/06-21-93)
--Rat <ratinox@***.neu.edu> Northeastern's Stainless Steel Rat
PGP Public Key Block available upon request Ask about rat-pgp.el
||||| | | | | | | | | | | | | | | | | | | | | | | |||||
One likes to believe in the freedom of baseball. --Geddy Lee
----------------%<cut here%<----------------
;;; -*-Emacs-Lisp-*-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; File: shadowtalk.el v 1.0
;;; Description: Hack to format text into "shadowtalk".
;;; Author: Richard Pieri, ratinox@***.neu.edu
;;; Created: Mon Jun 21 19:26:21 1993
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation.
;; This software is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; For a copy of the GNU General Public License write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Installation:
;;;
;;; Simple: (load-file "shadowtalk"). No fancy stuff.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconst date-month-number
'(("Jan" . 1) ("Feb" . 2) ("Mar" . 3) ("Apr" .
4) ("May" . 5) ("Jun" . 6)
("Jul" . 7) ("Aug" . 8) ("Sep" . 9) ("Oct" .
10) ("Nov" . 11) ("Dec" . 12))
"Assoc list for looking up the month number from the month abbreviation.")
(defvar shadowtalk-name nil
"The street name to insert at the end of a region of \"shadowtalk\" text.
If nil, shadowtalk-region will prompt for a name.")
(defun shadowtalk-region (&optional name)
"Format a region of text into \"shadowtalk\"."
(interactive)
(if (eq shadowtalk-name nil)
(setq name (read-string "Name: ")))
(save-excursion
(save-restriction
(narrow-to-region (point)(mark))
(goto-char (point-min))
(insert ">>>>>[")
(goto-char (point-max))
(if (looking-at "^$")
(backward-delete-char-untabify 1))
(insert "]<<<<<")
(fill-region (point-min)(point-max) nil)
(goto-char (point-max))
(if name
(insert (shadowtalk-insert-datestamp name))
(insert (shadowtalk-insert-datestamp shadowtalk-name)))
)))
(defun shadowtalk-insert-datestamp (name &optional hour min sec mon day year)
"Insert \"shadowtalk\" time/datestamp at point."
(let (timestamp
(cur-time (current-time-string)))
(if (not hour)
(setq hour (string-to-int (substring cur-time 11 13))))
(if (not min)
(setq min (string-to-int (substring cur-time 14 16))))
(if (not sec)
(setq sec (string-to-int (substring cur-time 17 19))))
(if (not mon)
(setq mon (cdr (assoc (substring cur-time 4 7) date-month-number))))
(if (not day)
(setq day (string-to-int (substring cur-time 8 10))))
(if (not year)
(setq year (string-to-int (substring cur-time 22 24))))
(setq timestamp
(concat
(format " --%s (%02d:%02d:%02d/%02d-%02d-%02d)"
name hour min sec mon day year)))
(if (interactive-p)
(insert timestamp)
timestamp)))