** First line
#+begin_src emacs-lisp :comments none
-;;; init.el --- Amin Bandali's Emacs config -*- lexical-binding: t ; eval: (view-mode 1)-*-
+;;; 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
;; amin-... public variables or non-interactive functions
;; amin--... private anything (non-interactive), not safe for direct use
;; amin/... an interactive function; safe for M-x or keybinding
-;; amin:... an evil operator, motion, or command
;; amin|... a hook function
;; amin*... an advising function
;; amin@... a hydra command
:CUSTOM_ID: initial-setup
:END:
-#+begin_src emacs-lisp :comments none
-;;; Code:
-#+end_src
-
** Emacs initialization
I'd like to do a couple of measurements of Emacs' startup time. First,
Font stack with better unicode support, around =Ubuntu Mono= and
=Hack=.
-#+begin_src emacs-lisp :tangle no
+#+begin_src emacs-lisp
(dolist (ft (fontset-list))
(set-fontset-font
ft
(winner-mode 1)
#+end_src
-*** Close =*compilation*= on success
+*** Don’t display =*compilation*= on success
+
+Based on https://stackoverflow.com/a/17788551, with changes to use
+=cl-letf= instead of the now obsolete =flet=.
#+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)))
+(use-package compile
+ :config
+ (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-macs)
+
+ (defadvice compilation-start
+ (around inhibit-display
+ (command &optional mode name-function highlight-regexp))
+ (if (not (string-match "^\\(find\\|grep\\)" command))
+ (cl-letf (((symbol-function 'display-buffer) #'ignore))
+ (save-window-excursion ad-do-it))
+ ad-do-it))
+ (ad-activate 'compilation-start))
#+end_src
*** Search for non-ASCII characters
(let* ((file-tangle-start-time (current-time))
(file (buffer-file-name))
(file-nodir (file-name-nondirectory file))
- (async-quiet-switch "-q"))
+ ;; (async-quiet-switch "-q")
+ )
(async-start
`(lambda ()
(require 'org)
(defun amin|eshell-setup ()
(make-local-variable 'company-idle-delay)
- (setq company-idle-delay nil)
+ (defvar company-idle-delay nil)
(bind-keys :map eshell-mode-map
("C-d" . amin/eshell-quit-or-delete-char)
("C-S-l" . amin/eshell-clear)
'(("default"
("dired" (mode . dired-mode))
("org" (mode . org-mode))
+ ("gnus"
+ (or
+ (mode . gnus-group-mode)
+ (mode . gnus-summary-mode)
+ (mode . gnus-article-mode)
+ ;; not really, but...
+ (mode . message-mode)))
("web"
(or
(mode . web-mode)
("shell"
(or
(mode . eshell-mode)
- (mode . shell-mode)))
- ("notmuch" (name . "\*notmuch\*"))
+ (mode . shell-mode)
+ (mode . term-mode)))
("programming"
(or
(mode . python-mode)
+ (mode . c-mode)
(mode . c++-mode)
- (mode . emacs-lisp-mode)))
+ (mode . emacs-lisp-mode)
+ (mode . scheme-mode)
+ (mode . haskell-mode)
+ (mode . lean-mode)))
("emacs"
(or
(name . "^\\*scratch\\*$")
- (name . "^\\*Messages\\*$")))
- ("slack"
- (or
- (name . "^\\*Slack*"))))))
+ (name . "^\\*Messages\\*$"))))))
(ibuffer-formats
'((mark modified read-only locked " "
(name 18 18 :left :elide)
(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
#+end_src
* Syntax and spell checking
+
#+begin_src emacs-lisp
(use-package flycheck
:defer 3
:hook (web-mode css-mode html-mode sgml-mode))
#+end_src
-** Nix
-
-#+begin_src emacs-lisp
-(use-package nix-mode
- :defer t
- :mode "\\.nix\\'")
-#+end_src
-
-** Java
+** COMMENT Java
*** meghanada
-#+begin_src emacs-lisp :tangle no
+#+begin_src emacs-lisp
(use-package meghanada
:bind
(:map meghanada-mode-map
treemacs
#+end_comment
-#+begin_src emacs-lisp :tangle no
+#+begin_src emacs-lisp
(use-package treemacs
:config (setq treemacs-never-persist t))
:after (treemacs))
#+end_src
+** geiser
+
+#+begin_src emacs-lisp
+(use-package geiser)
+
+(use-package geiser-guile
+ :config
+ (setq geiser-guile-load-path "~/src/git/guix"))
+#+end_src
+
+** guix
+
+#+begin_src emacs-lisp
+(use-package guix
+ :load-path "lib/guix/elisp")
+#+end_src
+
* Emacs Enhancements
** [[https://github.com/justbur/emacs-which-key][which-key]]
(load-theme 'tangomod t)
#+end_src
-** doom-modeline
+** smart-mode-line
#+begin_src emacs-lisp
-(use-package doom-modeline
- :demand t
- :config (setq doom-modeline-height 32)
- :hook (after-init . doom-modeline-init))
+(use-package smart-mode-line
+ :config
+ (sml/setup))
#+end_src
** doom-themes
(defun amin/lights-on ()
"Enable my favourite light theme."
(interactive)
- (progn
- (mapc #'disable-theme custom-enabled-themes)
- (load-theme 'tangomod t)))
+ (mapc #'disable-theme custom-enabled-themes)
+ (load-theme 'tangomod t)
+ (sml/apply-theme 'automatic))
(defun amin/lights-off ()
"Go dark."
(interactive)
- (progn
- (mapc #'disable-theme custom-enabled-themes)
- (load-theme 'doom-tomorrow-night t)))
+ (mapc #'disable-theme custom-enabled-themes)
+ (load-theme 'doom-tomorrow-night t)
+ (sml/apply-theme 'automatic))
(bind-keys
("s-t d" . amin/lights-off)
Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]].
-** COMMENT [[https://github.com/DarthFennec/highlight-indent-guides][highlight-indent-guides]] :ARCHIVE:
+** COMMENT [[https://github.com/DarthFennec/highlight-indent-guides][highlight-indent-guides]]
#+begin_src emacs-lisp
(use-package highlight-indent-guides
("l" . image-forward-hscroll)))
#+end_src
-** anzu
-
-#+begin_src emacs-lisp
-(use-package anzu)
-#+end_src
-
** typo.el
#+begin_src emacs-lisp
""))))
#+end_src
-** COMMENT slack :ARCHIVE:
+** COMMENT slack
Hopefully temporary.
(setq alert-default-style 'notifier))
#+end_src
-** COMMENT magithub :ARCHIVE:
-
-For when I /have to/ use GH.
-
-#+begin_src emacs-lisp
-(use-package magithub
- :after magit
- :config
- (magithub-feature-autoinject t)
- (setq magithub-clone-default-directory "~/src/git"))
-#+end_src
-
** [[https://github.com/peterwvj/eshell-up][eshell-up]]
#+begin_src emacs-lisp
#+begin_src emacs-lisp
(use-package multi-term
:defer 1
- :bind (("C-c C-j" . term-line-mode)
- ("C-c m m" . multi-term)
- ("C-c m p" . multi-term-dedicated-toggle))
+ :bind (("C-c C-j" . term-line-mode)
+ ("C-c a s m m" . multi-term)
+ ("C-c a s m p" . multi-term-dedicated-toggle))
:config
(setq multi-term-program "/bin/screen"
;; TODO: add separate bindings for connecting to existing
'("C-z" "C-x" "C-c" "C-h" "C-y" "<ESC>")))
#+end_src
+** page-break-lines
+
+#+begin_src emacs-lisp
+(use-package page-break-lines
+ :config
+ (global-page-break-lines-mode))
+#+end_src
+
* Email
#+begin_src emacs-lisp
read-mail-command 'gnus)
(use-package gnus
- :bind (("s-m" . gnus)
- ("s-M" . gnus-unplugged))
+ :bind (("C-c m" . gnus)
+ ("C-c M" . gnus-unplugged)
+ ("s-m" . gnus)
+ ("s-M" . gnus-unplugged))
:init
(setq
gnus-select-method '(nnnil "")
#+end_src
* Blogging
+
** [[https://ox-hugo.scripter.co][ox-hugo]]
#+begin_src emacs-lisp
* COMMENT Local Variables :ARCHIVE:
# Local Variables:
# eval: (add-hook 'after-save-hook #'amin/async-babel-tangle 'append 'local)
+# eval: (typo-mode -1)
# End: