From e655b1433dda60ae4e1b070c95763ef1d0359f36 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Mon, 22 May 2017 11:13:56 +0200 Subject: [PATCH] Emacs: Use 'with-editor-mode' for Mutt messages, move to text area in mail-mode --- .emacs.d/lisp/main.el | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/.emacs.d/lisp/main.el b/.emacs.d/lisp/main.el index bf616499..32178697 100644 --- a/.emacs.d/lisp/main.el +++ b/.emacs.d/lisp/main.el @@ -210,17 +210,6 @@ (setq calendar-week-start-day 1) (setq calendar-date-style 'iso) -;; Remove auto-fill in web edits because wikis and forums do not like it. -;; This works for qutebrowser, but may need changes for other browsers. -(add-hook - 'find-file-hook - (lambda () - (when (string-match (concat (getenv "BROWSER") "-editor-*") (buffer-name)) - (when (require 'with-editor nil t) - ;; Just like git commits. - (with-editor-mode)) - (auto-fill-mode -1)))) - ;; Compilation bindings and conveniences. (setq compilation-ask-about-save nil) (eval-after-load 'compile @@ -301,8 +290,26 @@ (lambda () (setq indent-tabs-mode nil))) +;; Remove auto-fill in web edits because wikis and forums do not like it. +;; This works for qutebrowser, but may need changes for other browsers. +(add-hook + 'find-file-hook + (lambda () + (when (string-match (concat (getenv "BROWSER") "-editor-*") (buffer-name)) + (when (require 'with-editor nil t) + ;; Just like git commits. + (with-editor-mode)) + (auto-fill-mode -1)))) + ;; Mutt support. -(add-to-list 'auto-mode-alist '("/tmp/mutt.*" . mail-mode)) +(add-to-list 'auto-mode-alist '("/tmp/mutt-.*" . mail-mode)) +(add-hook + 'find-file-hook + (lambda () + (when (and (string-match "/tmp/mutt-.*" (buffer-file-name)) + (require 'with-editor nil t)) + ;; Just like git commits. + (with-editor-mode)))) ;; Arch Linux PKGBUILD. (add-to-list 'auto-mode-alist '("PKGBUILD" . sh-mode)) @@ -310,6 +317,10 @@ ;; Subtitles support. (add-to-list 'auto-mode-alist '("\\.srt\\'" . text-mode)) +(add-hook + 'mail-mode-hook + 'mail-text) + ;; Easy code folding toggle. ; (add-hook 'prog-mode-hook 'hs-minor-mode) ; (add-hook 'prog-mode-hook (lambda () (local-set-key (kbd "C-c h") 'hs-toggle-hiding)))