** First line
#+begin_src emacs-lisp :comments none
-;;; init.el --- Amin Bandali's Emacs config -*- lexical-binding: t -*-
+;;; init.el --- Amin Bandali's Emacs config -*- lexical-binding: t; eval: (view-mode 1) -*-
#+end_src
Enable =view-mode=, which both makes the file read-only (as a reminder
:CUSTOM_ID: initial-setup
:END:
-#+begin_src emacs-lisp :comments none
-;;; Code:
-
-\f
-;; * Initial setup
-#+end_src
-
** Emacs initialization
I'd like to do a couple of measurements of Emacs' startup time. First,
:CUSTOM_ID: core
:END:
-#+begin_src emacs-lisp :comments none
-\f
-;; * Core
-#+end_src
-
** Defaults
*** Time and battery in mode-line
(winner-mode 1)
#+end_src
-*** Close =*compilation*= on success
+*** Don’t display =*compilation*= on success
+
+From https://stackoverflow.com/a/17788551.
#+begin_src emacs-lisp
-(setq compilation-exit-message-function
- (lambda (status code msg)
- "Close the compilation window if successful."
- ;; if M-x compile exits with 0
- (when (and (eq status 'exit) (zerop code))
- (bury-buffer)
- (delete-window (get-buffer-window (get-buffer "*compilation*"))))
- ;; return the result of compilation-exit-message-function
- (cons msg code)))
+(defun amin--compilation-finish-function (buffer outstr)
+ (unless (string-match "finished" outstr)
+ (switch-to-buffer-other-window buffer))
+ t)
+
+(setq compilation-finish-functions #'amin--compilation-finish-function)
+
+(require 'cl)
+
+(defadvice compilation-start
+ (around inhibit-display
+ (command &optional mode name-function highlight-regexp))
+ (if (not (string-match "^\\(find\\|grep\\)" command))
+ (flet ((display-buffer)
+ (set-window-point)
+ (goto-char))
+ (fset 'display-buffer 'ignore)
+ (fset 'goto-char 'ignore)
+ (fset 'set-window-point 'ignore)
+ (save-window-excursion
+ ad-do-it))
+ ad-do-it))
+
+(ad-activate 'compilation-start)
#+end_src
*** Search for non-ASCII characters
* Borg's =layer/essentials=
-#+begin_src emacs-lisp :comments none
-\f
-;; * Borg's `layer/essentials'
-#+end_src
-
TODO: break this giant source block down into individual org sections.
#+begin_src emacs-lisp
(add-to-list 'tramp-default-proxies-alist
(list (regexp-quote (system-name)) nil nil)))
-(use-package undo-tree
- :config
- (global-undo-tree-mode -1))
- ;; :bind (("C-?" . undo-tree-undo)
- ;; ("M-_" . undo-tree-redo))
- ;; :config
- ;; (global-undo-tree-mode)
- ;; (setq undo-tree-mode-lighter ""
- ;; undo-tree-auto-save-history t))
#+end_src
* Editing
-#+begin_src emacs-lisp :comments none
-\f
-;; * Editing
-#+end_src
-
** Company
#+begin_src emacs-lisp
* Syntax and spell checking
-#+begin_src emacs-lisp :comments none
-\f
-;; * Syntax and spell checking
-#+end_src
-
#+begin_src emacs-lisp
(use-package flycheck
:defer 3
#+end_src
* Programming modes
-#+begin_src emacs-lisp :comments none
-\f
-;; * Programming modes
-#+end_src
-
** [[http://alloytools.org][Alloy]] (with [[https://github.com/dwwmmn/alloy-mode][alloy-mode]])
#+begin_src emacs-lisp
* Emacs Enhancements
-#+begin_src emacs-lisp :comments none
-\f
-;; * Emacs Enhancements
-#+end_src
-
** [[https://github.com/justbur/emacs-which-key][which-key]]
#+begin_quote
* Email
-#+begin_src emacs-lisp :comments none
-\f
-;; * Email
-#+end_src
-
#+begin_src emacs-lisp
(defvar amin-maildir (expand-file-name "~/mail/"))
(after! recentf
* Blogging
-#+begin_src emacs-lisp :comments none
-\f
-;; * Blogging
-#+end_src
-
** [[https://ox-hugo.scripter.co][ox-hugo]]
#+begin_src emacs-lisp
:CUSTOM_ID: post-initialization
:END:
-#+begin_src emacs-lisp :comments none
-\f
-;; * Post initialization
-#+end_src
-
Display how long it took to load the init file.
#+begin_src emacs-lisp