diff options
| author | Miquel Sabaté Solà <msabate@suse.com> | 2017-01-13 12:05:39 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <msabate@suse.com> | 2017-01-13 12:05:39 +0100 |
| commit | 2aa031d0a09882408e29de0f7ed67f1843d0b9f6 (patch) | |
| tree | e747125260c4852a70054129983085dff42ac555 /emacs | |
| parent | 82cd521a3410f93ea52b063c7f05b60ea17b8ce6 (diff) | |
| download | dotfiles-2aa031d0a09882408e29de0f7ed67f1843d0b9f6.tar.gz dotfiles-2aa031d0a09882408e29de0f7ed67f1843d0b9f6.zip | |
emacs: improved the dired configuration
Now I will be able to attach documents into mu4e from dired mode.
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'emacs')
| -rw-r--r-- | emacs/init.el | 1 | ||||
| -rw-r--r-- | emacs/settings/init-dired.el | 49 | ||||
| -rw-r--r-- | emacs/settings/init-misc.el | 5 |
3 files changed, 50 insertions, 5 deletions
diff --git a/emacs/init.el b/emacs/init.el index f34c9b6..42c8f52 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -91,6 +91,7 @@ (require 'init-project) (require 'init-edit) (require 'init-misc) +(require 'init-dired) (require 'init-evil) (require 'init-magit) (require 'init-mu4e) diff --git a/emacs/settings/init-dired.el b/emacs/settings/init-dired.el new file mode 100644 index 0000000..55271aa --- /dev/null +++ b/emacs/settings/init-dired.el @@ -0,0 +1,49 @@ +;;; init-dired.el --- Dired mode configuration + +;; Copyright (C) 2017 Miquel Sabaté Solà <mikisabate@gmail.com> +;; +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;;; Commentary: +;; +;; Set of settings for dired mode. + +; Add basic evil movement. +(with-eval-after-load 'evil + (evil-add-hjkl-bindings dired-mode-map 'normal + (kbd "w") 'evil-forward-word-begin)) + +; Allow dired mode to attach files to mu4e. Taken from: +; https://www.djcbsoftware.nl/code/mu/mu4e/Dired.html#Dired. +; With this, you will need to type C-c RET C-a, in order to attach the file +; pointed by the cursor. + +(require 'gnus-dired) + +;; Make the `gnus-dired-mail-buffers' function also work on message-mode derived +;; modes, such as mu4e-compose-mode. +(defun gnus-dired-mail-buffers () + "Return a list of active message buffers." + + (let (buffers) + (save-current-buffer + (dolist (buffer (buffer-list t)) + (set-buffer buffer) + (when (and (derived-mode-p 'message-mode) + (null message-sent-message-via)) + (push (buffer-name buffer) buffers)))) + (nreverse buffers))) + +(setq gnus-dired-mail-mode 'mu4e-user-agent) +(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode) + +(provide 'init-dired) +;;; init-dired.el ends here diff --git a/emacs/settings/init-misc.el b/emacs/settings/init-misc.el index b95489b..04eb84a 100644 --- a/emacs/settings/init-misc.el +++ b/emacs/settings/init-misc.el @@ -30,10 +30,5 @@ ("C-c i" . crux-find-user-init-file) ("C-c o" . crux-open-with))) -;; Dired -(with-eval-after-load 'evil - (evil-add-hjkl-bindings dired-mode-map 'normal - (kbd "w") 'evil-forward-word-begin)) - (provide 'init-misc) ;;; init-misc.el ends here |
