system-manager-wakasu
1;;; consult-mu-compose-embark.el --- Emabrk Actions for consult-mu-compose -*- lexical-binding: t -*-
2
3;; Copyright (C) 2021-2023
4
5;; Author: Armin Darvish
6;; Maintainer: Armin Darvish
7;; Created: 2023
8;; Version: 1.0
9;; Package-Requires: ((emacs "28.0") (consult "2.0"))
10;; Homepage: https://github.com/armindarvish/consult-mu
11;; Keywords: convenience, matching, tools, email
12;; Homepage: https://github.com/armindarvish/consult-mu
13
14;; SPDX-License-Identifier: GPL-3.0-or-later
15
16;; This file is free software: you can redistribute it and/or modify
17;; it under the terms of the GNU General Public License as published
18;; by the Free Software Foundation, either version 3 of the License,
19;; or (at your option) any later version.
20;;
21;; This file is distributed in the hope that it will be useful,
22;; but WITHOUT ANY WARRANTY; without even the implied warranty of
23;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24;; GNU General Public License for more details.
25;;
26;; You should have received a copy of the GNU General Public License
27;; along with this file. If not, see <https://www.gnu.org/licenses/>.
28
29
30;;; Commentary:
31
32;; This package provides an alternative interactive serach interface for
33;; mu and mu4e (see URL `https://djcbsoftware.nl/code/mu/mu4e.html').
34;; It uses a consult-based minibuffer completion for searching and
35;; selecting, and marking emails, as well as additional utilities for
36;; composing emails and more.
37
38;; This package requires mu4e version "1.10.8" or later.
39
40
41;;; Code:
42
43;;; Requirements
44(require 'embark)
45(require 'consult-mu)
46(require 'consult-mu-embark)
47
48(defun consult-mu-compose-embark-attach-file (cand)
49 "Run `consult-mu-attach-files' on CAND."
50 (funcall (apply-partially #'consult-mu-compose-attach cand)))
51
52;;; add consult-mu-attach to embark-file-map
53(defun consult-mu-compose-embark-bind-attach-file-key (&optional key)
54 "Binds `consult-mu-embark-attach-file-key'.
55
56Bind `consult-mu-embark-attach-file-key' to
57`consult-mu-compose-embark-attach-file' in `embark-file-map'. If KEY is
58non-nil binds KEY instead of `consult-mu-embark-attach-file-key'."
59 (if-let ((keyb (or key (kbd consult-mu-embark-attach-file-key))))
60 (define-key embark-file-map keyb #'consult-mu-compose-embark-attach-file)))
61
62(consult-mu-compose-embark-bind-attach-file-key)
63
64;; change the default action on `consult-mu-contacts category.
65(add-to-list 'embark-default-action-overrides '((file . consult-mu-compose--read-file-attach) . consult-mu-compose-attach))
66(add-to-list 'embark-default-action-overrides '((file . consult-mu-compose-attach) . consult-mu-compose-attach))
67
68;;; Provide `consult-mu-compose-embark' module
69
70(provide 'consult-mu-compose-embark)
71
72;;; consult-mu-compose-embark.el ends here