diff --git a/configuration.org b/configuration.org index 339d5802737af8d21cdb34828e2badf2b44b36cd..ce28427a84132c5a15f6b929f8ac849eced06af1 100644 --- a/configuration.org +++ b/configuration.org @@ -13,7 +13,7 @@ Some of my configuration entries where borrowed from other people, see the configuration to make each GC call faster for normal emacs use. #+begin_src emacs-lisp - (setq gc-cons-threshold (* 60 1024 1024)) +(setq gc-cons-threshold (* 60 1024 1024)) #+end_src * Personal information @@ -21,11 +21,11 @@ Some of my configuration entries where borrowed from other people, see Sets who I am #+begin_src emacs-lisp - (setq user-full-name "Michaël Hauspie" - user-mail-address "michael.hauspie@univ-lille.fr" - calendar-latitude 50.60483 - calendar-longitude 3.1464 - calendar-location-name "Villeneuve d'Ascq, France") +(setq user-full-name "Michaël Hauspie" + user-mail-address "michael.hauspie@univ-lille.fr" + calendar-latitude 50.60483 + calendar-longitude 3.1464 + calendar-location-name "Villeneuve d'Ascq, France") #+end_src @@ -34,11 +34,11 @@ Some of my configuration entries where borrowed from other people, see I use [[https://elpa.gnu.org][Elpa]], [[https://melpa.org][Melpa]] and [[http://orgmode.org][Org mode]] packages repository, thus I need to add them to the =package-archives= list #+BEGIN_SRC emacs-lisp - (require 'package) - (add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t) - (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) - (add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t) - (package-initialize) +(require 'package) +(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t) +(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) +(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t) +(package-initialize) #+END_SRC @@ -48,9 +48,9 @@ Some of my configuration entries where borrowed from other people, see #+BEGIN_SRC emacs-lisp - (when (not (package-installed-p 'use-package)) - (package-refresh-contents) - (package-install 'use-package)) +(when (not (package-installed-p 'use-package)) + (package-refresh-contents) + (package-install 'use-package)) #+END_SRC @@ -58,27 +58,27 @@ Some of my configuration entries where borrowed from other people, see ensure package by default #+BEGIN_SRC emacs-lisp - (require 'use-package-ensure) - (setq use-package-always-ensure t) +(require 'use-package-ensure) +(setq use-package-always-ensure t) #+END_SRC I like to keep things up to date, so I use =auto-package-update= #+BEGIN_SRC emacs-lisp - ;; (use-package auto-package-update - ;; :config - ;; (setq auto-package-update-delete-old-versions t) - ;; (setq auto-package-update-hide-results t) - ;; (auto-package-update-maybe)) +;; (use-package auto-package-update +;; :config +;; (setq auto-package-update-delete-old-versions t) +;; (setq auto-package-update-hide-results t) +;; (auto-package-update-maybe)) #+END_SRC and I want to be sure that compiled versions of packages are up-to-date #+begin_src emacs-lisp - (use-package auto-compile - :config (auto-compile-on-load-mode)) +(use-package auto-compile + :config (auto-compile-on-load-mode)) - (setq load-prefer-newer t) +(setq load-prefer-newer t) #+end_src @@ -96,17 +96,17 @@ Some of my configuration entries where borrowed from other people, see I quite like have it around sometimes, so I re-enable it. #+BEGIN_SRC emacs-lisp - (use-package better-defaults) +(use-package better-defaults) - ;; I want menu bar - (menu-bar-mode t) +;; I want menu bar +(menu-bar-mode t) #+END_SRC Ido is not set everywhere by =better-defaults= and I really want it everywhere #+begin_src emacs-lisp - (setq ido-enable-flex-matching t) - (setq ido-everywhere t) +(setq ido-enable-flex-matching t) +(setq ido-everywhere t) #+end_src @@ -114,15 +114,15 @@ Some of my configuration entries where borrowed from other people, see behave *as* an option key and not an Emacs =meta= key. #+begin_src emacs-lisp - (when (eq system-type 'darwin) - (setq mac-right-option-modifier nil)) +(when (eq system-type 'darwin) + (setq mac-right-option-modifier nil)) #+end_src Allow pressing only =y= instead of =yes= for fast answer to yes or no question #+begin_src emacs-lisp - ;; Make the y or n suffice for a yes or no question - (fset 'yes-or-no-p 'y-or-n-p) +;; Make the y or n suffice for a yes or no question +(fset 'yes-or-no-p 'y-or-n-p) #+end_src ** Editor tweaks @@ -130,39 +130,39 @@ Some of my configuration entries where borrowed from other people, see Save the place in the file when killing the buffer so that it reopens at the same spot later #+begin_src emacs-lisp - (save-place-mode t) +(save-place-mode t) #+end_src Syntax highlighting everywhere #+begin_src emacs-lisp - (global-font-lock-mode t) - (setq font-lock-maximum-decoration t) +(global-font-lock-mode t) +(setq font-lock-maximum-decoration t) #+end_src Use 4 spaces as tab #+begin_src emacs-lisp - (setq tab-width 4) +(setq tab-width 4) #+end_src Allow cursor to top/bottom of file before signaling a scrolling error #+begin_src emacs-lisp - (setq scroll-error-top-bottom t) +(setq scroll-error-top-bottom t) #+end_src Replace selection as I type #+begin_src emacs-lisp - (delete-selection-mode t) +(delete-selection-mode t) #+end_src When using =C-k=, kill the whole line (including =\n=) #+begin_src emacs-lisp - (setq kill-whole-line t) +(setq kill-whole-line t) #+end_src When moving the cursor up or down, remember when it was on a line end @@ -170,7 +170,7 @@ Some of my configuration entries where borrowed from other people, see #+begin_src emacs-lisp - (setq track-eol t) +(setq track-eol t) #+end_src @@ -180,36 +180,36 @@ Some of my configuration entries where borrowed from other people, see save/revert, Emacs asks what to do. #+begin_src emacs-lisp - (global-auto-revert-mode t) - ;; kept for future use, I think I do not want that - ;; (setq global-auto-revert-non-file-buffers nil) +(global-auto-revert-mode t) +;; kept for future use, I think I do not want that +;; (setq global-auto-revert-non-file-buffers nil) #+end_src Do not word wrap buffers, truncate long lines #+begin_src emacs-lisp - ;; Truncate lines (don't word wrap) - (setq truncate-lines t) +;; Truncate lines (don't word wrap) +(setq truncate-lines t) #+end_src If a timestamp tag is present in the file, update it when saving #+begin_src emacs-lisp - ;; Time stamping - (setq time-stamp-active t ; do enable time-stamps - time-stamp-line-limit 70 ; check first 70 buffer lines for Time-stamp: - time-stamp-format "%Y-%02m-%02d %02H:%02M:%02S (%u)") ; date format - (add-hook 'write-file-hooks 'time-stamp) +;; Time stamping +(setq time-stamp-active t ; do enable time-stamps + time-stamp-line-limit 70 ; check first 70 buffer lines for Time-stamp: + time-stamp-format "%Y-%02m-%02d %02H:%02M:%02S (%u)") ; date format +(add-hook 'write-file-hooks 'time-stamp) #+end_src Define a shortcut to re-indent all buffer. This saves the current point, marks whole buffer and call =indent-region= #+begin_src emacs-lisp - (defun mh/indent-buffer() - (interactive) - (save-excursion - (indent-region (point-min) (point-max)))) +(defun mh/indent-buffer() + (interactive) + (save-excursion + (indent-region (point-min) (point-max)))) - (global-set-key (kbd "C-c i b") 'mh/indent-buffer) +(global-set-key (kbd "C-c i b") 'mh/indent-buffer) #+end_src #+RESULTS: @@ -220,9 +220,9 @@ Some of my configuration entries where borrowed from other people, see Manage undo as a tree so that we can undo/redo more. Bound by default on =C-x u= #+begin_src emacs-lisp - (use-package undo-tree - :config - (global-undo-tree-mode)) +(use-package undo-tree + :config + (global-undo-tree-mode)) #+end_src @@ -235,31 +235,31 @@ Some of my configuration entries where borrowed from other people, see matching parenthesis. Also do not show the welcome screen. #+BEGIN_SRC emacs-lisp - ;; Do not show welcome screen - (setq inhibit-startup-screen t) +;; Do not show welcome screen +(setq inhibit-startup-screen t) - ;; Highlight current line - (global-hl-line-mode t) +;; Highlight current line +(global-hl-line-mode t) - ;; Show line number on the left hand side of the code - (global-linum-mode t) +;; Show line number on the left hand side of the code +(global-linum-mode t) - ;; Show matching parenthesis - (show-paren-mode t) +;; Show matching parenthesis +(show-paren-mode t) - ;; Detailed window title - (setq-default frame-title-format (list "%65b %f")) - (setq-default icon-title-format (list "%b")) +;; Detailed window title +(setq-default frame-title-format (list "%65b %f")) +(setq-default icon-title-format (list "%b")) #+END_SRC ** Theme #+BEGIN_SRC emacs-lisp - (use-package color-theme-sanityinc-tomorrow - :config - (load-theme 'sanityinc-tomorrow-bright t) - ) +(use-package color-theme-sanityinc-tomorrow + :config + (load-theme 'sanityinc-tomorrow-bright t) + ) #+END_SRC @@ -269,26 +269,26 @@ Some of my configuration entries where borrowed from other people, see Use =moody= for a nice looking bottom modeline #+begin_src emacs-lisp - ;; (use-package moody - ;; :config - ;; (setq x-underline-at-descent-line t - ;; moody-mode-line-height 10) - ;; (moody-replace-mode-line-buffer-identification) - ;; (moody-replace-vc-mode)) +;; (use-package moody +;; :config +;; (setq x-underline-at-descent-line t +;; moody-mode-line-height 10) +;; (moody-replace-mode-line-buffer-identification) +;; (moody-replace-vc-mode)) #+end_src Tweak how some modeline elements are displayed #+begin_src emacs-lisp - ;; Show line and column number in mode line - (column-number-mode t) - (line-number-mode t) - - ;; Show time in mode line - (setq display-time-24hr-format t) - (setq display-time-day-and-date t) - (display-time-mode t) +;; Show line and column number in mode line +(column-number-mode t) +(line-number-mode t) + +;; Show time in mode line +(setq display-time-24hr-format t) +(setq display-time-day-and-date t) +(display-time-mode t) #+end_src @@ -296,15 +296,15 @@ Some of my configuration entries where borrowed from other people, see ensure that diminish is called only for modules that are installed and loaded. #+begin_src emacs-lisp - (use-package diminish - :config - (eval-after-load "company" '(diminish 'company-mode)) - (eval-after-load "company-box" '(diminish 'company-box-mode)) - (eval-after-load "undo-tree" '(diminish 'undo-tree-mode)) - (eval-after-load "yasnippet" '(diminish 'yas-minor-mode)) - (eval-after-load "which-key" '(diminish 'which-key-mode)) - (diminish 'eldoc-mode) - ) +(use-package diminish + :config + (eval-after-load "company" '(diminish 'company-mode)) + (eval-after-load "company-box" '(diminish 'company-box-mode)) + (eval-after-load "undo-tree" '(diminish 'undo-tree-mode)) + (eval-after-load "yasnippet" '(diminish 'yas-minor-mode)) + (eval-after-load "which-key" '(diminish 'which-key-mode)) + (diminish 'eldoc-mode) + ) #+end_src @@ -314,9 +314,9 @@ Some of my configuration entries where borrowed from other people, see possible next keys in the mini-buffer #+begin_src emacs-lisp - (use-package which-key - :config - (which-key-mode t)) +(use-package which-key + :config + (which-key-mode t)) #+end_src @@ -326,7 +326,7 @@ Some of my configuration entries where borrowed from other people, see we can redo/undo the buffer configuration #+begin_src emacs-lisp - (winner-mode t) +(winner-mode t) #+end_src @@ -339,24 +339,24 @@ Some of my configuration entries where borrowed from other people, see ** Basics #+BEGIN_SRC emacs-lisp - (use-package org - ;; :ensure org-plus-contrib - ;; :ensure org-tempo - :custom - ;; Tab keeps indenting in src blocks - (org-src-tab-acts-natively t) - ;; IDO for completion when applicable - (org-completion-use-ido t) - :config - ;; (require 'org-tempo) - (add-hook 'org-mode-hook - '(lambda () - (setq org-file-apps - '(("org" . emacs) - ("rs" . emacs) - ("c" . emacs) - ("h" . emacs) - ))))) +(use-package org + ;; :ensure org-plus-contrib + ;; :ensure org-tempo + :custom + ;; Tab keeps indenting in src blocks + (org-src-tab-acts-natively t) + ;; IDO for completion when applicable + (org-completion-use-ido t) + :config + ;; (require 'org-tempo) + (add-hook 'org-mode-hook + '(lambda () + (setq org-file-apps + '(("org" . emacs) + ("rs" . emacs) + ("c" . emacs) + ("h" . emacs) + ))))) #+END_SRC #+RESULTS: @@ -366,22 +366,22 @@ Some of my configuration entries where borrowed from other people, see Use =org-mode= for the initial scratch buffer #+begin_src emacs-lisp - (setq initial-major-mode 'org-mode) +(setq initial-major-mode 'org-mode) #+end_src And set some keyboard shortcuts for links and agenda #+begin_src emacs-lisp - (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) +(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) #+end_src Add shortcuts to quickly add code blocks using =C-,= #+begin_src emacs-lisp - (add-to-list 'org-structure-template-alist - '("el" . "src emacs-lisp")) +(add-to-list 'org-structure-template-alist + '("el" . "src emacs-lisp")) #+end_src @@ -390,9 +390,9 @@ Some of my configuration entries where borrowed from other people, see Use bullets instead of asterisks #+begin_src emacs-lisp - (use-package org-bullets - :init - (add-hook 'org-mode-hook 'org-bullets-mode)) +(use-package org-bullets + :init + (add-hook 'org-mode-hook 'org-bullets-mode)) #+end_src ** Task management @@ -401,9 +401,9 @@ Some of my configuration entries where borrowed from other people, see dependencies as done before being able to mark an item as done #+begin_src emacs-lisp - (setq org-log-done 'time) - (setq org-enforce-todo-dependencies t) - (setq org-enforce-todo-checkbox-dependencies t) +(setq org-log-done 'time) +(setq org-enforce-todo-dependencies t) +(setq org-enforce-todo-checkbox-dependencies t) #+end_src Set default task completion states to =TODO=, =WAITING= and @@ -411,8 +411,8 @@ Some of my configuration entries where borrowed from other people, see I'm waiting for some inputs. #+begin_src emacs-lisp - (setq org-todo-keywords - '((sequence "TODO" "WAITING" "|" "DONE"))) +(setq org-todo-keywords + '((sequence "TODO" "WAITING" "|" "DONE"))) #+end_src @@ -421,36 +421,36 @@ Some of my configuration entries where borrowed from other people, see Index and archive are my main todo lists (index) and a list of archived (done) tasks. #+begin_src emacs-lisp - (setq org-directory "~/documents/org") +(setq org-directory "~/documents/org") - (defun org-file-path (filename) - "Return the absolute address of an org file, given its relative name." - (concat (file-name-as-directory org-directory) filename)) +(defun org-file-path (filename) + "Return the absolute address of an org file, given its relative name." + (concat (file-name-as-directory org-directory) filename)) - (setq org-index-file (org-file-path "index.org")) - (setq org-archive-location - (concat (org-file-path "archive.org") "::* From %s")) +(setq org-index-file (org-file-path "index.org")) +(setq org-archive-location + (concat (org-file-path "archive.org") "::* From %s")) #+end_src Then more specifics org files to add to the agenda list #+begin_src emacs-lisp - (setq org-agenda-files (list org-index-file - "~/.emacs.d/configuration.org" - (org-file-path "work.org") - (org-file-path "archive.org"))) ; Just in case I forget to mark a subtask as done and archive the main one +(setq org-agenda-files (list org-index-file + "~/.emacs.d/configuration.org" + (org-file-path "work.org") + (org-file-path "archive.org"))) ; Just in case I forget to mark a subtask as done and archive the main one #+end_src Hitting =C-c C-x C-s= will mark a todo as done and move it to an appropriate place in the archive. #+begin_src emacs-lisp - (defun hrs/mark-done-and-archive () - "Mark the state of an org-mode item as DONE and archive it." - (interactive) - (org-todo 'done) - (org-archive-subtree)) +(defun hrs/mark-done-and-archive () + "Mark the state of an org-mode item as DONE and archive it." + (interactive) + (org-todo 'done) + (org-archive-subtree)) - (define-key org-mode-map (kbd "C-c C-x C-s") 'hrs/mark-done-and-archive) +(define-key org-mode-map (kbd "C-c C-x C-s") 'hrs/mark-done-and-archive) #+end_src @@ -459,13 +459,13 @@ Some of my configuration entries where borrowed from other people, see The week should begin today, not last Monday for the agenda view #+begin_src emacs-lisp - (setq org-agenda-start-on-weekday nil) +(setq org-agenda-start-on-weekday nil) #+end_src I want to see more days in the agenda view #+begin_src emacs-lisp - (setq org-agenda-span 15) +(setq org-agenda-span 15) #+end_src @@ -475,12 +475,12 @@ Some of my configuration entries where borrowed from other people, see eventualy do later. #+begin_src emacs-lisp - (setq org-agenda-custom-commands - '(("a" "Agenda" - ( - (agenda "" ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)))) - (alltodo "" ((org-agenda-skip-function '(org-agenda-skip-entry-if 'scheduled 'deadline 'todo 'done)))) - )))) +(setq org-agenda-custom-commands + '(("a" "Agenda" + ( + (agenda "" ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)))) + (alltodo "" ((org-agenda-skip-function '(org-agenda-skip-entry-if 'scheduled 'deadline 'todo 'done)))) + )))) #+end_src ** Capture @@ -489,23 +489,23 @@ Some of my configuration entries where borrowed from other people, see other things later #+begin_src emacs-lisp - (setq org-capture-templates - '(("f" "Finished book" - table-line (file "~/Documents/org/books-read.org") - "| %^{Title} | %^{Author} | %u |") - - ("t" "Todo" - entry - (file+headline org-index-file "Tâches") - "* TODO %?\n:PROPERTIES:\nCREATED: %u\n:END:\n") - - ("c" "Cycling" - table-line (file "~/Documents/org/cycling.org") - "| %t | balade | %^{prompt|standard|électrique} | %^{Distance} |") - - ("w" "Cycling to work" - table-line (file "~/Documents/org/cycling.org") - "| %t | boulot | %^{prompt|électrique|standard} | 26.2 |"))) +(setq org-capture-templates + '(("f" "Finished book" + table-line (file "~/Documents/org/books-read.org") + "| %^{Title} | %^{Author} | %u |") + + ("t" "Todo" + entry + (file+headline org-index-file "Tâches") + "* TODO %?\n:PROPERTIES:\nCREATED: %u\n:END:\n") + + ("c" "Cycling" + table-line (file "~/Documents/org/cycling.org") + "| %t | balade | %^{prompt|standard|électrique} | %^{Distance} |") + + ("w" "Cycling to work" + table-line (file "~/Documents/org/cycling.org") + "| %t | boulot | %^{prompt|électrique|standard} | 26.2 |"))) #+end_src ** Export configuration @@ -514,13 +514,19 @@ Some of my configuration entries where borrowed from other people, see using bootstrap template. #+begin_src emacs-lisp - ;; Add Beamer to export list - (require 'ox-beamer) - ;; And markdown - (require 'ox-md) - - ;; bootstrap html - (use-package ox-twbs) +;; Add Beamer to export list +(require 'ox-beamer) +;; And markdown +(require 'ox-md) + +;; some HTML slide export engines +(use-package ox-html5slide) +(use-package ox-impress-js) +(use-package ox-reveal ) +(use-package ox-spectacle ) + +;; bootstrap html +(use-package ox-twbs) #+end_src @@ -528,21 +534,21 @@ Some of my configuration entries where borrowed from other people, see [[https://pygments.org/][Pygments]] as an external tool), we need to change latex export commands. #+begin_src emacs-lisp - ;; Configure ox-latex to export source block using minted - ;; Setting minted cache to false as cache seems to fail when changing the output-directory - (add-to-list 'org-latex-packages-alist '("cache=false" "minted")) - (setq org-latex-listings 'minted) - - (setq org-latex-pdf-process - '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" - "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" - "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")) +;; Configure ox-latex to export source block using minted +;; Setting minted cache to false as cache seems to fail when changing the output-directory +(add-to-list 'org-latex-packages-alist '("cache=false" "minted")) +(setq org-latex-listings 'minted) + +(setq org-latex-pdf-process + '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" + "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" + "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")) #+end_src For HTML source code highlight, use =htmlize= #+begin_src emacs-lisp - (use-package htmlize) +(use-package htmlize) #+end_src @@ -554,51 +560,51 @@ Some of my configuration entries where borrowed from other people, see its result in your org file. #+begin_src emacs-lisp - (use-package gnuplot) - (use-package gnuplot-mode) - (use-package ob-rust) - - (org-babel-do-load-languages - 'org-babel-load-languages - '((emacs-lisp . t) - (C . t) - (latex . t) - (gnuplot . t) - (dot . t) - (java . t) - (python . t) - (makefile . t) - (org . t) - (perl . t) - (sed . t) - (shell . t) - (rust . t) - )) +(use-package gnuplot) +(use-package gnuplot-mode) +(use-package ob-rust) + +(org-babel-do-load-languages + 'org-babel-load-languages + '((emacs-lisp . t) + (C . t) + (latex . t) + (gnuplot . t) + (dot . t) + (java . t) + (python . t) + (makefile . t) + (org . t) + (perl . t) + (sed . t) + (shell . t) + (rust . t) + )) #+END_SRC Preserve indentation in source block (useful for makefiles to preserve tabs for example) #+begin_src emacs-lisp - (setq org-src-preserve-indentation t) +(setq org-src-preserve-indentation t) #+end_src Don't ask before evaluating #+begin_src emacs-lisp - (setq org-confirm-babel-evaluate nil) +(setq org-confirm-babel-evaluate nil) #+end_src Correctly associate =dot= language with the correct major-mode inside org. #+begin_src emacs-lisp - (use-package graphviz-dot-mode) - (add-to-list 'org-src-lang-modes '("dot" . graphviz-dot)) +(use-package graphviz-dot-mode) +(add-to-list 'org-src-lang-modes '("dot" . graphviz-dot)) #+end_src Make org mode correctly export quotes #+begin_src emacs-lisp - (setq org-export-with-smart-quotes t) +(setq org-export-with-smart-quotes t) #+end_src @@ -613,19 +619,19 @@ Some of my configuration entries where borrowed from other people, see all buffers. I also set =M-/= to trigger =company-complete= #+begin_src emacs-lisp - (use-package company - :ensure company-lsp - :ensure company-box - :ensure company-php - :ensure company-web - :init - (global-company-mode t) - (global-set-key (kbd "M-/") 'company-complete) - ;; Complete quite soon - :custom - (company-minimum-prefix-length 3) - (company-idle-delay 0.1) - ) +(use-package company + :ensure company-lsp + :ensure company-box + :ensure company-php + :ensure company-web + :init + (global-company-mode t) + (global-set-key (kbd "M-/") 'company-complete) + ;; Complete quite soon + :custom + (company-minimum-prefix-length 3) + (company-idle-delay 0.1) + ) #+end_src #+RESULTS: @@ -636,9 +642,9 @@ Some of my configuration entries where borrowed from other people, see completing symbols in source code. #+begin_src emacs-lisp - (use-package company-box - :ensure frame-local - :hook (company-mode . company-box-mode)) +(use-package company-box + :ensure frame-local + :hook (company-mode . company-box-mode)) #+end_src Now some backends I use. Mainly lsp, php and web @@ -646,10 +652,10 @@ Some of my configuration entries where borrowed from other people, see only when it's needed. #+begin_src emacs-lisp - (use-package company-php) - (use-package company-web) - (use-package company-lsp - :defer t) +(use-package company-php) +(use-package company-web) +(use-package company-lsp + :defer t) #+end_src @@ -663,11 +669,11 @@ Some of my configuration entries where borrowed from other people, see projects. I bind =C-c t= to toggle treemacs panel. #+begin_src emacs-lisp - (use-package treemacs - :custom - (treemacs--icon-size 16) - :bind ("C-c t" . treemacs-select-window) - ) +(use-package treemacs + :custom + (treemacs--icon-size 16) + :bind ("C-c t" . treemacs-select-window) + ) #+end_src ** Projectile @@ -679,16 +685,16 @@ Some of my configuration entries where borrowed from other people, see Bind =C-c p= as the prefix for projectile command keybinds. #+begin_src emacs-lisp - (use-package projectile - :config - (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map) - (projectile-mode t)) +(use-package projectile + :config + (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map) + (projectile-mode t)) #+end_src As I use =treemacs=, adds =treemacs-projectile= plugin #+begin_src emacs-lisp - (use-package treemacs-projectile) +(use-package treemacs-projectile) #+end_src * Snippets @@ -697,10 +703,10 @@ Some of my configuration entries where borrowed from other people, see preload all snippets by [[https://github.com/AndreaCrotti/yasnippet-snippets][AndreaCrotti]] (=yasnippet-snippets= package). #+begin_src emacs-lisp - (use-package yasnippet - :init - (yas-global-mode)) - (use-package yasnippet-snippets) +(use-package yasnippet + :init + (yas-global-mode)) +(use-package yasnippet-snippets) #+end_src @@ -714,20 +720,20 @@ Some of my configuration entries where borrowed from other people, see ** LSP #+begin_src emacs-lisp - (use-package lsp-mode - :hook ( - c++-mode - python-mode - rust-mode - ) - :config - (lsp-headerline-breadcrumb-mode t)) +(use-package lsp-mode + :hook ( + c++-mode + python-mode + rust-mode + ) + :config + (lsp-headerline-breadcrumb-mode t)) #+end_src For displaying more information directly in the buffer, I use =lsp-ui= #+begin_src emacs-lisp - (use-package lsp-ui) +(use-package lsp-ui) #+end_src *** Integration with treemacs @@ -735,9 +741,9 @@ Some of my configuration entries where borrowed from other people, see LSP can integrate with treemacs to display packages, class, symbols and such. #+begin_src emacs-lisp - (use-package lsp-treemacs - :custom - (lsp-treemacs-sync-mode 1)) +(use-package lsp-treemacs + :custom + (lsp-treemacs-sync-mode 1)) #+end_src @@ -747,13 +753,13 @@ Some of my configuration entries where borrowed from other people, see flycheck if available to show code diagnosis. #+begin_src emacs-lisp - (use-package flycheck) +(use-package flycheck) #+end_src For languages that do not have LSP yet, we can add some flycheck extensions #+begin_src emacs-lisp - (use-package flycheck-perl6) +(use-package flycheck-perl6) #+end_src @@ -766,29 +772,29 @@ Some of my configuration entries where borrowed from other people, see called to format buffer when saving. #+begin_src emacs-lisp - (use-package rust-mode - :custom - (lsp-rust-server 'rls) -; (rust-format-on-save t) +(use-package rust-mode + :custom + (lsp-rust-server 'rls) + ; (rust-format-on-save t) - ) + ) #+end_src For this to work, you need to install =rust-analyzer= and =rustmft=. #+begin_src bash - echo "Installing rust-analyzer" - git clone https://github.com/rust-analyzer/rust-analyzer.git && cd rust-analyzer - cargo xtask install --server || echo "failed" - echo "Installing rustfmt" - cargo install rustfmt || echo "failed" +echo "Installing rust-analyzer" +git clone https://github.com/rust-analyzer/rust-analyzer.git && cd rust-analyzer +cargo xtask install --server || echo "failed" +echo "Installing rustfmt" +cargo install rustfmt || echo "failed" #+end_src Adds cargo installed binaries to exec path #+begin_src emacs-lisp - (setq exec-path (cons "~/.cargo/bin" exec-path)) +(setq exec-path (cons "~/.cargo/bin" exec-path)) #+end_src *** Lua @@ -796,7 +802,7 @@ Some of my configuration entries where borrowed from other people, see Simply add =lua-mode= #+begin_src emacs-lisp - (use-package lua-mode) +(use-package lua-mode) #+end_src *** Docker @@ -804,12 +810,12 @@ Some of my configuration entries where borrowed from other people, see For dockerfiles and docker-compose files, install some docker packages #+begin_src emacs-lisp - (use-package dockerfile-mode) - (use-package docker-compose-mode) - (use-package docker) - (use-package docker-api) - (use-package docker-cli) - (use-package docker-tramp) +(use-package dockerfile-mode) +(use-package docker-compose-mode) +(use-package docker) +(use-package docker-api) +(use-package docker-cli) +(use-package docker-tramp) #+end_src *** Web @@ -827,20 +833,20 @@ Some of my configuration entries where borrowed from other people, see the web browser #+begin_src emacs-lisp - (use-package web-mode - :config - (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) - (add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode)) - (add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode)) - (add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode)) - (add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode)) - (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode)) - (add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode)) - (add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode)) - ) - (use-package rainbow-mode) - (use-package simple-httpd) - (use-package impatient-mode) +(use-package web-mode + :config + (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) + (add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode)) + (add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode)) + (add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode)) + (add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode)) + (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode)) + (add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode)) + (add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode)) + ) +(use-package rainbow-mode) +(use-package simple-httpd) +(use-package impatient-mode) #+end_src *** LaTeX @@ -848,23 +854,23 @@ Some of my configuration entries where borrowed from other people, see Enable =reftex= whenever =tex-mode= is activated #+begin_src emacs-lisp - (add-hook 'latex-mode-hook 'reftex-mode) +(add-hook 'latex-mode-hook 'reftex-mode) #+end_src Use =auctex= for better experience editing latex files #+begin_src emacs-lisp - (use-package auctex - :ensure auctex-latexmk - :defer t - ) +(use-package auctex + :ensure auctex-latexmk + :defer t + ) #+end_src If using macos, add mactex to =exec-path= #+begin_src emacs-lisp - (when (eq system-type 'darwin) - (setq exec-path (cons "/Library/TeX/texbin" exec-path))) +(when (eq system-type 'darwin) + (setq exec-path (cons "/Library/TeX/texbin" exec-path))) #+end_src *** Ningx configuration @@ -872,7 +878,7 @@ Some of my configuration entries where borrowed from other people, see A mode to edit [[https://nginx.org/][nginx]] configuration files. #+begin_src emacs-lisp - (use-package nginx-mode) +(use-package nginx-mode) #+end_src ** Magit @@ -888,19 +894,19 @@ Some of my configuration entries where borrowed from other people, see needed #+begin_src emacs-lisp - (use-package magit - :config - (magit-auto-revert-mode t) - (magit-save-repository-buffers t) - :bind ("C-x g" . magit-status) - ) +(use-package magit + :config + (magit-auto-revert-mode t) + (magit-save-repository-buffers t) + :bind ("C-x g" . magit-status) + ) #+end_src *** Protocol buffers #+begin_src emacs-lisp - (use-package protobuf-mode) +(use-package protobuf-mode) #+end_src * Spell checking @@ -908,7 +914,7 @@ Some of my configuration entries where borrowed from other people, see First, set =aspell= to be the spell checking program instead of =ispell= #+begin_src emacs-lisp - (setq ispell-program-name "aspell") +(setq ispell-program-name "aspell") #+end_src #+RESULTS: @@ -917,29 +923,29 @@ Some of my configuration entries where borrowed from other people, see Then define a command that will run flyspell on the buffer *and* activate it #+begin_src emacs-lisp - (defun mh/spellcheck () - (interactive) - (flyspell-mode t) - (flyspell-buffer) - ) +(defun mh/spellcheck () + (interactive) + (flyspell-mode t) + (flyspell-buffer) + ) #+end_src And define a global binding to call it #+begin_src emacs-lisp - (global-set-key (kbd "C-c s") 'mh/spellcheck) +(global-set-key (kbd "C-c s") 'mh/spellcheck) #+end_src Binding to fix a word /then/ go to the next error. Special syntax =[?\C-\$]= is used to protect the =$= sign #+begin_src emacs-lisp - (defun mh/cycle-spellcheck () - (interactive) - (flyspell-goto-next-error) - (ispell-word)) +(defun mh/cycle-spellcheck () + (interactive) + (flyspell-goto-next-error) + (ispell-word)) - (global-set-key (kbd "C-$") 'mh/cycle-spellcheck) +(global-set-key (kbd "C-$") 'mh/cycle-spellcheck) #+end_src @@ -948,20 +954,20 @@ Some of my configuration entries where borrowed from other people, see Adds =/usr/local/bin= to Emacs =exec-path= #+begin_src emacs-lisp - (setq exec-path (cons "/usr/local/bin" exec-path)) +(setq exec-path (cons "/usr/local/bin" exec-path)) #+end_src Starts Emacs server so that we can use =emacsclient= for opening new files. #+begin_src emacs-lisp - (server-start) +(server-start) #+end_src A handy way of starting Emacs from the shell is then to call #+begin_src bash - emacsclient -a emacs ... +emacsclient -a emacs ... #+end_src This will attempt to connect to Emacs server and run Emacs if the @@ -981,23 +987,23 @@ Some of my configuration entries where borrowed from other people, see This will print emacs start time as well as the count of GC calls #+begin_src emacs-lisp - (add-hook 'emacs-startup-hook - (lambda () - (message "Emacs ready in %s with %d garbage collections." - (format "%.2f seconds" - (float-time - (time-subtract after-init-time before-init-time))) - gcs-done))) +(add-hook 'emacs-startup-hook + (lambda () + (message "Emacs ready in %s with %d garbage collections." + (format "%.2f seconds" + (float-time + (time-subtract after-init-time before-init-time))) + gcs-done))) #+end_src [[https://github.com/jschaf/esup][ESup]] is an emacs profiler #+begin_src emacs-lisp - (use-package esup - :ensure t - ;; To use MELPA Stable use ":pin mepla-stable", - :pin melpa - :commands (esup)) +(use-package esup + :ensure t + ;; To use MELPA Stable use ":pin mepla-stable", + :pin melpa + :commands (esup)) #+end_src #+RESULTS: @@ -1009,7 +1015,7 @@ Some of my configuration entries where borrowed from other people, see Set GC threshold to something more reasonable for standard use. #+begin_src emacs-lisp - (setq gc-cons-threshold (* 2 1024 1024)) +(setq gc-cons-threshold (* 2 1024 1024)) #+end_src