]> git.donarmstrong.com Git - emacs.git/blobdiff - .emacs
update abbrev defs
[emacs.git] / .emacs
diff --git a/.emacs b/.emacs
index 535c48410a77a4e1784217eedead8e6d2681cb8e..2783d01725b0470c5bce49277f02be0b0b6610a0 100644 (file)
--- a/.emacs
+++ b/.emacs
@@ -219,13 +219,42 @@ Maildir, or by Message-ID."
 
 (add-to-list 'auto-mode-alist '("mutt-[a-z0-9]+-[0-9]+-" . message-mode))
 (add-to-list 'auto-mode-alist '("muttrc" . muttrc-mode))
-(add-hook 'mail-mode-hook
-     (lambda ()
-      (font-lock-add-keywords nil
-        '(("^[ \t]*>[ \t]*>[ \t]*>.*$"
-           (0 'mail-multiply-quoted-text-face))
-          ("^[ \t]*>[ \t]*>.*$"
-           (0 'mail-double-quoted-text-face))))))
+(defun my-message-mode-settings ()
+  (font-lock-add-keywords nil
+                          '(("^[ \t]*>[ \t]*>[ \t]*>.*$"
+                             (0 'message-multiply-quoted-text-face))
+                            ("^[ \t]*>[ \t]*>.*$"
+                             (0 'message-double-quoted-text-face))))
+  (local-set-key (kbd "C-c C-a") 'my-post-attach-file)
+  )
+(add-hook 'message-mode-hook 'my-message-mode-settings)
+
+(defun my-post-attach-file ()
+  "Prompt for an attachment."
+  (interactive)
+  (let ((file (read-file-name "Attach file: " nil nil t nil))
+        (description (string-read "Description: ")))
+    (my-header-attach-file file description)))
+
+(symbol-function 'my-post-attach-file)
+
+(defun my-header-attach-file (file description)
+  "Attach a FILE to the current message (works with Mutt).
+Argument DESCRIPTION MIME description."
+  (interactive "fAttach file: \nsDescription: ")
+  (when (> (length file) 0)
+    (save-excursion
+      (save-match-data
+        (save-restriction
+          (widen)
+          (goto-char (point-min))
+          (search-forward-regexp "^$")
+          (insert (concat "Attach: " (replace-regexp-in-string "\\([[:space:]\\]\\)" "\\\\\\1" (file-truename file)) " "
+                          description "\n"))
+          (message (concat "Attached '" file "'."))
+          (setq post-has-attachment t))))))
+
+
 
 (setq mail-yank-prefix "> ")
 
@@ -369,6 +398,18 @@ Maildir, or by Message-ID."
 (add-hook 'post-mode-hook
          (auto-fill-mode nil)
          )
+; abbrev mode settings
+; load abbreviations from 
+(setq abbrev-file-name       
+      "~/.emacs_abbrev_def")
+
+; read the abbrev file if it exists
+(if (file-exists-p abbrev-file-name)
+    (quietly-read-abbrev-file))
+
+; for now, use abbrev mode everywhere
+(setq default-abbrev-mode t)
+
 
 (defun insert-function-documentation ()
   "Insert function documentation"