Added all sorts of things
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>
Tue, 26 May 2015 20:24:54 +0000 (22:24 +0200)
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>
Tue, 26 May 2015 20:24:54 +0000 (22:24 +0200)
.wl

diff --git a/.wl b/.wl
index c536e88..3a6c6be 100644 (file)
--- a/.wl
+++ b/.wl
       wl-summary-width 120
       mime-pgp-decrypt-when-preview t
       )
+(defun wl-display-math ()
+  "Toggle display of math in buffer"
+  (interactive)
+  (let ((inhibit-read-only t))
+    (latex-math-preview-all-formulae)))
+(defun wl-hide-math ()
+  "Toggle display of math in buffer"
+  (interactive)
+  (let ((inhibit-read-only t))
+    (latex-math-preview-remove-images)))
+
+
 (add-hook 'mime-view-mode-hook
-         '(lambda ()   (local-set-key (kbd "ä") 'wl-next-message)
-            (local-set-key (kbd "ö") 'wl-prev-message))
-         )
+         '(lambda () (local-set-key (kbd "ä") 'wl-next-message)
+            (local-set-key (kbd "ö") 'wl-prev-message)
+            (local-set-key (kbd "m") 'wl-display-math)
+            (local-set-key (kbd "h") 'wl-hide-math)
+            (local-set-key (kbd "d") '(lambda ()
+                                        (interactive)
+                                        (mime-preview-quit)
+                                        (wl-summary-dispose)))
+            (local-set-key (kbd "f") '(lambda ()
+                                        (interactive)
+                                        (mime-preview-quit)
+                                        (wl-summary-forward)))
+
+            ))
 (setq mime-edit-insert-user-agent-field nil)
 
 (setq wl-generate-mailer-string-function
           (wl-summary-mode (decrypt . mc-wl-decrypt-message)
             (verify . mc-wl-verify-signature))))
         mc-modes-alist)))
+(defun wl-summary-click-on-message ()
+  (interactive) (wl-summary-redisplay)
+  (wl-summary-jump-to-current-message)
+  (delete-other-windows))
 (add-hook 'wl-summary-mode-hook
          ;; Set keybindings for
          ;; PGP-Inline
@@ -64,9 +91,7 @@
             (local-set-key "0" 'mc-wl-verify-signature)
             (local-set-key (kbd "ä") 'wl-next-message)
             (local-set-key (kbd "ö") 'wl-prev-message)
-            (local-set-key (kbd "<return>") '(lambda () (interactive) (wl-summary-redisplay)
-                                               (wl-summary-jump-to-current-message)
-                                               (delete-other-windows)) )
+            (local-set-key (kbd "<return>") 'wl-summary-click-on-message )
             (local-set-key "X" '(lambda ()
                                        ; checks for mail remotely using rsync.
                                   (interactive)
@@ -118,7 +143,7 @@ message is sent, it adds the user's signature."
   (if  (string-match-p "\\*draft\\*.*" (buffer-name))
       (progn
        (setq enc-color (face-remap-add-relative 'mode-line :background "dark red"))
-       (set-input-method "TeX")
+;      (set-input-method "TeX")
        (auto-fill-mode)
        (setq default-justification 'full)
        (sm-add-microsoft)
@@ -133,6 +158,8 @@ message is sent, it adds the user's signature."
                                        (face-remap-remove-relative enc-color)
                                        ))
        (local-set-key (kbd "C-c s") 'ispell-message)
+       (local-set-key (kbd "C-c m s") 'wl-display-math)
+       (local-set-key (kbd "C-c m h") 'wl-hide-math)
        (local-set-key (kbd "C-c c") '(lambda ()
                                      ;;; save email to queue and send it using SSH.
                                        (interactive)
@@ -165,27 +192,28 @@ message is sent, it adds the user's signature."
   (delete-other-windows)
   )
 (defun wl-delete-other-windows ()
-    (wl-summary-jump-to-current-message)
+;    (wl-summary-jump-to-current-message)
   (delete-other-windows)
 )
 (defadvice wl-summary-next  (after wl-summary-next activate)
+  ;; Prevent message window from appearing when you mark a message
   (wl-delete-other-windows)
   )
 (defadvice wl-summary-prev (after wl-summary-prev activate)
   (wl-delete-other-windows)
   )
 (defun wl-next-message ()
+  "Jump to next message and open it"
   (interactive)
-  (if (string= (buffer-name) "Summary")
+  (unless (string= (buffer-name) "Summary")
+      (mime-preview-quit))
       (wl-summary-next)
-    (progn
-      (mime-preview-quit)
-      (wl-summary-next))))
+      (wl-summary-click-on-message))
 (defun wl-prev-message ()
+  "Jump to previous message and open it"
   (interactive)
-  (if (string= (buffer-name) "Summary")
-      (wl-summary-prev)
-    (progn
-      (mime-preview-quit)
-      (wl-summary-prev))))    
-    
+  (unless (string= (buffer-name) "Summary")
+      (mime-preview-quit))
+  (wl-summary-prev)
+  (wl-summary-click-on-message))
+(load "~/.emacs.d/lisp/latex-math-preview.el")