[Top][All Lists]

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

[h-e-w] mail-send-hook

From: Robert Mecklenburg
Subject: [h-e-w] mail-send-hook
Date: Mon, 19 Nov 2001 13:10:13 -0700

I have a function which copies some stuff from a *cvs* buffer into a
mail message buffer.  The template it inserts contains ellipsis which
should be edited by the user, so I install a hook to ensure the
ellipsis are removed before sending the mail.  This seemed to work
fine in emacs 20.7, but in emacs 21.1 mail-send-hook is not being set
as expected.  Any suggestions?

Here is the code (See the line marked <<<<<<<<):

(defun scan-for-ellipsis ()
  (goto-char (point-min))
  (if (search-forward "..." nil t)
      (error "Please fill in ellipsis before sending this mail.")))

(defun append-to-checkin-message ()
      (let (start (full-contents (buffer-substring-no-properties (point-min) 

        (pop-to-buffer "checkin-msg")
        (make-local-hook 'mail-send-hook)
        (add-hook 'mail-send-hook 'scan-for-ellipsis nil t) ; <<<<<<< 

        (if (equal 0 (buffer-size))
              (insert "To: address@hidden"
                      "Subject: Checkin: ...\n")
              (if (and (boundp 'mail-archive-file-name)          ; If bound
                       mail-archive-file-name                    ;  and not nil
                       (file-readable-p mail-archive-file-name)) ;  and readable
                  (insert "FCC: " mail-archive-file-name "\n"))
              (insert "--text follows this line--\n"
                      "Description:\n  ...\n\nBranch: trunk\n\nBugs: 
              (if (file-readable-p "~/.signature")
                    (insert "--\n")
                    (insert-file-contents "~/.signature")))
        (goto-char (point-min))
        (re-search-forward "^--$" (point-max) 'limit)
        (setq start (point))
        (insert full-contents)
          (narrow-to-region start (point))
          (goto-char (point-min))
          (keep-lines "^\\(added\\|removed\\|committed\\)")
          (goto-char (point-max)))
        (insert "\n")
        (let ((message-buffer (first (cdr (assoc "message" 
          (insert-buffer-substring message-buffer))
        (insert "\n\n\n")


reply via email to

[Prev in Thread] Current Thread [Next in Thread]