]> git.donarmstrong.com Git - lib.git/blobdiff - emacs_el/configuration/don-configuration.org
diminish message mode and fix attach file command
[lib.git] / emacs_el / configuration / don-configuration.org
index 372501df4a664bda55b865114c08f0cf0d858537..48f7dc8772dcf6bd0b18483c608258ce5137a617 100644 (file)
@@ -1079,44 +1079,44 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 #+BEGIN_SRC emacs-lisp
   (use-package message
     :ensure f
-    :diminish "✉"
-    :mode "muttng-[a-z0-9]+-[0-9]+-"
-    :mode "mutt-[a-z0-9]+-[0-9]+-"
+    :diminish (message "✉")
+    :mode ("muttng-[a-z0-9]+-[0-9]+-" . message-mode)
+    :mode ("mutt-[a-z0-9]+-[0-9]+-" . message-mode)
     :hook 'my/message-mode-settings
     :hook 'turn-on-flyspell
     :bind (:map message-mode-map
-               ("C-c C-a" . my/post-attach-file))
-    :config 
+        ("C-c C-a" . my/post-attach-file))
+    :delight (message-mode "✉")
+    :config
     (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))))
+                  '(("^[ \t]*>[ \t]*>[ \t]*>.*$"
+                 (0 'message-multiply-quoted-text-face))
+                ("^[ \t]*>[ \t]*>.*$"
+                 (0 'message-double-quoted-text-face))))
       )
 
     (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)))
+      (let ((file (read-file-name "Attach file: " nil nil t nil)))
+        (my/header-attach-file 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))))))
+    (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 "> ")
   )