From ee744ab2060b158862a657694e340fb8a40c30d3 Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Thu, 16 May 2019 21:39:04 +0200 Subject: [PATCH] Reworks the way spacemacs config is organized --- dotfiles/spacemacs.org | 372 ++++++++++++++++++++--------------------- 1 file changed, 184 insertions(+), 188 deletions(-) diff --git a/dotfiles/spacemacs.org b/dotfiles/spacemacs.org index 9d7cec9..b592297 100644 --- a/dotfiles/spacemacs.org +++ b/dotfiles/spacemacs.org @@ -1,22 +1,23 @@ #+TITLE: Spacemacs configuration -#+STARTUP: headlines -#+STARTUP: nohideblocks -#+STARTUP: noindent #+PROPERTY: header-args:emacs-lisp :comments link :results silent * User Init + :PROPERTIES: + :header-args:emacs-lisp+: :tangle ~/.spacemacs.d/user-init.el + :END: + ** Melpa -#+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp :tangle no (add-to-list 'package-archives '("melpa" . "http://www.mirrorservice.org/sites/melpa.org/packages/")) #+END_SRC ** Ispell -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-init.el +#+BEGIN_SRC emacs-lisp (setq ispell-program-name "/usr/bin/aspell") #+END_SRC ** Org latex fragment -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-init.el +#+BEGIN_SRC emacs-lisp (defvar kk/org-latex-fragment-last nil "Holds last fragment/environment you were on.") @@ -99,13 +100,18 @@ #+END_SRC ** Default Browser -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-init.el +#+BEGIN_SRC emacs-lisp (setq browse-url-browser-function 'browse-url-generic browse-url-generic-program "qutebrowser") #+END_SRC +* User-Config + :PROPERTIES: + :header-args:emacs-lisp+: :tangle ~/.spacemacs.d/user-config.el + :END: + ** Others -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +#+BEGIN_SRC emacs-lisp ;; Line Wrapping (spacemacs/toggle-truncate-lines-on) @@ -127,55 +133,54 @@ #+END_SRC ** Windows Management -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +#+BEGIN_SRC emacs-lisp (global-set-key (kbd "") 'shrink-window) (global-set-key (kbd "") 'enlarge-window) (global-set-key (kbd "") 'shrink-window-horizontally) (global-set-key (kbd "") 'enlarge-window-horizontally) #+END_SRC ** Lockfiles -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +#+BEGIN_SRC emacs-lisp (setq create-lockfiles nil) #+end_src ** Autosave -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +#+BEGIN_SRC emacs-lisp (setq backup-directory-alist `(("." . "~/.saves"))) (setq backup-by-copying t) #+END_SRC -* Path -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +** Path +#+BEGIN_SRC emacs-lisp (setq thesis-base-path (expand-file-name "~/MEGA/These")) (setq dropbox-base-path (expand-file-name "~/Dropbox")) #+END_SRC -* Magit -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +** Magit +#+BEGIN_SRC emacs-lisp (setenv "GIT_ASKPASS" "git-gui--askpass") (setq magit-diff-refine-hunk 'all) #+END_SRC -* User informations -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +** User informations +#+BEGIN_SRC emacs-lisp ;; Used to the \author for LaTeX export (setq user-full-name "Thomas Dehaeze") ;; Used to set \email for LaTeX export (setq user-mail-address "dehaeze.thomas@gmail.com") #+END_SRC -* Alerts ** Change default alert backend -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +#+BEGIN_SRC emacs-lisp (setq alert-default-style 'libnotify) #+END_SRC -* LaTeX +** LaTeX - https://tex.stackexchange.com/questions/52179/what-is-your-favorite-emacs-and-or-auctex-command-trick - https://tex.stackexchange.com/questions/20843/useful-shortcuts-or-key-bindings-or-predefined-commands-for-emacsauctex -** Basic LaTeX configuration -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +*** Basic LaTeX configuration +#+BEGIN_SRC emacs-lisp (defun latex/clean () "Clean LaTeX output using latexmk" (interactive) @@ -191,13 +196,13 @@ (add-hook 'TeX-mode-hook #'TeX-fold-mode) #+END_SRC -** Master file -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +*** Master file +#+BEGIN_SRC emacs-lisp (setq-default TeX-master nil) #+END_SRC -** Pdf Viewer -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +*** Pdf Viewer +#+BEGIN_SRC emacs-lisp (setq TeX-view-program-selection '((output-pdf "Zathura"))) (setq TeX-source-correlate-mode t) (setq TeX-source-correlate-start-server t) @@ -206,9 +211,9 @@ '(("PDF Tools" TeX-pdf-tools-sync-view))) #+END_SRC -** Helm-Bibtex -*** TODO General Config -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +*** Helm-Bibtex +**** General Config +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'helm-bibtex ;; Use "tags" field when looking for bib entries (setq helm-bibtex-additional-search-fields '(keywords)) @@ -283,8 +288,8 @@ ) #+END_SRC -*** Open pdf externally -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +**** Open pdf externally +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'helm-bibtex (defun tdehaeze/open-pdf-externally (key) (call-process "zathura" nil 0 nil (nth 0 (-cons-to-list (bibtex-completion-find-pdf key))))) @@ -295,40 +300,40 @@ ) #+END_SRC -*** Special Commands -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +**** Special Commands +#+BEGIN_SRC emacs-lisp (defun helm-bibtex-favorites (&optional arg) "Search Favorite BibTeX entries" (interactive "P") (helm-bibtex arg nil "favorite ")) #+END_SRC -* Auto Complete -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +** Auto Complete +#+BEGIN_SRC emacs-lisp (global-company-mode) #+END_SRC -* Yas Snippets -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +** Yas Snippets +#+BEGIN_SRC emacs-lisp (setq yas-indent-line "fixed") #+END_SRC -* Org-Mode +** Org-Mode - http://cachestocaches.com/2016/9/my-workflow-org-agenda/ - http://doc.norang.ca/org-mode.html#TodoKeywords - https://emacs.cafe/emacs/orgmode/gtd/2017/06/30/orgmode-gtd.html -** Org Tagging -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +*** Org Tagging +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org ;; Tags with fast selection keys (setq org-tag-alist (quote (("@christophe" . ?c) ("@muriel" . ?m)))) ) #+END_SRC -** Org Gcal +*** Org Gcal - https://cestlaz.github.io/posts/using-emacs-26-gcal/#.WIqBud9vGAk -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org (setq org-gcal-client-id "396102378658-dcmbcmrnthbe925519otsjbd921otq0v.apps.googleusercontent.com" org-gcal-client-secret "4M5PWrbhQjwYEMXGK85lDYX9" @@ -340,15 +345,15 @@ ) #+END_SRC -** Org Refile -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +*** Org Refile +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org (setq org-refile-targets '((org-agenda-files . (:maxlevel . 6)))) ) #+END_SRC -** Org Todos +*** Org Todos http://sachachua.com/blog/2014/04/thinking-todo-keywords/ -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org ;; Tags with fast selection keys (setq org-todo-keywords '( @@ -377,9 +382,9 @@ http://sachachua.com/blog/2014/04/thinking-todo-keywords/ ("EXAM" . (:foreground "#98971a" :weight bold)))) ;; green ) #+END_SRC -** Org Agenda -*** General configuration -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +*** Org Agenda +**** General configuration +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org ;; File to save todo items (setq org-agenda-files (list (format "%s/%s" thesis-base-path "TODOs/") @@ -408,9 +413,9 @@ http://sachachua.com/blog/2014/04/thinking-todo-keywords/ ) ) #+END_SRC -*** Org Agenda Custom Views +**** Org Agenda Custom Views https://blog.aaronbieber.com/2016/09/24/an-agenda-for-life-with-org-mode.html -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org (defun tdehaeze/org-agenda-skip-scheduled () (org-agenda-skip-entry-if 'scheduled 'deadline 'regexp "\n]+>")) @@ -438,13 +443,13 @@ https://blog.aaronbieber.com/2016/09/24/an-agenda-for-life-with-org-mode.html ) ) #+END_SRC -*** TODO Add Custom Views for the bibliography +**** TODO Add Custom Views for the bibliography - Things reading (BOOKMARS) - Things to read - etc... -** Org Notification based on calendar event +*** Org Notification based on calendar event https://emacs.stackexchange.com/questions/3844/good-methods-for-setting-up-alarms-audio-visual-triggered-by-org-mode-events -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org (setq appt-message-warning-time 5) (defun my-org-agenda-to-appt () @@ -466,7 +471,7 @@ https://emacs.stackexchange.com/questions/3844/good-methods-for-setting-up-alarm ) #+END_SRC -*** appt-notification script +**** appt-notification script :PROPERTIES: :header-args: :tangle ~/bin/appt-notification :header-args+: :comments none :mkdirp yes @@ -479,8 +484,8 @@ https://emacs.stackexchange.com/questions/3844/good-methods-for-setting-up-alarm dunstify --replace=85401 "Event in $TIME minutes" "$MSG" #+end_src -** Org Structure Template -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +*** Org Structure Template +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org (setq org-structure-template-alist '(("a" . "export ascii") @@ -497,8 +502,8 @@ https://emacs.stackexchange.com/questions/3844/good-methods-for-setting-up-alarm ) #+END_SRC -** Org Capture -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +*** Org Capture +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org (setq org-directory "~/MEGA/These/TODOs/") (setq org-default-notes-file "~/MEGA/These/TODOs/refile.org") @@ -542,10 +547,10 @@ https://emacs.stackexchange.com/questions/3844/good-methods-for-setting-up-alarm ) #+END_SRC -** TODO Org Publish +*** TODO Org Publish https://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org (setq org-publish-project-alist '( @@ -570,9 +575,9 @@ https://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html ) #+END_SRC -** Org Babel -*** Main configuration -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +*** Org Babel +**** Main configuration +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org ;; Don't ask for confirmation when evalutating latex blocs (defun my-org-confirm-babel-evaluate (lang body) @@ -588,15 +593,15 @@ https://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html ) #+END_SRC -*** Library of Babel -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +**** Library of Babel +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org (org-babel-lob-ingest "~/MEGA/These/org-mode/org-babel-tutorial/org-babel-library.org") ) #+END_SRC -*** Matlab -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +**** Matlab +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org (setq org-babel-matlab-shell-command "/usr/local/bin/matlab -nodesktop -nosplash") @@ -628,21 +633,21 @@ https://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html ) #+end_src -*** Asynchronous execution +**** Asynchronous execution https://github.com/astahlman/ob-async -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +#+BEGIN_SRC emacs-lisp (require 'ob-async) #+end_src -*** Theme -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +**** Theme +#+BEGIN_SRC emacs-lisp (require 'color) (set-face-attribute 'org-block nil :background (color-darken-name (face-attribute 'default :background) 3)) #+end_src -** Org Export -*** Basic -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +*** Org Export +**** Basic +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org ;; How many levels of headline to export (setq org-export-headline-levels 4) @@ -657,18 +662,18 @@ https://github.com/astahlman/ob-async (ox-extras-activate '(ignore-headlines)) ) #+END_SRC -*** Ox Latex Subfigure package -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +**** Ox Latex Subfigure package +#+BEGIN_SRC emacs-lisp (use-package ox-latex-subfigure :init (setq org-latex-prefer-user-labels t) :config (require 'ox-latex-subfigure)) #+END_SRC -*** Clear page before heading +**** Clear page before heading https://emacs.stackexchange.com/questions/30575/adding-latex-newpage-before-a-heading/30892 -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org (with-eval-after-load 'ox-latex (defun org/get-headline-string-element (headline backend info) @@ -685,24 +690,24 @@ https://emacs.stackexchange.com/questions/30575/adding-latex-newpage-before-a-he 'org/ensure-latex-clearpage) )) #+END_SRC -*** TODO HTML Export -**** Export with css class instead of inline css -#+BEGIN_SRC emacs-lisp :tangle ~/.spacemacs.d/user-config.el +**** TODO HTML Export +***** Export with css class instead of inline css +#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org (setq org-html-htmlize-output-type 'css) ) #+END_SRC -**** TODO MP4 movies -#+BEGIN_SRC emacs-lisp +***** TODO MP4 movies +#+BEGIN_SRC emacs-lisp :tangle no (with-eval-after-load 'org (setq org-html-html5-fancy t) (setq org-html-doctype "xhtml-strict") ) #+END_SRC -**** TODO MathJax with SIunix -#+BEGIN_SRC emacs-lisp +***** TODO MathJax with SIunix +#+BEGIN_SRC emacs-lisp :tangle no (with-eval-after-load 'org (setq org-html-mathjax-template "