1 #+TITLE: Emacs Configuration file
3 #+EMAIL: seudut@gmail.com
7 Most config are just copied from [[https://github.com/howardabrams/dot-files][howardabrams]]'s and [[https://github.com/abo-abo/oremacs][abo-abo's]] dotfiles
11 ** Setting loading Path
13 Set system PATH and emacs exec path
15 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
17 (setenv "PATH" (concat (getenv "PATH")
19 ":" "/Library/TeX/texbin"))
20 (setq exec-path (append exec-path '("/usr/local/bin")))
21 (setq exec-path (append exec-path '("/Library/TeX/texbin/")))
25 Set the emacs load path
27 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
29 (add-to-list 'load-path "~/.emacs.d/elisp")
33 ** Package Initialization
35 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
39 (setq package-archives '(("mepla" . "http://melpa.milkbox.net/packages/")
40 ("gnu" . "http://elpa.gnu.org/packages/")
41 ("org" . "http://orgmode.org/elpa/")))
49 Disable scroll bar, tool-bar and menu-bar
51 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
57 (setq debug-on-error t)
58 (setq inhibit-startup-message t)
60 (defalias 'yes-or-no-p 'y-or-n-p)
69 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
71 (setq custom-file "~/.emacs.d/custom.el")
72 (if (file-exists-p custom-file)
77 Switch the focus to help window when it appears
79 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
81 (setq help-window-select t)
85 * Package Management Tools
89 Using [[https://github.com/jwiegley/use-package][use-package]] to manage emacs packages
91 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
93 (unless (package-installed-p 'use-package)
94 (package-refresh-contents)
95 (package-install 'use-package))
97 (require 'use-package)
103 [[https://github.com/dimitri/el-get][El-get]] is package management tool, whicl allows to install external elisp package from any git repository not in mepla.
104 Check out [[http://tapoueh.org/emacs/el-get.html][el-get]].
106 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
111 (add-to-list 'load-path "~/.emacs.d/el-get"))
115 * Color and Fonts Settings
117 ** highlight current line
119 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
121 (global-hl-line-mode)
127 [[https://github.com/paldepind/smart-comment][smart-comments]]
129 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
131 (use-package smart-comment
133 :bind ("M-;" . smart-conmment))
141 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
143 (global-font-lock-mode 1)
147 [[https://github.com/i-tu/Hasklig][Hasklig]] and Source Code Pro, defined fonts family
149 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
152 (defvar sd/fixed-font-family
153 (cond ((x-list-fonts "Hasklig") "Hasklig")
154 ((x-list-fonts "Source Code Pro") "Source Code Pro")
155 ((x-list-fonts "Anonymous Pro") "Anonymous Pro")
156 ((x-list-fonts "M+ 1mn") "M+ 1mn"))
157 "The fixed width font based on what is installed, `nil' if not defined."))
163 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
166 (when sd/fixed-font-family
167 (set-frame-font sd/fixed-font-family)
168 (set-face-attribute 'default nil :font sd/fixed-font-family :height 140)
169 (set-face-font 'default sd/fixed-font-family)))
175 Loading theme should be after all required loaded, refere [[https://github.com/jwiegley/use-package][:defer]] in =use-package=
177 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
179 (setq vc-follow-symlinks t)
181 (use-package color-theme
183 :init (require 'color-theme)
184 :config (use-package color-theme-sanityinc-tomorrow
188 (load-theme 'sanityinc-tomorrow-bright t)))
190 ;(eval-after-load 'color-theme
191 ; (load-theme 'sanityinc-tomorrow-bright t))
195 Change the Org-mode colors
197 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
199 (defun org-src-color-blocks-light ()
200 "Colors the block headers and footers to make them stand out more for lighter themes"
203 '(org-block-begin-line
204 ((t (:underline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF"))))
205 '(org-block-background
206 ((t (:background "#FFFFEA"))))
208 ((t (:background "#FFFFEA"))))
210 ((t (:overline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF"))))
212 '(mode-line-buffer-id ((t (:foreground "#005000" :bold t))))
213 '(which-func ((t (:foreground "#008000"))))))
215 (defun org-src-color-blocks-dark ()
216 "Colors the block headers and footers to make them stand out more for dark themes"
219 '(org-block-begin-line
220 ((t (:foreground "#008ED1" :background "#002E41"))))
221 '(org-block-background
222 ((t (:background "#000000"))))
224 ((t (:background "#000000"))))
226 ((t (:foreground "#008ED1" :background "#002E41"))))
228 '(mode-line-buffer-id ((t (:foreground "black" :bold t))))
229 '(which-func ((t (:foreground "green"))))))
231 (org-src-color-blocks-dark)
235 improve color for org-mode
236 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
237 (deftheme ha/org-theme "Sub-theme to beautify org mode")
240 (defvar sd/variable-font-tuple
241 (cond ((x-list-fonts "Source Sans Pro") '(:font "Source Sans Pro"))
242 ((x-list-fonts "Lucida Grande") '(:font "Lucida Grande"))
243 ((x-list-fonts "Verdana") '(:font "Verdana"))
244 ((x-family-fonts "Sans Serif") '(:family "Sans Serif"))
245 (nil (warn "Cannot find a Sans Serif Font. Install Source Sans Pro.")))
246 "My variable width font available to org-mode files and whatnot."))
248 (defun sd/org-color ()
249 (let* ((sd/fixed-font-tuple (list :font sd/fixed-font-family))
250 (base-font-color (face-foreground 'default nil 'default))
251 (background-color (face-background 'default nil 'default))
252 (primary-color (face-foreground 'mode-line nil))
253 (secondary-color (face-background 'secondary-selection nil 'region))
254 (base-height (face-attribute 'default :height))
255 (headline `(:inherit default :weight bold :foreground ,base-font-color)))
256 (custom-theme-set-faces 'ha/org-theme
257 `(org-agenda-structure ((t (:inherit default :height 2.0 :underline nil))))
258 `(org-verbatim ((t (:inherit 'fixed-pitched :foreground "#aef"))))
259 `(org-table ((t (:inherit 'fixed-pitched))))
260 `(org-block ((t (:inherit 'fixed-pitched))))
261 `(org-block-background ((t (:inherit 'fixed-pitched))))
262 `(org-block-begin-line ((t (:inherit 'fixed-pitched))))
263 `(org-block-end-line ((t (:inherit 'fixed-pitched))))
264 `(org-level-8 ((t (,@headline ,@sd/variable-font-tuple))))
265 `(org-level-7 ((t (,@headline ,@sd/variable-font-tuple))))
266 `(org-level-6 ((t (,@headline ,@sd/variable-font-tuple))))
267 `(org-level-5 ((t (,@headline ,@sd/variable-font-tuple))))
268 `(org-level-4 ((t (,@headline ,@sd/variable-font-tuple
269 :height ,(round (* 1.1 base-height))))))
270 `(org-level-3 ((t (,@headline ,@sd/variable-font-tuple
271 :height ,(round (* 1.25 base-height))))))
272 `(org-level-2 ((t (,@headline ,@sd/variable-font-tuple
273 :height ,(round (* 1.5 base-height))))))
274 `(org-level-1 ((t (,@headline ,@sd/variable-font-tuple
275 :height ,(round (* 1.75 base-height))))))
276 `(org-document-title ((t (,@headline ,@sd/variable-font-tuple :height 1.5 :underline nil)))))))
283 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
285 (use-package rainbow-delimiters
288 (add-hook 'prog-mode-hook #'rainbow-delimiters-mode))
294 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
296 (use-package page-break-lines
299 (turn-on-page-break-lines-mode))
305 Enable rainbow mode in emacs lisp mode
307 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
308 (use-package rainbow-mode
311 ; (add-hook emacs-lisp-mode-hook 'rainbow-mode)
320 clean mode line, Refer to [[https://www.masteringemacs.org/article/hiding-replacing-modeline-strings][Marstering Emacs]]
322 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
323 (defvar mode-line-cleaner-alist
324 `((auto-complete-mode . " α")
325 (yas/minor-mode . " Ï…")
326 (paredit-mode . " π")
329 (projectile-mode . "")
331 (undo-tree-mode . "")
333 (which-key-mode . "")
335 (smartparens-mode . "")
337 (linum-relative-mode . "")
339 (auto-revert-mode . "")
341 (org-indent-mode . "")
343 (lisp-interaction-mode . "λ")
346 (emacs-lisp-mode . "EL")
348 (nxhtml-mode . "nx"))
349 "Alist for `clean-mode-line'.
351 When you add a new element to the alist, keep in mind that you
352 must pass the correct minor/major mode symbol and a string you
353 want to use in the modeline *in lieu of* the original.")
356 (defun clean-mode-line ()
358 (loop for cleaner in mode-line-cleaner-alist
359 do (let* ((mode (car cleaner))
360 (mode-str (cdr cleaner))
361 (old-mode-str (cdr (assq mode minor-mode-alist))))
363 (setcar old-mode-str mode-str))
365 (when (eq mode major-mode)
366 (setq mode-name mode-str)))))
369 (add-hook 'after-change-major-mode-hook 'clean-mode-line)
374 Install powerline mode [[https://github.com/milkypostman/powerline][powerline]]
376 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
377 (use-package powerline
380 ;; (powerline-center-theme)
383 ;; (use-package smart-mode-line
385 ;; (use-package smart-mode-line-powerline-theme
389 Revised powerline-center-theme
391 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
392 (defun sd/powerline-simpler-vc (s)
394 (replace-regexp-in-string "Git[:-]" "" s)
397 (defun sd/powerline-center-theme_revised ()
398 "Setup a mode-line with major and minor modes centered."
400 (setq-default mode-line-format
403 (let* ((active (powerline-selected-window-active))
404 (mode-line-buffer-id (if active 'mode-line-buffer-id 'mode-line-buffer-id-inactive))
405 (mode-line (if active 'mode-line 'mode-line-inactive))
406 (face1 (if active 'powerline-active1 'powerline-inactive1))
407 (face2 (if active 'powerline-active2 'powerline-inactive2))
408 (separator-left (intern (format "powerline-%s-%s"
409 (powerline-current-separator)
410 (car powerline-default-separator-dir))))
411 (separator-right (intern (format "powerline-%s-%s"
412 (powerline-current-separator)
413 (cdr powerline-default-separator-dir))))
414 (lhs (list (powerline-raw "%*" mode-line 'l)
415 ;; (powerline-buffer-size mode-line 'l)
416 (powerline-buffer-id mode-line-buffer-id 'l)
418 (funcall separator-left mode-line face1)
419 (powerline-narrow face1 'l)
420 ;; (powerline-vc face1)
421 (sd/powerline-simpler-vc (powerline-vc face1))
423 (rhs (list (powerline-raw global-mode-string face1 'r)
424 (powerline-raw "%4l" face1 'r)
425 (powerline-raw ":" face1)
426 (powerline-raw "%3c" face1 'r)
427 (funcall separator-right face1 mode-line)
429 (powerline-raw "%6p" mode-line 'r)
430 (powerline-hud face2 face1)))
431 (center (list (powerline-raw " " face1)
432 (funcall separator-left face1 face2)
433 (when (and (boundp 'erc-track-minor-mode) erc-track-minor-mode)
434 (powerline-raw erc-modified-channels-object face2 'l))
435 (powerline-major-mode face2 'l)
436 (powerline-process face2)
437 (powerline-raw " :" face2)
438 (powerline-minor-modes face2 'l)
439 (powerline-raw " " face2)
440 (funcall separator-right face2 face1))))
441 (concat (powerline-render lhs)
442 (powerline-fill-center face1 (/ (powerline-width center) 2.0))
443 (powerline-render center)
444 (powerline-fill face1 (powerline-width rhs))
445 (powerline-render rhs)))))))
447 (sd/powerline-center-theme_revised)
450 Fix the issue in mode line when showing triangle
452 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
453 (setq ns-use-srgb-colorspace nil)
456 set height in mode line
458 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
460 (custom-set-variables
461 '(powerline-height 14)
462 '(powerline-text-scale-factor 0.8))
464 (set-face-attribute 'mode-line nil :height 100)
470 ** Org-mode Basic setting
472 Always indents header, and hide header leading starts so that no need type =#+STATUP: indent=
474 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
479 (setq org-startup-indented t)
480 (setq org-hide-leading-starts t)
481 (setq org-src-fontify-natively t)
482 (setq org-src-tab-acts-natively t)
483 (setq org-confirm-babel-evaluate nil)
484 (setq org-use-speed-commands t)
485 (setq org-completion-use-ido t))
487 (org-babel-do-load-languages
488 'org-babel-load-languages
502 ;; use current window for org source buffer editting
503 (setq org-src-window-setup 'current-window )
509 use [[https://github.com/sabof/org-bullets][org-bullets]] package to show utf-8 charactes
511 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
513 (use-package org-bullets
516 (add-hook 'org-mode-hook
518 (org-bullets-mode t))))
524 [[https://github.com/abo-abo/worf][worf]] mode is an extension of vi-like binding for org-mode.
525 In =worf-mode=, it is mapping =[=, =]= as =worf-backward= and =worf-forward= in global, wich
526 cause we cannot input =[= and =]=, so here I unset this mappings. And redifined this two to
527 =M-[= and =M-]=. see this [[https://github.com/abo-abo/worf/issues/19#issuecomment-223756599][issue]]
529 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
534 :init (add-hook 'org-mode-hook 'worf-mode)
536 ;; (define-key worf-mode-map "[" nil)
537 ;; (define-key worf-mode-map "]" nil)
538 ;; (define-key worf-mode-map (kbd "M-[") 'worf-backward)
539 ;; (define-key worf-mode-map (kbd "M-]") 'worf-forward)
546 Refer to [[http://doc.norang.ca/org-mode.html][Organize Your Life in Plain Text]]
551 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
552 (global-set-key "\C-cl" 'org-store-link)
553 (global-set-key "\C-ca" 'org-agenda)
554 (global-set-key "\C-cb" 'org-iswitchb)
559 Replace the list bullet =-=, =+=, with =•=, a litter change based [[https://github.com/howardabrams/dot-files/blob/master/emacs-org.org][here]]
561 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
562 (use-package org-mode
564 (font-lock-add-keywords 'org-mode
566 (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))))
571 refer to [[http://coldnew.github.io/coldnew-emacs/#orgheadline94][fancy todo states]],
573 To track TODO state changes, the =!= is to insert a timetamp, =@= is to insert a note with
574 timestamp for the state change.
576 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
577 ;; (setq org-todo-keywords
578 ;; '((sequence "☛ TODO(t)" "|" "✔ DONE(d)")
579 ;; (sequence "âš‘ WAITING(w)" "|")
580 ;; (sequence "|" "✘ CANCELLED(c)")))
581 ; (setq org-todo-keyword-faces
582 ; (quote ("TODO" . (:foreground "red" :weight bold))
583 ; ("NEXT" . (:foreground "blue" :weight bold))
584 ; ("WAITING" . (:foreground "forest green" :weight bold))
585 ; ("DONE" . (:foreground "magenta" :weight bold))
586 ; ("CANCELLED" . (:foreground "forest green" :weight bold))))
589 (setq org-todo-keywords
590 (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!)")
591 ;; (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "PHONE" "MEETING")
592 (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" ))))
594 (setq org-todo-keyword-faces
595 (quote (("TODO" :foreground "red" :weight bold)
596 ("NEXT" :foreground "blue" :weight bold)
597 ("DONE" :foreground "forest green" :weight bold)
598 ("WAITING" :foreground "orange" :weight bold)
599 ("HOLD" :foreground "magenta" :weight bold)
600 ("CANCELLED" :foreground "forest green" :weight bold)
601 ;; ("MEETING" :foreground "forest green" :weight bold)
602 ;; ("PHONE" :foreground "forest green" :weight bold)
608 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
609 (setq org-use-fast-todo-selection t)
610 (setq org-treat-S-cursor-todo-selection-as-state-change nil)
613 TODO state triggers and tags, [[http://doc.norang.ca/org-mode.html][Organize Your Life in Plain Text]]
615 - Moving a task to =CANCELLED=, adds a =CANCELLED= tag
616 - Moving a task to =WAITING=, adds a =WAITING= tag
617 - Moving a task to =HOLD=, add =HOLD= tags
618 - Moving a task to =DONE=, remove =WAITING=, =HOLD= tag
619 - Moving a task to =NEXT=, remove all waiting/hold/cancelled tags
621 This tags are used to filter tasks in agenda views
622 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
623 (setq org-todo-state-tags-triggers
624 (quote (("CANCELLED" ("CANCELLED" . t))
625 ("WAITING" ("WAITING" . t))
626 ("HOLD" ("WAITING") ("HOLD" . t))
627 (done ("WAITING") ("HOLD"))
628 ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
629 ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
630 ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))
633 *** Capture - Refile - Archive
635 Capture lets you quickly store notes with little interruption of your work flow.
637 **** Capture Templates
639 When a new taks needs to be added, categorize it as
641 All captured file which need next actions are stored in =refile.org=,
642 - A new task / note (t) =refile.org=
643 - A work task in office =office.org=
644 - A jourenl =diary.org=
645 - A new habit (h) =refile.org=
647 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
648 (setq org-directory "~/org")
649 (setq org-default-notes-file "~/org/refile.org")
650 (setq sd/org-diary-file "~/org/diary.org")
652 (global-set-key (kbd "C-c c") 'org-capture)
654 (setq org-capture-templates
655 (quote (("t" "Todo" entry (file org-default-notes-file)
656 "* TODO %?\n%a\n" :clock-in t :clock-resume t)
657 ("n" "Note" entry (file org-default-notes-file)
658 "* %? :NOTE:\n%a\n" :clock-in t :clock-resume t)
659 ("j" "Journal" entry (file+datetree sd/org-diary-file)
660 "* %?\n" :clock-in t :clock-resume t)
661 ("h" "Habit" entry (file org-default-notes-file)
662 "* NEXT %?\n%a\nSCHEDULED: %(format-time-string \"%<<%Y-%m-%d %a .+1d/3d>>\")\n:PROPERTITES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n "))))
666 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
667 (setq org-agenda-files (quote ("~/org/plan.org"
675 Install MacTex-basic and some tex packages
679 sudo tlmgr update --self
681 sudo tlmgr install titlesec framed threeparttable wrapfig multirow enumitem bbding titling tabu mdframed tcolorbox textpos import varwidth needspace tocloft ntheorem environ trimspaces collection-fontsrecommended capt-of
685 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
686 ;; ;; allow for export=>beamer by placing
688 ;; http://emacs-fu.blogspot.com/2011/04/nice-looking-pdfs-with-org-mode-and.html
689 ;; #+LaTeX_CLASS: beamer in org files
690 (unless (boundp 'org-export-latex-classes)
691 (setq org-export-latex-classes nil))
692 (add-to-list 'org-export-latex-classes
693 ;; beamer class, for presentations
695 "\\documentclass[11pt]{beamer}\n
696 \\mode<{{{beamermode}}}>\n
697 \\usetheme{{{{beamertheme}}}}\n
698 \\usecolortheme{{{{beamercolortheme}}}}\n
699 \\beamertemplateballitem\n
700 \\setbeameroption{show notes}
701 \\usepackage[utf8]{inputenc}\n
702 \\usepackage[T1]{fontenc}\n
703 \\usepackage{hyperref}\n
705 \\usepackage{listings}
706 \\lstset{numbers=none,language=[ISO]C++,tabsize=4,
709 showspaces=false,showstringspaces=false,
711 keywordstyle=\\color{blue}\\bfseries,
712 commentstyle=\\color{red},
714 \\usepackage{verbatim}\n
715 \\institute{{{{beamerinstitute}}}}\n
716 \\subject{{{{beamersubject}}}}\n"
718 ("\\section{%s}" . "\\section*{%s}")
720 ("\\begin{frame}[fragile]\\frametitle{%s}"
722 "\\begin{frame}[fragile]\\frametitle{%s}"
725 ;; letter class, for formal letters
727 (add-to-list 'org-export-latex-classes
730 "\\documentclass[11pt]{letter}\n
731 \\usepackage[utf8]{inputenc}\n
732 \\usepackage[T1]{fontenc}\n
735 ("\\section{%s}" . "\\section*{%s}")
736 ("\\subsection{%s}" . "\\subsection*{%s}")
737 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
738 ("\\paragraph{%s}" . "\\paragraph*{%s}")
739 ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
745 (setq org-latex-pdf-process
746 '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
747 "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
748 "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
750 (setq TeX-parse-self t)
752 (setq TeX-PDF-mode t)
753 (add-hook 'LaTeX-mode-hook
756 (setq TeX-master t)))
762 extend org-mode's easy templates, refer to [[http://coldnew.github.io/coldnew-emacs/#orgheadline94][Extend org-modes' esay templates]]
764 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
766 (add-to-list 'org-structure-template-alist
767 '("E" "#+BEGIN_SRC emacs-lisp :tangle yes :results silent\n?\n#+END_SRC"))
768 (add-to-list 'org-structure-template-alist
769 '("S" "#+BEGIN_SRC sh\n?\n#+END_SRC"))
770 (add-to-list 'org-structure-template-alist
771 '("p" "#+BEGIN_SRC plantuml :file uml.png \n?\n#+END_SRC"))
777 [[https://github.com/magit/magit][Magit]] is a very cool git interface on Emacs.
779 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
783 :commands magit-status magit-blame)
791 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
795 :init (setq ido-enable-flex-matching t
796 ido-ignore-extensions t
797 ido-use-virtual-buffers t
802 (add-to-list 'completion-ignored-extensions ".pyc"))
810 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
814 :init (setq ido-enable-flex-matching t
816 :config (flx-ido-mode 1))
822 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
824 (use-package ido-vertical-mode
827 (setq ido-vertical-define-keys 'C-n-C-p-up-and-down)
829 (ido-vertical-mode 1))
835 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
839 :init (smex-initialize)
842 ("M-X" . smex-major-mode-commands))
848 Use [[https://github.com/DarwinAwardWinner/ido-ubiquitous][ido-ubiquitous]] for ido everywhere. It makes =describe-function= can also use ido
850 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
852 (use-package ido-ubiquitous
855 (setq magit-completing-read-function 'magit-ido-completing-read)
856 (setq gnus-completing-read-function 'gnus-ido-completing-read)
858 (ido-ubiquitous-mode 1))
864 [[https://github.com/waymondo/ido-exit-target][ido-exit-target]] let you open file/buffer on =other-windows= when call =ido-switch-buffer=
866 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
868 (use-package ido-exit-target
871 (define-key ido-common-completion-map (kbd "C-j") #'ido-exit-target-split-window-right)
872 (define-key ido-common-completion-map (kbd "C-l") #'ido-exit-target-split-window-below))
878 ** Remove prefix =ESC=, refer [[http://emacs.stackexchange.com/questions/14755/how-to-remove-bindings-to-the-esc-prefix-key][here]]
880 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
882 ;; (define-key key-translation-map (kbd "ESC") (kbd "C-g"))
888 Use =ESC= to exit minibuffer. Also I map =Super-h= the same as =C-g=
890 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
892 (define-key minibuffer-local-map [escape] 'keyboard-escape-quit)
893 (define-key minibuffer-local-map [escape] 'keyboard-escape-quit)
894 (define-key minibuffer-local-ns-map [escape] 'keyboard-escape-quit)
895 (define-key minibuffer-local-isearch-map [escape] 'keyboard-escape-quit)
896 (define-key minibuffer-local-completion-map [escape] 'keyboard-escape-quit)
897 (define-key minibuffer-local-must-match-map [escape] 'keyboard-escape-quit)
898 (define-key minibuffer-local-must-match-filename-map [escape] 'keyboard-escape-quit)
899 (define-key minibuffer-local-filename-completion-map [escape] 'keyboard-escape-quit)
900 (define-key minibuffer-local-filename-must-match-map [escape] 'keyboard-escape-quit)
902 ;; Also map s-h same as C-g
903 (define-key minibuffer-local-map (kbd "s-h") 'keyboard-escape-quit)
907 ** =Ctrl= key bindings
909 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
913 ;; C-j newline and indent
915 ;; C-l recenter-top-bottom
916 ;; (global-set-key (kbd "C-;") 'ido-switch-buffer)
953 ** =Super= bindings for file, buffer and windows
955 Some global bindings on =Super=, on Mac, it is =Command=
957 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
959 (global-set-key (kbd "s-h") 'keyboard-quit)
960 (global-set-key (kbd "s-j") 'ido-switch-buffer)
961 (global-set-key (kbd "s-k") 'ido-find-file)
962 ;; s-k --> kill-this-buffer
963 (global-set-key (kbd "s-l") (lambda ()
965 (if (> (length (window-list)) 1)
967 (message "Only one Windows now!"))))
969 (global-set-key (kbd "s-;") 'swiper)
971 ;; s-' --> 'next-multiframe-window
972 (global-set-key (kbd "<s-return>") 'toggle-frame-fullscreen)
974 ;; (global-set-key (kbd "s-y") 'projectile-find-file)
975 (global-set-key (kbd "s-f") 'projectile-find-file)
976 (global-set-key (kbd "s-[") 'persp-next)
977 (global-set-key (kbd "s-]") 'persp-prev)
979 (global-set-key (kbd "s-`") 'mode-line-other-buffer)
981 (global-set-key (kbd "s-n") 'persp-next)
982 (global-set-key (kbd "s-p") 'persp-prev)
986 ;; someothers default mapping on super (command) key
988 ;; s-k kill-this-buffer
991 ;; s-h --> ns-do-hide-emacs
992 ;; s-j --> ido-switch-buffer +
993 ;; s-k --> kill-this-buffer
996 ;; s-' --> next-multiframe-window
997 ;; s-ret --> toggle-frame-fullscreen +
999 ;; s-y --> ns-paste-secondary
1000 ;; s-u --> revert-buffer
1001 ;; s-i --> undefined - but used for iterm globally
1002 ;; s-o --> used for emacs globally
1003 ;; s-p --> projectile-persp-switch-project +
1004 ;; s-[ --> next-buffer +
1005 ;; s-] --> previous-buffer +
1007 ;; s-0 --> undefined
1008 ;; s-9 --> undefined
1009 ;; s-8 --> undefined
1010 ;; s-7 --> undefined
1011 ;; s-6 --> undefined
1012 ;; s-- --> center-line
1013 ;; s-= --> undefined
1015 ;; s-n --> make-frame
1016 ;; s-m --> iconify-frame
1017 ;; s-b --> undefined
1018 ;; s-, --> customize
1019 ;; s-. --> undefined
1020 ;; s-/ --> undefined
1022 ;; s-g --> isearch-repeat-forward
1023 ;; s-f --> projectile-find-file +
1024 ;; s-d --> isearch-repeat-background
1025 ;; s-s --> save-buffer
1026 ;; s-a --> make-whole-buffer
1028 ;; s-b --> undefined
1030 ;; s-c --> ns-copy-including-secondary
1032 ;; s-t --> ns-popup-font-panel
1033 ;; s-r --> undefined
1034 ;; s-e --> isearch-yanqk-kill
1035 ;; s-w --> delete-frame
1036 ;; s-q --> same-buffers-kill-emacs
1038 ;; s-` --> other-frame
1041 ** =M-s= bindings for searching
1043 I use the prefix =M-s= for searching in buffers
1045 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1047 (defun pl-make-keymap (key bindings)
1048 (setq keymap (make-sparse-keymap))
1049 (dolist (binding bindings)
1050 (define-key keymap (car binding) (cdr binding)))
1051 (global-set-key key keymap))
1053 (define-key minibuffer-local-map "\M-s" nil)
1055 (global-set-key (kbd "M-s s") 'isearch-forward-regexp)
1056 (define-key isearch-mode-map "\M-s" 'isearch-repeat-forward)
1057 (global-set-key (kbd "M-s r") 'isearch-backward-regexp)
1058 (define-key isearch-mode-map "\M-r" 'isearch-repeat-backward)
1060 (global-set-key (kbd "s-/") 'isearch-forward-regexp)
1061 (define-key isearch-mode-map (kbd "s-/") 'isearch-repeat-forward)
1062 (define-key isearch-mode-map (kbd "C-n") 'isearch-repeat-forward)
1065 (set-face-background 'ido-first-match "white")
1068 ;; M-s s --> isearch-forward-regexp
1069 ;; M-s r --> isearch-backward-regexp
1070 ;; M-s w --> isearch-forward-word
1071 ;; M-s . --> isearch-forward-symbol-at-point
1072 ;; M-s _ --> isearch-forward-symbol
1074 ;; highlight bindings
1075 ;; M-s h . --> highlight-symbol-at-point
1076 ;; M-s h r --> highlight-regexp
1077 ;; M-s h u --> unhighlight-regexp
1078 ;; M-s h l --> highlight-lines-match-regexp
1079 ;; M-s h p --> highlight-phrase
1080 ;; M-s h f --> hi-lock-find-patterns
1083 ;; (global-set-key (kbd "M-s M-r") 'isearch-backward-regexp)
1092 Occur search key bindings
1094 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1096 (define-key occur-mode-map (kbd "C-n")
1100 (occur-mode-goto-occurrence-other-window)
1104 (define-key occur-mode-map (kbd "C-p")
1108 (occur-mode-goto-occurrence-other-window)
1115 ** =M-o= as prefix key for windows
1117 ** =M-g= as prefix key for launcher
1121 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1132 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1134 (defalias 'e 'ido-find-file)
1135 (defalias 'ff 'ido-find-file)
1136 (defalias 'ee 'ido-find-file-other-window)
1140 Quickly start eshll in split window below, refer [[http://www.howardism.org/Technical/Emacs/eshell-fun.html][eshell-here]]
1142 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1149 (defun eshell-here ()
1150 "Opens up a new shell in the directory associated with the
1151 current buffer's file. The eshell is renamed to match that
1152 directory to make multiple eshell windows easier."
1154 (let* ((parent (if (buffer-file-name)
1155 (file-name-directory (buffer-file-name))
1157 (height (/ (window-total-height) 3))
1158 (name (car (last (split-string parent "/" t))))
1159 (eshell-name (concat "*eshell: " name "*")))
1160 (split-window-vertically (- height))
1162 (if (get-buffer eshell-name)
1164 (message "buffer exist")
1165 (switch-to-buffer eshell-name))
1168 (rename-buffer eshell-name)
1170 (insert (concat "ls"))
1171 (eshell-send-input)))))
1173 ;; (global-set-key (kbd "M-`") (lambda ()
1175 ;; (if (buffer-name))))
1181 ** [[https://github.com/abo-abo/hydra][Hydra]]
1183 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1192 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1194 (defhydra sd/font-zoom (global-map "<f2>")
1196 ("g" text-scale-increase "in")
1197 ("l" text-scale-decrease "out"))
1201 *** Windmove Splitter
1203 Refer [[https://github.com/abo-abo/hydra/blob/master/hydra-examples.el][hydra-example]], to enlarge or shrink the windows splitter
1205 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1207 (defun hydra-move-splitter-left (arg)
1208 "Move window splitter left."
1210 (if (let ((windmove-wrap-around))
1211 (windmove-find-other-window 'right))
1212 (shrink-window-horizontally arg)
1213 (enlarge-window-horizontally arg)))
1215 (defun hydra-move-splitter-right (arg)
1216 "Move window splitter right."
1218 (if (let ((windmove-wrap-around))
1219 (windmove-find-other-window 'right))
1220 (enlarge-window-horizontally arg)
1221 (shrink-window-horizontally arg)))
1223 (defun hydra-move-splitter-up (arg)
1224 "Move window splitter up."
1226 (if (let ((windmove-wrap-around))
1227 (windmove-find-other-window 'up))
1228 (enlarge-window arg)
1229 (shrink-window arg)))
1231 (defun hydra-move-splitter-down (arg)
1232 "Move window splitter down."
1234 (if (let ((windmove-wrap-around))
1235 (windmove-find-other-window 'up))
1237 (enlarge-window arg)))
1243 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1247 (defhydra sd/hydra-window (:color red :columns nil)
1249 ("h" windmove-left nil)
1250 ("j" windmove-down nil)
1251 ("k" windmove-up nil)
1252 ("l" windmove-right nil)
1253 ("H" hydra-move-splitter-left nil)
1254 ("J" hydra-move-splitter-down nil)
1255 ("K" hydra-move-splitter-up nil)
1256 ("L" hydra-move-splitter-right nil)
1259 (split-window-right)
1264 (split-window-below)
1267 ("o" delete-other-windows "one" :exit t)
1268 ("a" ace-window "ace")
1269 ("s" ace-swap-window "swap")
1270 ("d" ace-delete-window "ace-one" :exit t)
1271 ("i" ace-maximize-window "ace-one" :exit t)
1272 ("b" ido-switch-buffer "buf")
1273 ("m" headlong-bookmark-jump "bmk")
1275 ("u" (progn (winner-undo) (setq this-command 'winner-undo)) "undo")
1276 ("r" (progn (winner-redo) (setq this-command 'winner-redo)) "redo")
1279 (global-unset-key (kbd "M-o"))
1280 (global-set-key (kbd "M-o") 'sd/hydra-window/body)
1282 (defun triggle-windows-max-size ()
1284 (if (> (length (window-list)) 1)
1285 (delete-other-windows)
1292 Enable linum mode on programming modes
1294 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1296 (add-hook 'prog-mode-hook 'linum-mode)
1300 Fix the font size of line number
1302 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1304 (defun fix-linum-size ()
1306 (set-face-attribute 'linum nil :height 110))
1308 (add-hook 'linum-mode-hook 'fix-linum-size)
1312 I like [[https://github.com/coldnew/linum-relative][linum-relative]], just like the =set relativenumber= on =vim=
1314 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1316 (use-package linum-relative
1319 (defun linum-new-mode ()
1320 "If line numbers aren't displayed, then display them.
1321 Otherwise, toggle between absolute and relative numbers."
1324 (linum-relative-toggle)
1328 ("A-k" . linum-new-mode))
1330 ;; auto enable linum-new-mode in programming modes
1331 (add-hook 'prog-mode-hook 'linum-relative-mode)
1335 ** Save File Position
1337 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1339 (require 'saveplace)
1340 (setq-default save-place t)
1341 (setq save-place-forget-unreadable-files t)
1342 (setq save-place-skip-check-regexp "\\`/\\(?:cdrom\\|floppy\\|mnt\\|/[0-9]\\|\\(?:[^@/:]*@\\)?[^@/:]*[^@/:.]:\\)")
1348 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1350 (use-package multi-term
1357 [[https://github.com/abo-abo/ace-link][ace-link]] is a package written by [[https://github.com/abo-abo][Oleh Krehel]]. It is convenient to jump to link in help mode, info-mode, etc
1358 Type =o= to go to the link
1360 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1362 (use-package ace-link
1365 (ace-link-setup-default))
1371 [[https://github.com/re5et/emux][emux]] is
1373 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1375 (el-get-bundle re5et/emux)
1381 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1383 (use-package smartparens
1387 (require 'smartparens-config)
1388 (add-hook 'prog-mode-hook 'smartparens-mode)))
1394 [[https://github.com/abo-abo/ace-window][ace-window]]
1396 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1398 (use-package ace-window
1402 ; (global-set-key (kbd "M-o") 'ace-window)
1404 (setq aw-keys '(?a ?s ?d ?f ?j ?k ?l)))
1410 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1412 (use-package projectile
1415 (setq projectile-enable-caching t)
1417 (projectile-global-mode t))
1419 (use-package persp-projectile
1424 (:map projectile-mode-map
1425 ("s-t" . projectile-persp-switch-project)))
1427 ;; projectile-find-file
1428 ;; projectile-switch-buffer
1429 ;; projectile-find-file-other-window
1434 [[https://github.com/justbur/emacs-which-key][which-key]] show the key bindings
1436 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1438 (use-package which-key
1447 We can use [[https://www.gnu.org/software/emms/quickstart.html][Emms]] for multimedia in Emacs
1449 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1454 (setq emms-source-file-default-directory "~/Music/emms/")
1457 (emms-default-players)
1458 (define-emms-simple-player mplayer '(file url)
1459 (regexp-opt '(".ogg" ".mp3" ".mgp" ".wav" ".wmv" ".wma" ".ape"
1460 ".mov" ".avi" ".ogm" ".asf" ".mkv" ".divx" ".mpeg"
1461 "http://" "mms://" ".rm" ".rmvb" ".mp4" ".flac" ".vob"
1462 ".m4a" ".flv" ".ogv" ".pls"))
1463 "mplayer" "-slave" "-quiet" "-really-quiet" "-fullscreen")
1464 (emms-history-load))
1470 Play Go in Emacs, gnugo xpm refert [[https://github.com/okanotor/dotemacs/blob/f95b774cb292d1169748bc0a62ba647bbd8c0652/etc/my-inits/my-inits-gnugo.el][to here]]. start at image display mode and grid mode
1472 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1478 (require 'gnugo-imgen)
1479 (setq gnugo-xpms 'gnugo-imgen-create-xpms)
1480 (add-hook 'gnugo-start-game-hook '(lambda ()
1481 (gnugo-image-display-mode)
1484 (add-to-list 'gnugo-option-history (format "--boardsize 19 --color black --level 1")))
1490 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1492 (use-package undo-tree
1495 (global-undo-tree-mode 1))
1501 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1508 (setq ivy-use-virtual-buffers t)
1509 ;; (global-set-key "\C-s" 'swiper)
1510 ;; (global-set-key (kbd "C-c C-r") 'ivy-resume)
1511 ;; (global-set-key (kbd "<f6>") 'ivy-resume)
1512 ;; ;; (global-set-key (kbd "M-x") 'counsel-M-x)
1513 ;; ;; (global-set-key (kbd "C-x C-f") 'counsel-find-file)
1514 ;; (global-set-key (kbd "<f1> f") 'counsel-describe-function)
1515 ;; (global-set-key (kbd "<f1> v") 'counsel-describe-variable)
1516 ;; (global-set-key (kbd "<f1> l") 'counsel-load-library)
1517 ;; (global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
1518 ;; (global-set-key (kbd "<f2> u") 'counsel-unicode-char)
1519 ;; (global-set-key (kbd "C-c g") 'counsel-git)
1520 ;; (global-set-key (kbd "C-c j") 'counsel-git-grep)
1521 ;; (global-set-key (kbd "C-c k") 'counsel-ag)
1522 ;; (global-set-key (kbd "C-x l") 'counsel-locate)
1523 ;; (global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
1524 ;; ;; (define-key read-expression-map (kbd "C-r") 'counsel-expression-history)
1530 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1532 ;; (use-package tabbar-ruler
1535 ;; (setq tabbar-ruler-global-tabbar t)
1536 ;; (setq tabbar-ruler-global-ruler t)
1537 ;; (setq tabbar-ruler-popu-menu t)
1538 ;; (setq tabbar-ruler-popu-toolbar t)
1539 ;; (setq tabbar-use-images t)
1541 ;; (tabbar-ruler-group-by-projectile-project)
1542 ;; (global-set-key (kbd "s-1") 'tabbar-forward-group)
1543 ;; (global-set-key (kbd "s-2") 'tabbar-ruler-forward))
1553 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1555 (use-package color-identifiers-mode
1558 (add-hook 'emacs-lisp-mode-hook 'color-identifiers-mode)
1560 :diminish color-identifiers-mode)
1562 (global-prettify-symbols-mode t)
1568 In Lisp Mode, =M-o= is defined, but I use this for global hydra window. So here disable this key
1569 bindings in =lispy-mode-map= after loaded. see [[http://stackoverflow.com/questions/298048/how-to-handle-conflicting-keybindings][here]]
1571 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1576 (eval-after-load 'lispy
1578 (define-key lispy-mode-map (kbd "M-o") nil)))
1580 (add-hook 'emacs-lisp-mode-hook (lambda () (lispy-mode 1))))
1586 [[https://www.emacswiki.org/emacs/CPerlMode][CPerl mode]] has more features than =PerlMode= for perl programming. Alias this to =CPerlMode=
1588 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1590 (defalias 'perl-mode 'cperl-mode)
1592 ;(setq cperl-hairy t) ;; Turns on most of the CPerlMode options
1593 (setq cperl-auto-newline t)
1594 (setq cperl-highlight-variables-indiscriminately t)
1595 ;(setq cperl-indent-level 4)
1596 ;(setq cperl-continued-statement-offset 4)
1597 (setq cperl-close-paren-offset -4)
1598 (setq cperl-indent-parents-as-block t)
1599 (setq cperl-tab-always-indent t)
1600 ;(setq cperl-brace-offset 0)
1602 (add-hook 'cperl-mode-hook
1604 (cperl-set-style "C++")))
1606 ;(require 'template)
1607 ;(template-initialize)
1615 Change the compile-command to set the default command run when call =compile=
1616 Mapping =s-r= (on Mac, it's =Command + R= to run the script. Here =current-prefix-arg= is set
1617 to call =compilation= interactively.
1619 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1621 (defun my-perl-hook ()
1623 (setq-local compilation-read-command nil)
1624 (set (make-local-variable 'compile-command)
1625 (concat "/usr/bin/perl "
1626 (if buffer-file-name
1627 (shell-quote-argument buffer-file-name))))
1628 (local-set-key (kbd "s-r")
1631 ; (setq current-prefix-arg '(4)) ; C-u
1632 (call-interactively 'compile)))))
1634 (add-hook 'cperl-mode-hook 'my-perl-hook)
1641 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1643 (setq c-default-style "stroustrup"
1650 Set the environments vairables in compilation mode
1652 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1654 (use-package compile
1657 (setq compilation-environment (cons "LC_ALL=C" compilation-environment)))
1663 Enable auto-insert mode
1665 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1667 (auto-insert-mode t)
1668 (setq auto-insert-query nil)
1674 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1676 (eval-after-load 'autoinsert
1677 '(define-auto-insert '("\\.cpp\\'" . "C++ skeleton")
1679 "Short description:"
1681 "\n * " (file-name-nondirectory (buffer-file-name))
1683 "#include <iostream>" \n
1685 (file-name-sans-extension
1686 (file-name-nondirectory (buffer-file-name)))
1688 "using namespace std;" \n \n
1696 (eval-after-load 'autoinsert
1697 '(define-auto-insert '("\\.c\\'" . "C skeleton")
1699 "Short description:"
1701 " * " (file-name-nondirectory (buffer-file-name)) "\n"
1703 "#include <stdio.h>" \n
1705 (file-name-sans-extension
1706 (file-name-nondirectory (buffer-file-name)))
1717 *** Perl Auto Insert
1719 Refer [[https://www.emacswiki.org/emacs/AutoInsertMode][AutoInsertMode]] Wiki
1721 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1723 (eval-after-load 'autoinsert
1724 '(define-auto-insert '("\\.pl\\'" . "Perl skeleton")
1727 "#!/usr/bin/perl -w" \n
1738 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1740 (use-package company
1742 :diminish company-mode
1743 :init (setq company-idle-delay 0.1)
1745 (global-company-mode))
1749 [[https://github.com/company-mode/company-statistics][company-statistics]]
1751 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
1753 (use-package company-statistics
1756 (company-statistics-mode))
1762 - change M-o to trigger to delete other windows and restore previous config