My emacs configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

565 lines
18 KiB

;;; My basic configuration Gerardo Marx 15/Jul/2020
;;--------
;; Melpa repository:
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/")t)
(package-initialize)
;; use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;; frame size
(setq initial-frame-alist '((top . 10)(left . 20)
(width . 90)(height . 50)))
;; which-key:
(use-package which-key
:ensure t
:config (which-key-mode))
;; doom-themes
(use-package doom-themes
:ensure t
:config
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
doom-themes-enable-italic t) ; if nil, italics is universally disabled
(load-theme ;'doom-one
'doom-tomorrow-day t)
;; Enable flashing mode-line on errors
(doom-themes-visual-bell-config)
;; Enable custom neotree theme (all-the-icons must be installed!)
(doom-themes-neotree-config)
;; or for treemacs users
(setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme
(doom-themes-treemacs-config)
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config))
;; modeline
(use-package doom-modeline
:ensure t
:init (doom-modeline-mode 1))
;; icons:
(use-package all-the-icons
:ensure t) ;; --> you need this M-x all-the-icons-install-fonts
;; startup config
(setq inhibit-startup-message t) ;;inhibit startup
(tool-bar-mode -1)
(menu-bar-mode -1)
(global-hl-line-mode +1) ;; highlith current line
(delete-selection-mode +1) ;; deletes selected text and replace it
(scroll-bar-mode -1)
(setq ns-right-alternate-modifier nil) ;; right option macos key enable
(setq backup-directory-alist '(("." . "~/.saves"))) ;; a backup dir to store no saved files
(fset 'yes-or-no-p 'y-or-n-p) ;; Ask y/n instead of yes/no
(add-hook 'prog-mode-hook 'display-line-numbers-mode) ;; display line number when programming
(show-paren-mode +1) ;; show matching parentheses
;; helm package:
(use-package helm
:ensure t
:demand t
:bind (("M-x" . helm-M-x)
("C-c h x" . helm-register) ; C-x r SPC and C-x r j
("C-c h g" . helm-google-suggest)
("C-c h M-:" . helm-eval-expression-with-eldoc)
("C-x C-f" . helm-find-files))
:config
(require 'helm-config)
(helm-mode t))
;; projectile:
(use-package projectile
:ensure t
:config
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(projectile-mode t))
;; helm-projectile:
(use-package helm-projectile
:after projectile
:ensure t
:init
(require 'tramp)
:config
(helm-projectile-on))
;; temp:
(setq ido-enable-flex-matching t)
;; dash-board:
(use-package dashboard
:ensure t
:init
(progn
(setq recentf-exclude '("/Users/gmarx/beorg/"))
(setq dashboard-items '(
;;(recents . 5)
(bookmarks . 5)
(projects . 5)
(agenda . 5)))
(setq dashboard-banner-logo-title "Welcome gMarx")
(setq dashboard-set-file-icons t)
(setq dashboard-set-init-info t)
(setq dashboard-startup-banner 'logo)
)
:config
(dashboard-setup-startup-hook))
;; treemacs
(use-package treemacs
:ensure t
:init
(with-eval-after-load 'winum
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
:config
(progn
(setq treemacs-is-never-other-window t)
(setq treemacs-width 35))
:bind
(:map global-map
("M-0" . treemacs-select-window)
("C-x t t" . treemacs)))
;; treemacs-projectile
(use-package treemacs-projectile
:after treemacs projectile
:ensure t)
;; magit
(use-package magit
:ensure t)
;; latex
(use-package tex
:defer t
:ensure auctex
:init
(progn
(setq-default TeX-master nil) ; Query for master file.
(setq TeX-auto-save t) ; Enable parse on save.
(setq TeX-save-query nil)
(custom-set-variables '(LaTeX-command "latex -synctex=1"))
;;(setq TeX-command-force "LaTex")
;;(setq latex-run-command "pdflatex")
(setq TeX-parse-self t) ; Enable parse on load.
(setenv "PATH" (concat (getenv "PATH") ":/Library/TeX/texbin/"))
(setq exec-path (append exec-path '("/Library/TeX/texbin/")))
;; pdf-tools configuration
(setq TeX-PDF-mode t)
(add-hook 'TeX-after-compilation-finished-functions
#'TeX-revert-document-buffer)
(setq TeX-view-program-selection '((output-pdf "PDF Tools"))
TeX-source-correlate-start-server t)
(setq pdf-info-epdfinfo-program "/usr/local/bin/epdfinfo")
(add-to-list 'auto-mode-alist '("\\.pdf\\'" . pdf-view-mode))
(add-hook 'pdf-view-mode-hook
(lambda () (pdf-tools-enable-minor-modes)))
)
)
;; pdf-tools
(use-package pdf-tools
:ensure t
:pin melpa
:magic ("%PDF" . pdf-view-mode)
:config
(custom-set-variables
'(pdf-tools-handle-upgrades nil))
)
;;--------
;; latex-preview
(use-package latex-preview-pane
:ensure t)
;; latexmk
(use-package auctex-latexmk
:ensure t
:init
(auctex-latexmk-setup)
:config
(setq auctex-latexmk-inherit-TeX-PDF-mode t))
;;----------------------
;; flycheck
(use-package flycheck
:ensure t
:init (global-flycheck-mode))
;; expand region
(use-package expand-region
:ensure t
:bind
("C-=" . er/expand-region)
("C--" . er/contract-region))
;; org-bullets
(use-package org-bullets
:ensure t
:init
(setq org-support-shift-select t))
;; :hook
;; (org-mode . org-bullets-mode))
;;------pomodoro
(use-package org-pomodoro
:ensure t
:after org
:bind ("C-x p" . org-pomodoro))
;; org configuration:
(add-hook 'org-mode-hook
(lambda()
;; dictionary
(org-bullets-mode 1)
(ispell-change-dictionary "en")
(setq org-image-actual-width nil)
(setq org-tags-column 5)
(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
(visual-line-mode 1)
))
;; 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 "en")
(setq ispell-program-name "/usr/local/bin/aspell")
;; Set default font:
(add-to-list 'default-frame-alist
'(font . "Source Code Pro-20"))
;; 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
(quote
((sequence "TODO(t)" "PROGRESS(g)" "PAUSE(p)" "CHECK(k)" "|" "DONE(d)" "CANCELED(c)"))))
(setq org-todo-keyword-faces
'(("PROGRESS" . "orange") ("PAUSE" . "magenta") ("CHECK" . "purple") ("CANCELED" . "red") ("DONE" . "green")))
;; capture:
(setq org-capture-templates
(quote (
("a" ; hotkey
"Academia Todo" ; name
entry ; type
(file+headline "/Users/gmarx/beorg/academia.org" "Tasks") ;target
"* TODO [#B] %^{Task}" ; template
)
("t"
"Task PhD"
entry
(file+datetree "~/beorg/phd.org")
"* TODO [#A] %^{Task}")
("d"
"Students"
item
(file+datetree "~/beorg/students.org")
"- %U - %^{Activity}")
("r"
"to Read"
entry
(file+headline "~/beorg/inbox.org" "to read")
"* TODO %^{topic to read}\n%^{Why to read this?}"
)
("s"
"Schedule an event"
entry
(file+headline "~/beorg/inbox.org" "Scheduled events")
"* %^{Event}\nSCHEDULED: %^t"
)
("k"
"Task inbox"
entry
(file+headline "~/beorg/inbox.org" "Tasks")
"* TODO %^{Task} -> %^{move to}"
)
("c"
"Cheat-Sheet"
entry
(file+headline "~/beorg/cheatsheets.org" "Notes")
"* %^{what solves}\n%^{the commands are}"
)
)))
;;-------end capture
;;=======
;;python
(use-package virtualenvwrapper
:ensure t
:config
(setq python-shell-interpreter "python3")
(setq venv-location "~/.virtualenvs"))
;; org-alert
(use-package org-alert
:ensure t
:config
(setq alert-default-style 'osx-notifier))
;; reftex
(use-package reftex
:ensure t
:defer t
:config
(setq reftex-cite-prompt-optional-args t)); Prompt for empty optional arguments in cite
;; org-exporter:
(use-package ox-twbs
:ensure t)
;;multiple coursors:
(use-package ace-mc
:ensure t
:config
(global-set-key (kbd "C-)") 'ace-mc-add-multiple-cursors)
(global-set-key (kbd "C-M-)") 'ace-mc-add-single-cursor))
;;ace-jump:
(use-package ace-jump-mode
:ensure t
:bind ("C-x j" . ace-jump-mode))
;; pyenv:
(use-package pyvenv
:ensure t
:config
(pyvenv-mode 1))
;; org-configuration:
(org-babel-do-load-languages
'org-babel-load-languages
'((python . t)))
;;ess:
(use-package ess
:ensure t
:init (require 'ess-site))
;; markdown:
(use-package markdown-mode
:ensure t
:commands (markdown-mode gfm-mode)
:mode (("README\\.md\\'" . gfm-mode)
("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode))
:init
(setq markdown-command "multimarkdown")
(add-hook 'markdown-mode-hook
(lambda()
(ispell-change-dictionary "en")
(flyspell-mode 1)))
(setq markdown-css-paths '(
"./assets/stylesheets/style.css"
"./assets/stylesheets/pilcrow.css"
"./assets/stylesheets/hljs-github.min.css"
))
)
;;criticMarkup
(use-package cm-mode
:ensure t)
;;org-trello
(require 'org-trello)
(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.
'(LaTeX-command "latex -synctex=1")
'(custom-safe-themes
(quote
("7a994c16aa550678846e82edc8c9d6a7d39cc6564baaaacc305a3fdc0bd8725f" "5b809c3eae60da2af8a8cfba4e9e04b4d608cb49584cb5998f6e4a1c87c057c4" "d74c5485d42ca4b7f3092e50db687600d0e16006d8fa335c69cf4f379dbd0eee" "2f1518e906a8b60fac943d02ad415f1d8b3933a5a7f75e307e6e9a26ef5bf570" "71e5acf6053215f553036482f3340a5445aee364fb2e292c70d9175fb0cc8af7" "99ea831ca79a916f1bd789de366b639d09811501e8c092c85b2cb7d697777f93" "bf387180109d222aee6bb089db48ed38403a1e330c9ec69fe1f52460a8936b66" default)))
'(markdown-command "/usr/local/bin/pandoc" t)
'(org-agenda-files
(quote
("~/beorg/kinetics-estimation.org" "~/lwc/projects/dynamicSystems/trello-jason.org" "~/beorg/inbox.org" "~/beorg/academia.org" "~/beorg/water-quality.org" "~/beorg/phd.org" "~/lwc/projects/dynamicSystems/dynamic-systems.org")))
'(org-trello-current-prefix-keybinding "C-c o" nil (org-trello))
'(org-trello-files (quote ("~/beorg/trello-org.org")) nil (org-trello))
'(package-selected-packages
(quote
(ace-jump cm-mode org-trello markdown-mode pyvenv ess ace-mc ox-twbs org-alert latex-preview-pane org-pomodoro which-key virtualenvwrapper use-package treemacs-projectile pdf-tools org-bullets mu4e-maildirs-extension mu4e-alert magit helm-projectile helm-mu flycheck expand-region doom-themes doom-modeline dashboard company auctex)))
'(pdf-tools-handle-upgrades nil)
'(safe-local-variable-values
(quote
((markdown-css-paths . "./assets/stylesheets/main.css")
(markdown-css-path . "./assets/stylesheets/main.css")
(column-width . 5000)
(fill-column . 5000:)
(ispell-local-dictionary . castellano)
(ispell-local-directory . castellano)
(LaTeX-includegraphics-read-file . LaTeX-includegraphics-read-file-relative)
(set-fill-column . 5000)
(set-fill-column . 2000)
(TeX-auto-save . t)
(TeX-parse-self . t)
(org-attach-directory . "students/")
(org-attach-use-inheritance . t)
(org-attach-preferred-new-method . ask))))
'(send-mail-function (quote smtpmail-send-it)))
;; org-trello:
(use-package org-trello
:ensure t)
;; ace-window
(use-package ace-window
:ensure t
:bind
("M-o" . 'ace-window)
:config
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)))
;; ace-jump
(use-package ace-jump-mode
:ensure t
:bind
("C-c SPC" . 'ace-jump-mode)
("C-c C-j l" . 'ace-jump-line-mode)
("C-c C-j c" . 'ace-jump-char-mode))
;;-0-0-0-0-0-0-0
;; my functions:
;; show in finder
(defun show-in-finder ()
(interactive)
(shell-command (concat "open -R " buffer-file-name)))
(global-set-key (kbd "C-x x f") 'show-in-finder)
;; visit real files (symbolic link)
(setq find-file-visit-truename t)
;;-=-=-=-=-=-=-
;; 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)
;; )
;;=-=-=-=-=-=-=-=-=-=-=-=
;;agenda files
;;(setq org-agenda-files '("~/beorg/phd.org" "~/beorg/students.org" "~/beorg/inbox.org" "~/beorg/academia.org"))
(setq recentf-exclude (org-agenda-files))
(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.
'(org-document-title ((t (\,@headline (\,@ variable-tuple) :height 1.5 :underline nil))))
'(org-level-1 ((t (\,@headline (\,@ variable-tuple) :height 1.25))))
'(org-level-2 ((t (\,@headline (\,@ variable-tuple) :height 1.15))))
'(org-level-3 ((t (\,@headline (\,@ variable-tuple) :height 1.12))))
'(org-level-4 ((t (\,@headline (\,@ variable-tuple) :height 1.1))))
'(org-level-5 ((t (\,@headline (\,@ variable-tuple)))))
'(org-level-6 ((t (\,@headline (\,@ variable-tuple)))))
'(org-level-7 ((t (\,@headline (\,@ variable-tuple)))))
'(org-level-8 ((t (\,@headline (\,@ variable-tuple))))))