From 83f5c247fee3ac5c5739fafd4e3e38b4fab41d0a Mon Sep 17 00:00:00 2001 From: larstvei Date: Sat, 4 Jan 2014 05:02:41 +0100 Subject: [PATCH] Added some bindings and added an advise to mu4e. --- init.el | 20 ++++++++++++++++---- init.org | 40 ++++++++++++++++++++++++++++------------ 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/init.el b/init.el index 873d76a..ef8685b 100644 --- a/init.el +++ b/init.el @@ -214,7 +214,11 @@ PACKAGE is installed and the current version is deleted." ;; Register file types that can be handled by ImageMagick. (when (fboundp 'imagemagick-register-types) - (imagemagick-register-types)))) + (imagemagick-register-types)) + + ;; Overwrite the native 'compose-mail' binding to 'mu4e'. + (global-set-key (kbd "C-x m") 'mu4e) + )) (add-hook 'text-mode-hook 'turn-on-flyspell) @@ -267,6 +271,13 @@ PACKAGE is installed and the current version is deleted." (whitespace-cleanup) (untabify beg (if (< end (point-max)) end (point-max))))) +(defadvice mu4e (after show-only-mu4e (background) activate) + "When evoking the mu4e command, delete all other windows. If + BACKGROUND is non-nil we don't want to change the functions + behaviour." + (unless background + (delete-other-windows))) + (global-set-key (kbd "C-'") 'er/expand-region) (global-set-key (kbd "C-;") 'er/contract-region) @@ -278,6 +289,10 @@ PACKAGE is installed and the current version is deleted." (global-set-key (kbd "C-c SPC") 'ace-jump-mode) +(global-set-key (kbd "") 'move-text-up) +(global-set-key (kbd "") 'move-text-down) + +(global-set-key (kbd "C-c s") 'ispell-word) (global-set-key (kbd "C-c t") 'org-agenda-list) (global-set-key (kbd "C-x k") 'kill-this-buffer) (global-set-key (kbd "C-x C-r") 'recentf-ido-find-file) @@ -287,9 +302,6 @@ PACKAGE is installed and the current version is deleted." (global-set-key (kbd "C-c d") 'duplicate-thing) (global-set-key (kbd "") 'tidy) -(global-set-key (kbd "") 'move-text-up) -(global-set-key (kbd "") 'move-text-down) - (defadvice eval-last-sexp (around replace-sexp (arg) activate) "Replace sexp when called with a prefix argument." (if arg diff --git a/init.org b/init.org index 37df177..b0e20be 100644 --- a/init.org +++ b/init.org @@ -375,7 +375,7 @@ ;; 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 @@ -387,7 +387,7 @@ mu4e-html2text-command "html2text -utf8" ; use utf-8 ) - + ;; Setup for sending mail. (setq user-full-name "Lars Tveito" ; Your full name @@ -400,10 +400,14 @@ 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)))) + (imagemagick-register-types)) + + ;; Overwrite the native 'compose-mail' binding to 'mu4e'. + (global-set-key (kbd "C-x m") 'mu4e) + )) #+END_SRC ** Flyspell @@ -510,6 +514,18 @@ (untabify beg (if (< end (point-max)) end (point-max))))) #+END_SRC + When browsing mail with =mu4e= I find it best not to have other windows + visible. + + #+BEGIN_SRC emacs-lisp :tangle yes + (defadvice mu4e (after show-only-mu4e (background) activate) + "When evoking the mu4e command, delete all other windows. If + BACKGROUND is non-nil we don't want to change the functions + behaviour." + (unless background + (delete-other-windows))) + #+END_SRC + ** Key bindings Bindings for [[https://github.com/magnars/expand-region.el][expand-region]]. @@ -539,9 +555,17 @@ (global-set-key (kbd "C-c SPC") 'ace-jump-mode) #+END_SRC + Bindings for =move-text=. + + #+BEGIN_SRC emacs-lisp :tangle yes + (global-set-key (kbd "") 'move-text-up) + (global-set-key (kbd "") 'move-text-down) + #+END_SRC + Bind some native Emacs functions. #+BEGIN_SRC emacs-lisp :tangle yes + (global-set-key (kbd "C-c s") 'ispell-word) (global-set-key (kbd "C-c t") 'org-agenda-list) (global-set-key (kbd "C-x k") 'kill-this-buffer) (global-set-key (kbd "C-x C-r") 'recentf-ido-find-file) @@ -556,13 +580,6 @@ (global-set-key (kbd "") 'tidy) #+END_SRC - Bindings for =move-text=. - - #+BEGIN_SRC emacs-lisp :tangle yes - (global-set-key (kbd "") 'move-text-up) - (global-set-key (kbd "") 'move-text-down) - #+END_SRC - ** Advice An advice can be given to a function to make it behave differently. This @@ -787,4 +804,3 @@ #+BEGIN_SRC emacs-lisp :tangle yes (add-to-list 'auto-mode-alist '("\\.m$" . octave-mode)) #+END_SRC -