]> git.donarmstrong.com Git - lib.git/blobdiff - emacs_el/configuration/don-configuration.org
fix message attachment
[lib.git] / emacs_el / configuration / don-configuration.org
index f3468a8c2ae9cd0c42f70d3108c188a644f0b4ae..d07925f1f3971a6bbed10f1fae8356fe2c08f5a4 100644 (file)
 ** [[https://github.com/jwiegley/use-package/][use-package]]
 #+BEGIN_SRC emacs-lisp
   (package-initialize)
-  (require 'use-package)
+  (condition-case nil
+      (require 'use-package)
+    (progn (package-install 'use-package)
+           (require 'use-package)))
 #+END_SRC
 ** Paradox
 #+BEGIN_SRC emacs-lisp
@@ -525,6 +528,17 @@ value, scrolling continues until there is no more output.
     (setq-default reftex-default-bibliography
                     '("~/projects/research/references.bib")))
 #+END_SRC
+** BibTex
+#+BEGIN_SRC emacs-lisp
+  (use-package bibtex
+    :config (setq bibtex-user-optional-fields
+                  (quote (("annote" "Personal annotation (ignored)")
+                          ("abstract" "")
+                  ("pmid" "")
+                  ("doi" ""))))
+    )
+
+#+END_SRC
 ** LaTeX
 #+BEGIN_SRC emacs-lisp
   (use-package tex
@@ -626,24 +640,12 @@ value, scrolling continues until there is no more output.
               ("fixme" "{"))
             )
       )
+    (setq font-latex-fontify-script nil)
+    (setq font-latex-fontify-sectioning (quote color))
+    (setq font-latex-script-display (quote (nil)))
   )
 
 #+END_SRC
-*** Org-Gcal
-#+BEGIN_SRC emacs-lisp
-  (use-package calfw
-    :ensure f
-    )
-  (use-package calfw-org
-    :ensure f
-    )
-  (use-package org-gcal
-    :ensure f
-    :config '((if (file-readable-p "~/.hide/org_gcal.el")
-                  (load-file "~/.hide/org_gcal.el"))
-              )
-    )
-#+END_SRC
 ** ESS
 #+BEGIN_SRC emacs-lisp
   (use-package ess
@@ -761,6 +763,71 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
           '(("template-toolkit" . "\\.tmpl\\'")))
     )
 #+END_SRC
+* Email
+** Message Mode
+#+BEGIN_SRC emacs-lisp
+  (use-package post
+    :config
+    (setq post-email-address "don@donarmstrong.com")
+    (setq post-kill-quoted-sig nil)
+    (setq post-mail-message "mutt\\(ng\\|\\)-[a-z0-9]+-[0-9]+-.*")
+    (setq post-uses-fill-mode nil)
+    )
+#+END_SRC
+** Mutt
+*** Message-mode
+#+BEGIN_SRC emacs-lisp
+  (use-package message-mode
+
+    :mode "muttng-[a-z0-9]+-[0-9]+-"
+    :mode "mutt-[a-z0-9]+-[0-9]+-"
+    :hook 'my/message-mode-settings
+    :hook 'turn-on-flyspell
+    :bind (:map message-mode-map
+                ("C-c C-a" . my/post-attach-file))
+    :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))))
+      )
+
+    (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)))
+
+    (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 "> ")
+  )
+#+END_SRC
+*** Muttrc mode
+#+BEGIN_SRC emacs-lisp
+  (use-package muttrc-mode
+    :mode "muttngrc"
+    :mode "muttrc"
+  )
+
+#+END_SRC
 * Org Mode
 ** Use-package and load things
 #+BEGIN_SRC emacs-lisp
@@ -1674,6 +1741,21 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
             (unless (bolp) (insert "\n"))))))))))))
 
 #+END_SRC
+** Org-Gcal
+#+BEGIN_SRC emacs-lisp
+  (use-package calfw
+    :ensure f
+    )
+  (use-package calfw-org
+    :ensure f
+    )
+  (use-package org-gcal
+    :ensure f
+    :config '((if (file-readable-p "~/.hide/org_gcal.el")
+                  (load-file "~/.hide/org_gcal.el"))
+              )
+    )
+#+END_SRC
 ** End use-package
 #+BEGIN_SRC emacs-lisp
   )
@@ -1715,7 +1797,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 #+END_SRC
 * Misc (uncharacterized)
 #+BEGIN_SRC emacs-lisp
-  (setq bibtex-user-optional-fields (quote (("annote" "Personal annotation (ignored)") ("abstract" "") ("pmid" "") ("doi" ""))))
   (setq calendar-latitude 40.11)
   (setq calendar-longitude -88.24)
   (setq case-fold-search t)
@@ -1726,9 +1807,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
   (setq display-time-24hr-format t)
   (setq display-time-day-and-date t)
   (display-time-mode 1)
-  (setq font-latex-fontify-script nil)
-  (setq font-latex-fontify-sectioning (quote color))
-  (setq font-latex-script-display (quote (nil)))
   (global-auto-revert-mode 1)
   (global-font-lock-mode 1)
   (icomplete-mode 1)
@@ -1737,10 +1815,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
   (setq markdown-enable-math t)
   (setq markdown-follow-wiki-link-on-enter nil)
   (setq mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases")))
-  (setq post-email-address "don@donarmstrong.com")
-  (setq post-kill-quoted-sig nil)
-  (setq post-mail-message "mutt\\(ng\\|\\)-[a-z0-9]+-[0-9]+-.*")
-  (setq post-uses-fill-mode nil)
   (setq ps-footer-font-size (quote (8 . 10)))
   (setq ps-header-font-size (quote (8 . 10)))
   (setq ps-header-title-font-size (quote (10 . 10)))
@@ -1772,17 +1846,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 
   (require 'vcl-mode)
 
-  (require 'tex-site)
-  ;;(require 'psvn)
-  ;;(require 'ecasound)
-  ;;(require 'emacs-wiki)
-  (require 'bibtex)
-  (require 'post)
-  ;;(require 'fixme)
-  ; (require 'google-weather)
-  ; (require 'org-google-weather)
-  ; (setq-default org-google-weather-format "%i %c, [%l,%h] %s %C")
-  
   (global-set-key "\C-xp" 'server-edit)
 
   (setq-default auto-mode-alist (cons '("\.wml$" . 
@@ -1798,51 +1861,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
   ;; tramp configuration
   (setq tramp-use-ssh-controlmaster-options nil)
 
-  ; mail configuration
-  (add-to-list 'auto-mode-alist '("muttng-[a-z0-9]+-[0-9]+-" . message-mode))
-  (add-to-list 'auto-mode-alist '("muttngrc" . muttrc-mode))
-
-  (add-to-list 'auto-mode-alist '("mutt-[a-z0-9]+-[0-9]+-" . message-mode))
-  (add-to-list 'auto-mode-alist '("muttrc" . muttrc-mode))
-  (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 "> ")
-
   ;; self-insert-command hack.
   ;;   Without this, "if<SP>" expands to
   ;;   if ( -!-) {
@@ -1888,8 +1906,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 
   (column-number-mode t)
 
-  (server-start)
-
   ; (require 'mode-compile)
 
   (defadvice server-process-filter (after post-mode-message first activate)
@@ -2166,6 +2182,14 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 
 #+END_SRC
 
+* Server
+#+BEGIN_SRC emacs-lisp
+  (unless (server-running-p)
+  (server-start))
+#+END_SRC
+
+
+
 * END
 #+BEGIN_SRC emacs-lisp
   (provide 'don-configuration)