emacs: Add mail encryption, fix some hooks.
Remove hard coded org-crypt key, fix dead keys input.
This commit is contained in:
parent
345c054448
commit
6987397142
3 changed files with 49 additions and 16 deletions
|
@ -90,6 +90,9 @@ in rec {
|
|||
;; Hook for when a frame is created with emacsclient
|
||||
;; see https://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Frames.html
|
||||
(add-hook 'after-make-frame-functions 'set-fonts)
|
||||
|
||||
;; Fix keyboard input of 'dead-keys'
|
||||
(require 'iso-transl)
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -2,17 +2,42 @@
|
|||
|
||||
with lib;
|
||||
|
||||
mkIf (elem "emacs::mu4e" config.machine.pkgs) {
|
||||
let
|
||||
defaultEncrypt = pkgs.emacsPackages.trivialBuild rec {
|
||||
pname = "defaultencrypt";
|
||||
version = "ba07acc8e9fd692534c39c7cdad0a19dc0d897d9";
|
||||
|
||||
src = pkgs.fetchFromGitLab {
|
||||
owner = "lechten";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "1ln7h1syx7yi7bqvirv90mk4rvwxg4zm1wvfcvhfh64s3hqrbfgl";
|
||||
};
|
||||
};
|
||||
in mkIf (elem "emacs::mu4e" config.machine.pkgs) {
|
||||
programs.emacs.init.usePackage.pinentry = {
|
||||
enable = true;
|
||||
command = [ "pinentry-start" ];
|
||||
hook = [ "(after-init . pinentry-start)" ];
|
||||
};
|
||||
|
||||
programs.emacs.init.usePackage.mu4e = {
|
||||
enable = true;
|
||||
package = epkgs: null;
|
||||
command = [ "mu4e" ];
|
||||
diminish = [ "mu4e-mode" ];
|
||||
hook = [
|
||||
"('mu4e-view-mode-hook #'visual-line-mode)"
|
||||
"('mu4e-compose-mode-hook 'flyspell-mode)"
|
||||
"(mu4e-view-mode . visual-line-mode)"
|
||||
"(mu4e-compose-mode . flyspell-mode)"
|
||||
''(message-send . (lambda ()
|
||||
(unless (yes-or-no-p "Send this message?")
|
||||
(signal 'quit nil))))''
|
||||
];
|
||||
bind = { "\t" = "'company-complete-common"; };
|
||||
init = ''
|
||||
(add-to-list 'load-path "${defaultEncrypt}/share/emacs/site-lisp")
|
||||
(require 'jl-encrypt)
|
||||
'';
|
||||
config = ''
|
||||
(setq mail-user-agent 'mu4e-user-agent)
|
||||
(setq org-mu4e-link-query-in-headers-mode t)
|
||||
|
@ -46,9 +71,12 @@ mkIf (elem "emacs::mu4e" config.machine.pkgs) {
|
|||
(imagemagick-register-types))
|
||||
(setq message-kill-buffer-on-exit t)
|
||||
|
||||
|
||||
;; Encryption Stuff
|
||||
(setq mml-secure-openpgp-sign-with-sender t)
|
||||
;; (setq mm-sign-option ‘guided’)
|
||||
(setq epa-pinentry-mode 'loopback)
|
||||
;; mailAcc config goes here
|
||||
|
||||
(load-file "~/.emacs.d/mu4e.el")
|
||||
|
||||
(defun my-browse-url-firefox-privately (url &optional new-window)
|
||||
"Make firefox open URL in private-browsing window."
|
||||
|
@ -64,21 +92,21 @@ mkIf (elem "emacs::mu4e" config.machine.pkgs) {
|
|||
'("ViewInBrowser" . mu4e-action-view-in-browser) t)
|
||||
'';
|
||||
extraConfig = ''
|
||||
:load-path ${pkgs.mu4e}/share/emacs/site-lisp/mu4e
|
||||
:load-path "${pkgs.mu}/share/emacs/site-lisp/mu4e"
|
||||
'';
|
||||
};
|
||||
|
||||
programs.emacs.init.usePackage.mu4e-alert = {
|
||||
enable = true;
|
||||
hook = [ "'after-init-hook #'mu4e-alert-enable-mode-line-display" ];
|
||||
# hook = [ "after-init . mu4e-alert-enable-mode-line-display" ];
|
||||
};
|
||||
|
||||
programs.emacs.init.usePackage.org-mu4e = {
|
||||
enable = (elem "emacs::org" config.machine.pkgs);
|
||||
};
|
||||
# programs.emacs.init.usePackage.org-mu4e = {
|
||||
# enable = (elem "emacs::org" config.machine.pkgs);
|
||||
# };
|
||||
|
||||
environment.systemPackages = [
|
||||
mu4e
|
||||
environment.systemPackages = with pkgs; [
|
||||
mu
|
||||
isync
|
||||
];
|
||||
}
|
||||
|
|
|
@ -399,17 +399,19 @@ mkIf (elem "emacs::org" config.machine.pkgs) {
|
|||
programs.emacs.init.usePackage.org-crypt = {
|
||||
enable = true;
|
||||
after = [ "org" ];
|
||||
hook = [ "(org-mode . (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t)))" ];
|
||||
command = [ "org-decrypt-entry" "org-encrypt-entry" ];
|
||||
bindLocal = { org-mode-map = {
|
||||
"C-c d" = "org-decrypt-entry";
|
||||
"C-c e" = "org-encrypt-entry";
|
||||
};};
|
||||
config = ''
|
||||
(org-crypt-use-before-save-magic)
|
||||
(setq org-tags-exclude-from-inheritance (quote ("crypt")))
|
||||
;; GPG key to use for encryption
|
||||
(setq org-crypt-key "BD9667B90757EAE9CDFE510A59A28744FE81FFEB")
|
||||
(load-file ~/.emacs.d/org-crypt-key.el)
|
||||
|
||||
;; don't ask to disable auto-save
|
||||
(setq org-crypt-disable-auto-save nil)
|
||||
(setq org-crypt-disable-auto-save "encrypt")
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue