Browse Source

mu4e, smtpmail, python, org-mode-hook

ubuntu
parent
commit
39cbcd6f7f
1 changed files with 159 additions and 31 deletions
  1. +159
    -31
      .emacs

+ 159
- 31
.emacs View File

@ -93,7 +93,6 @@
(setq dashboard-banner-logo-title "Welcome gMarx")
(setq dashboard-set-file-icons t)
(setq dashboard-set-init-info t)
(add-to-list 'dashboard-items '(agenda) t)
(setq dashboard-startup-banner 'logo)
)
:config
@ -138,7 +137,7 @@
;; Use pdf-tools to open PDF files
(setq TeX-view-program-selection '((output-pdf "PDF Tools"))
TeX-source-correlate-start-server t)
(add-hook 'LaTeX-mode-hook 'pdf-view-mode)
(add-to-list 'auto-mode-alist '("\\.pff\\'" . pdf-view-mode))
;; Update PDF buffers after successful LaTeX runs
(add-hook 'TeX-after-compilation-finished-functions
#'TeX-revert-document-buffer)
@ -157,33 +156,48 @@
:ensure t
:init
(setq org-support-shift-select t)
:config
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
:hook
(org-mode . org-bullets-mode))
;; org configuration:
(setq org-agenda-files '("~/beorg/phd.org" "~/beorg/students.org" "~/beorg/inbox.org" "~/beorg/academia.org"))
(add-hook 'org-mode-hook
(lambda()
;; dictionary
(ispell-dictionary "en")
(setq org-image-actual-width nil)
(setq org-format-latex-options (plist-put org-format-latex-options :scale 1.5))
(setq org-latex-create-formula-image-program 'imagemagick)
(setq org-startup-indented t) ; Enable `org-indent-mode' by default
(add-hook 'org-mode-hook 'visual-line-mode)
))
;; Company-mode
(use-package company
:ensure t
:init
(add-hook 'after-init-hook 'global-company-mode))
;; ispell
(dolist (hook '(org-mode-hook latex-mode-hook tex-mode-hook git-commit-mode-hook))
(add-hook hook (lambda () (flyspell-mode 1))))
(setq ispell-dictionary "english")
;;(dolist (hook '(org-mode-hook latex-mode-hook tex-mode-hook git-commit-mode-hook))
;; (add-hook hook (lambda () (flyspell-mode 1))))
(setq ispell-dictionary "en")
(setq ispell-program-name "/usr/local/bin/aspell")
;; Set default font:
(add-to-list 'default-frame-alist
'(font . "Source Code Pro-18"))
;; Activatiin ORG-mode
;; Activation org-agenda and capture
(global-set-key (kbd "C-c l") 'org-store-link)
(global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c c") 'org-capture)
;;++++++++++
;; sentence one space definition
(setq sentence-end-double-space nil)
;;---------
;; Todo states for ORG:
(setq org-todo-keywords
(setq org-todo-keywords
(quote
((sequence "TODO(t)" "PROGRESS(g)" "PAUSE(p)" "CHECK(k)" "|" "DONE(d)" "CANCELED(c)"))))
(setq org-todo-keyword-faces
(setq org-todo-keyword-faces
'(("PROGRESS" . "orange") ("PAUSE" . "magenta") ("CHECK" . "purple") ("CANCELED" . "red") ("DONE" . "green")))
;; capture:
;; capture:
(setq org-capture-templates
(quote (
("a" ; hotkey
@ -227,34 +241,148 @@
"* %^{what solves}\n%^{the commands are}"
)
)))
;;-------end capture
;;=======
;;python
(use-package virtualenvwrapper
:ensure t
:config
(setq python-shell-interpreter "python3")
(setq venv-location "~/.virtualenvs"))
;; mu4e
(use-package mu4e
:commands (mu4e)
:init
;;(progn (require 'helm-mu))
:config
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu/mu4e")
(setq mu4e-mu-binary "/usr/local/bin/mu"))
;;-+-+-+-+-+-+-+-+-+-+-+-+
;; "default" parameters from Gmail
(setq user-full-name "Gerardo Marx Chávez-Campos") ;;user
(setq mu4e-compose-signature t) ;; signature in file ~/.signature
(add-hook 'mu4e-compose-mode-hook 'flyspell-mode(setq ispell-local-dictionary "castellano")) ;; spell check
;; attempt to show images when viewing messages
(setq mu4e-view-show-images t)
(setq mu4e-sent-folder "/Gmail/sent"
;; mu4e-sent-messages-behavior 'delete ;; Unsure how this should be configured
mu4e-drafts-folder "/Gmail/drafts"
user-mail-address "gmarx_cc@itmorelia.edu.mx"
smtpmail-local-domain "gmail.com"
smtpmail-default-smtp-server "smtp.gmail.com"
smtpmail-stream-type 'starttls
smtpmail-smtp-server "smtp.gmail.com"
smtpmail-smtp-service 587)
;; ---
;; Now I set a list of
(defvar my-mu4e-account-alist
'(("Gmail"
(mu4e-sent-folder "/Gmail/sent")
(mu4e-drafts-folder "/Gmail/drafts")
(user-mail-address "gmarx_cc@itmorelia.edu.mx")
(smtpmail-smtp-user "gmarx_cc@itmorelia.edu.mx")
(smtpmail-local-domain "gmail.com")
(smtpmail-default-smtp-server "smtp.gmail.com")
(smtpmail-stream-type starttls)
(smtpmail-smtp-server "smtp.gmail.com")
(smtpmail-smtp-service 587)
)
;; Include any other accounts here ...
("Exchange"
(mu4e-sent-folder "/Exchange/sent")
(mu4e-drafts-folder "/Exchange/drafts")
(user-mail-address "gerardo.cc@morelia.tecnm.mx")
(smtpmail-smtp-user "gerardo.cc@morelia.tecnm.mx")
(smtpmail-local-domain "office365.com")
(smtpmail-default-smtp-server "smtp.office365.com")
(smtpmail-stream-type starttls)
(smtpmail-smtp-server "smtp.office365.com")
(smtpmail-smtp-service 587)
)
;;
;; hotmail
("Hotmail"
(mu4e-sent-folder "/Hotmail/sent")
(mu4e-drafts-folder "/Hotmail/drafts")
(user-mail-address "gmarx_cc@hotmail.com")
(smtpmail-smtp-user "gmarx_cc@hotmail.com")
(smtpmail-local-domain "office365.com")
(smtpmail-default-smtp-server "smtp.office365.com")
(smtpmail-stream-type starttls)
(smtpmail-smtp-server "smtp.office365.com")
(smtpmail-smtp-service 25)
)
))
;; ---
(defun my-mu4e-set-account ()
"Set the account for composing a message.
This function is taken from:
https://www.djcbsoftware.nl/code/mu/mu4e/Multiple-accounts.html"
(let* ((account
(if mu4e-compose-parent-message
(let ((maildir (mu4e-message-field mu4e-compose-parent-message :maildir)))
(string-match "/\\(.*?\\)/" maildir)
(match-string 1 maildir))
(completing-read (format "Compose with account: (%s) "
(mapconcat #'(lambda (var) (car var))
my-mu4e-account-alist "/"))
(mapcar #'(lambda (var) (car var)) my-mu4e-account-alist)
nil t nil nil (caar my-mu4e-account-alist))))
(account-vars (cdr (assoc account my-mu4e-account-alist))))
(if account-vars
(mapc #'(lambda (var)
(set (car var) (cadr var)))
account-vars)
(error "No email account found"))))
(add-hook 'mu4e-compose-pre-hook 'my-mu4e-set-account)
;;-+-+-+-+-+-+-+-+-+-+-+-+
;;---------
;; mu4e-maildirs-extension
(use-package mu4e-maildirs-extension
:ensure t
:init
(mu4e-maildirs-extension)
:custom
(mu4e-maildirs-extension-custom-list '("/Gmail/INBOX" "/Exchange/INBOX" "/Hotmail/INBOX"))
)
;; mu4e-alert
(use-package mu4e-alert
:ensure t
:after mu4e
:init
(setq mu4e-alert-interesting-mail-query
(concat
"flag:unread maildir:/Exchange/INBOX "
"OR "
"flag:unread maildir:/Gmail/INBOX"
))
(mu4e-alert-enable-mode-line-display)
(defun gjstein-refresh-mu4e-alert-mode-line ()
(interactive)
(mu4e~proc-kill)
(mu4e-alert-enable-mode-line-display)
)
(run-with-timer 0 60 'gjstein-refresh-mu4e-alert-mode-line))
;; helm
(use-package helm-mu
:ensure t
:config
;;(define-key mu4e-main-mode-map "s" 'helm-mu)
;;(define-key mu4e-headers-mode-map "s" 'helm-mu)
;;(define-key mu4e-view-mode-map "s" 'helm-mu)
)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-safe-themes
(quote
("2f1518e906a8b60fac943d02ad415f1d8b3933a5a7f75e307e6e9a26ef5bf570" "fe94e2e42ccaa9714dd0f83a5aa1efeef819e22c5774115a9984293af609fce7" default)))
'(org-agenda-files
(quote
("~/beorg/students.org" "~/beorg/inbox.org" "~/beorg/academia.org")))
'(package-selected-packages
(quote
(pdf-tools company org-bullets expand-region flycheck treemacs-projectile treemacs magit auctex dashboard helm-projectile helm doom-modeline doom-themes which-key use-package projectile)))
'(pdf-tools-handle-upgrades nil)
'(safe-local-variable-values
(quote
((org-attach-directory . "students/")
(org-attach-use-inheritance . t)
(org-attach-preferred-new-method . ask)
(pyvenv-workon . keesman_env)
(org-edit-src-content . 0)
(org-src-preserve-indentation . t)))))
)
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
)

Loading…
Cancel
Save