Skip to content

Latest commit

 

History

History
245 lines (196 loc) · 5.43 KB

post-custom.org

File metadata and controls

245 lines (196 loc) · 5.43 KB

Emacs Early Init

Literate configuration for post-custom.el.

Table of Contents

Header

;;; post-custom.el --- Emacs customization -*- lexical-binding: t -*-

;; Copyright (c) 2022 mattiasdrp and contributors.

;; Author: mattiasdrp
;; Maintainer: mattiasdrp <https://github.com/mattiasdrp>
;; Created: 17 august 2022
;; Version: 1.0
;; Licence: MIT
;; Keywords: emacs, init, convenience, configuration
;; URL: https://github.com/mattiasdrp/pokemacs

  ;;; Commentary:
;; This file will be loaded when emacs has finished initializing everything
;; and allows to override some bindings and behaviours that are not
;; controlled by custom.el

;;; Code:

Mail, gpg et al

Mu4e

Based on this tutorial. For WSL see this

  • Create directories for your mails
    .maildir
    ├── acc1
    ├── acc2
    └── acc3
        
  • Install mu4e from the latest release.
  • Fill a .mbsyncrc with the following fields (for each account):
    IMAPAccount acc
    Host imap.mail.me.com
    User imap-user
    PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/mu4e/.mbsyncpass-acc.gpg"
    Port 993
    SSLType IMAPS
    SSLVersions TLSv1.2
    AuthMechs PLAIN
    SystemCertificates no
    CertificateFile /etc/ssl/certs/ca-certificates.crt
    
    IMAPStore acc-remote
    Account acc
    
    MaildirStore acc-local
    SubFolders Verbatim
    Path ~/.maildir/acc/
    Inbox ~/.maildir/acc/INBOX
    
    Channel acc
    Far :acc-remote:
    Near :acc-local:
    Patterns *
    Create Near
    Sync All
    Expunge Both
    SyncState *
        
  • To create .mbsyncpass-acc.gpg store your password in .mbsyncpass-acc and encrypt with gpg2 -c .mbsyncpass-acc before removing the original file.
  • Synchronise all your mails with mbsync -aV
  • Initialise mu4e with
    mu init -m ~/.maildir \
       --my-address [email protected] \
       --my-address [email protected] \
       --my-address [email protected]
        
  • Create the index with mu index
  • Fill a .msmtprc with the following fields (for each account):
    # Set default values for all the accounts.
    defaults
    logfile ~/.maildir/msmtp.log
    tls_trust_file /etc/ssl/certs/ca-certificates.crt
    
    # ======================================================================
    
    account acc
    auth on
    host smtp.mail.me.com
    port 465
    protocol smtp
    from [email protected]
    user smtp-login
    passwordeval "gpg2 -q --for-your-eyes-only --no-tty -d ~/mu4e/.mbsyncpass-acc.gpg"
    tls on
    tls_starttls off
        
(when use-mu4e
  (use-package smtpmail
    :ensure nil
    :ensure-system-package msmtp))

;; (load-file (expand-file-name "~/mu4e/mu4e.el"))

Keybindings

Unbinding

You can unbind anything you want.

Globally

;; (general-unbind
;;   "C-o"
;;   )

Locally to a keymap

(notice the quote before the name of the map)

;; (general-unbind
;;   :keymaps 'tuareg-mode-map
;;   "C-c TAB"
;;   )

Binding

You can bind anything you want.

Globally

;; (general-define-key
;;  "C-x 1"                 'delete-other-windows
;;  )

Grouped under a prefix, allowing to define multiple keybindings under the same prefix without having to rewrite the prefix.

;; (general-define-key
;;  :prefix "M-z"
;;  "w"                       'mdrp/resize-window-width
;;  "h"                       'mdrp/resize-window-height)

Locally

(notice the quote before the name of the map)

;; (general-define-key
;;  :keymaps 'tuareg-mode-map
;;  "C-x M-1"                 'delete-other-windows
;;  )

You can obviously combine :keymaps and :prefix

End

(provide 'post-custom)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; post-custom.el ends here