[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mail signatures



    Date: Thu, 25 Jun 1992 05:45 EDT
    From: Vincent Keunen <scosysv!keunen@nrbmi2.ia.nrb.be>

    Is there a way to define signatures to be automatically added to the end
    of a mail message?

    vk

I advise ZWEI:COM-SEND-MESSAGE and ZWEI:COM-EXIT-COM-MAIL to insert a
signature in the buffer.  Here's my code:

(defparameter *signature* #.(format nil "~%~48Xbarmar~%"))

(defun maybe-add-signature ()
  (and (not-already-signed *interval* *signature*)
       (y-or-n-p "Add signature? ")
       (insert (interval-last-bp *interval*) *signature*)))

(defun not-already-signed (interval sig)
  (let* ((end (interval-last-bp interval))
	 (before-sig (forward-char end (- (string-length sig)))))
    (if before-sig				;big enough for a signature
	(string-not-equal sig			;but doesn't end with it
			  (string-interval before-sig end t))
	t)))

(advise com-exit-com-mail :before add-signature nil
  (maybe-add-signature))

(advise com-send-message :before add-signature nil
  (maybe-add-signature))