From 8f6f8558e72ca99d9cd76904a5127b9f50fcce77 Mon Sep 17 00:00:00 2001 From: Lars Tveito Date: Fri, 3 Jan 2014 17:07:32 +0100 Subject: [PATCH] Mail and Matlab (and added a mac-specific setting). --- init.el | 41 +++++++++++++++++++++++++++++++++++++++ init.org | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) diff --git a/init.el b/init.el index c3368ed..873d76a 100644 --- a/init.el +++ b/init.el @@ -80,6 +80,10 @@ PACKAGE is installed and the current version is deleted." echo-keystrokes 0.1 ; Show keystrokes asap. ) +;; Some mac-bindings interfere with Emacs bindings. +(when (boundp 'mac-pass-command-to-system) + (setq mac-pass-command-to-system nil)) + (setq-default fill-column 76 ; Maximum line width. indent-tabs-mode nil ; Use spaces instead of tabs. split-width-threshold 100 ; Split verticly by default. @@ -177,6 +181,41 @@ PACKAGE is installed and the current version is deleted." calendar-longitude 10.7 calendar-location-name "Oslo, Norway") +(let ((load-mail-setup nil)) + (when load-mail-setup + ;; Dependent on both mu4e and smtpmail (for sending only). + (require 'mu4e) + (require 'smtpmail) + + ;; Some basic mu4e settings. + (setq mu4e-maildir "~/.ifimail" ; top-level Maildir + mu4e-sent-folder "/INBOX.Sent" ; folder for sent messages + mu4e-drafts-folder "/INBOX.Drafts" ; unfinished messages + mu4e-trash-folder "/INBOX.Trash" ; trashed messages + mu4e-refile-folder "/INBOX.Archive" ; saved messages + mu4e-get-mail-command "offlineimap" ; use offlineimap to fetch mail + mu4e-view-show-images t ; view images + mu4e-html2text-command + "html2text -utf8" ; use utf-8 + ) + + ;; Setup for sending mail. + (setq user-full-name + "Lars Tveito" ; Your full name + user-mail-address + "larstvei@ifi.uio.no" ; And email-address + smtpmail-smtp-server + "smtp.uio.no" ; Host to mail-server + smtpmail-smtp-service 465 ; Port to mail-server + smtpmail-stream-type 'ssl ; Protocol used for sending + send-mail-function 'smtpmail-send-it ; Use smpt to send + mail-user-agent 'mu4e-user-agent ; Use mu4e! + ) + + ;; Register file types that can be handled by ImageMagick. + (when (fboundp 'imagemagick-register-types) + (imagemagick-register-types)))) + (add-hook 'text-mode-hook 'turn-on-flyspell) (add-hook 'prog-mode-hook 'flyspell-prog-mode) @@ -342,3 +381,5 @@ PACKAGE is installed and the current version is deleted." (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode) (add-hook 'haskell-mode-hook 'turn-on-haskell-indent) + +(add-to-list 'auto-mode-alist '("\\.m$" . octave-mode)) diff --git a/init.org b/init.org index f1c5c90..37df177 100644 --- a/init.org +++ b/init.org @@ -147,6 +147,11 @@ doc-view-continuous t ; At page edge goto next/previous. echo-keystrokes 0.1 ; Show keystrokes asap. ) + + ;; Some mac-bindings interfere with Emacs bindings. + (when (boundp 'mac-pass-command-to-system) + (setq mac-pass-command-to-system nil)) + #+END_SRC Some variables are buffer-local, so changing them using =setq= will only @@ -357,6 +362,50 @@ calendar-location-name "Oslo, Norway") #+END_SRC +** Mail + + I use [[http://www.djcbsoftware.nl/code/mu/mu4e.html][mu4e]] (which is a part of [[http://www.djcbsoftware.nl/code/mu/][mu]]) along with [[http://docs.offlineimap.org/en/latest/][offlineimap]] on one of my + computers. Because the mail-setup wont work without these programs + installed we bind =load-mail-setup= to =nil=. If the value is changed to + a =non-nil= value mail is setup. + + #+BEGIN_SRC emacs-lisp :tangle yes + (let ((load-mail-setup nil)) + (when load-mail-setup + ;; Dependent on both mu4e and smtpmail (for sending only). + (require 'mu4e) + (require 'smtpmail) + + ;; Some basic mu4e settings. + (setq mu4e-maildir "~/.ifimail" ; top-level Maildir + mu4e-sent-folder "/INBOX.Sent" ; folder for sent messages + mu4e-drafts-folder "/INBOX.Drafts" ; unfinished messages + mu4e-trash-folder "/INBOX.Trash" ; trashed messages + mu4e-refile-folder "/INBOX.Archive" ; saved messages + mu4e-get-mail-command "offlineimap" ; use offlineimap to fetch mail + mu4e-view-show-images t ; view images + mu4e-html2text-command + "html2text -utf8" ; use utf-8 + ) + + ;; Setup for sending mail. + (setq user-full-name + "Lars Tveito" ; Your full name + user-mail-address + "larstvei@ifi.uio.no" ; And email-address + smtpmail-smtp-server + "smtp.uio.no" ; Host to mail-server + smtpmail-smtp-service 465 ; Port to mail-server + smtpmail-stream-type 'ssl ; Protocol used for sending + send-mail-function 'smtpmail-send-it ; Use smpt to send + mail-user-agent 'mu4e-user-agent ; Use mu4e! + ) + + ;; Register file types that can be handled by ImageMagick. + (when (fboundp 'imagemagick-register-types) + (imagemagick-register-types)))) + #+END_SRC + ** Flyspell Flyspell offers on-the-fly spell checking. We can enable flyspell for all @@ -729,3 +778,13 @@ (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode) (add-hook 'haskell-mode-hook 'turn-on-haskell-indent) #+END_SRC + +** Matlab + + Matlab is very similar to Octave, which is supported by Emacs. We just + need to let =.m=-files be associated with =octave-mode=. + + #+BEGIN_SRC emacs-lisp :tangle yes + (add-to-list 'auto-mode-alist '("\\.m$" . octave-mode)) + #+END_SRC +