user-emacs-directory (file-name-directory user-init-file))
(add-to-list 'load-path
(expand-file-name "lib/borg" user-emacs-directory))
+;; Main engine start...
(require 'borg)
+;; Solid rocket booster ignition...
(borg-initialize)
+;; We have lift off!
;; (require 'borg-nix-shell)
;; (setq borg-build-shell-command 'borg-nix-shell-build-command)
debug-on-error t)
(setq use-package-verbose nil
use-package-expand-minimally t))
+
+(setq use-package-always-defer t)
#+end_src
*** Epkg
#+begin_src emacs-lisp
(use-package epkg
- :defer t
:bind
(("C-c b d" . epkg-describe-package)
("C-c b p" . epkg-list-packages)
`(progn ,@(mapcar (lambda (x) (list 'setq x value)) vars)))
#+end_src
+The following process-related stuff from [[https://github.com/alezost/emacs-config][alezost's emacs-config]].
+
+#+begin_src emacs-lisp
+(defun a/start-process (program &rest args)
+ "Same as `start-process', but doesn't bother about name and buffer."
+ (let ((process-name (concat program "_process"))
+ (buffer-name (generate-new-buffer-name
+ (concat program "_output"))))
+ (apply #'start-process
+ process-name buffer-name program args)))
+
+(defun a/dired-start-process (program &optional args)
+ "Open current file with a PROGRAM."
+ ;; Shell command looks like this: "program [ARGS]... FILE" (ARGS can
+ ;; be nil, so remove it).
+ (apply #'a/start-process
+ program
+ (remove nil (list args (dired-get-file-for-visit)))))
+#+end_src
+
* Core
:PROPERTIES:
:CUSTOM_ID: core
(setq-default cursor-type 'bar)
#+end_src
+*** Allow scrolling in Isearch
+
+#+begin_src emacs-lisp
+(setq isearch-allow-scroll t)
+#+end_src
+
** Bindings
#+begin_src emacs-lisp
'auto-compile-inhibit-compile-detached-git-head))
#+end_src
-*** [[https://orgmode.org/][Org mode]]
+*** [[https://orgmode.org/][Org]]
#+begin_quote
Org mode is for keeping notes, maintaining TODO lists, planning
(setq org-latex-listings 'listings
;; org-latex-prefer-user-labels t
)
- (add-to-list 'org-latex-packages-alist '("" "listings"))
- (add-to-list 'org-latex-packages-alist '("" "color"))
(add-to-list 'org-latex-classes
'("IEEEtran" "\\documentclass[11pt]{IEEEtran}"
- ("\\section{%s}" . "\\section*{%s}")
- ("\\subsection{%s}" . "\\subsection*{%s}")
+ ("\\section{%s}" . "\\section*{%s}")
+ ("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
- ("\\paragraph{%s}" . "\\paragraph*{%s}")
- ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
+ ("\\paragraph{%s}" . "\\paragraph*{%s}")
+ ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
t))
(use-package ox-beamer
+ :demand
:after ox)
-
-(use-package orgalist
- :after message
- :hook (message-mode . orgalist-mode))
#+end_src
**** asynchronous tangle
(defvar a/async-tangle-post-compile "make ti"
"If non-nil, pass to `compile' after successful tangle.")
+ (defvar a/async-tangle-byte-recompile nil
+ "If non-nil, byte-recompile the file on successful tangle.")
+
(defun a/async-babel-tangle ()
"Tangle org file asynchronously."
(interactive)
(file (buffer-file-name))
(file-nodir (file-name-nondirectory file))
;; (async-quiet-switch "-q")
- )
+ (file-noext (file-name-sans-extension file)))
(async-start
`(lambda ()
(require 'org)
`(lambda (result)
(if result
(progn
+ ;; (setq byte-compile-warnings '(not noruntime unresolved))
(message "Tangled %s%s"
,file-nodir
(if a/show-async-tangle-time
',file-tangle-start-time)))
""))
(when a/async-tangle-post-compile
- (compile a/async-tangle-post-compile)))
+ (compile a/async-tangle-post-compile))
+ (when a/async-tangle-byte-recompile
+ (byte-recompile-file (concat ,file-noext ".el"))))
(message "Tangling %s failed" ,file-nodir))))))))
(add-to-list
:custom-face (magit-diff-file-heading ((t (:weight normal)))))
#+end_src
+*** recentf
+
+Recently opened files.
+
+#+begin_src emacs-lisp
+(use-package recentf
+ :defer 0.5
+ :config
+ (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:")
+ (setq recentf-max-saved-items 40))
+#+end_src
+
+*** smex
+
+#+begin_quote
+A smart M-x enhancement for Emacs.
+#+end_quote
+
+Mostly because =counsel= needs it to remember history.
+
+#+begin_src emacs-lisp
+(use-package smex)
+#+end_src
+
*** [[https://github.com/abo-abo/swiper][Ivy]] (and friends)
#+begin_quote
#+begin_src emacs-lisp
(use-package swiper
+ :after ivy
:bind (("C-s" . swiper)
("C-r" . swiper)
("C-S-s" . isearch-forward)))
#+begin_src emacs-lisp
(use-package counsel
:defer 1
+ :after ivy
:bind (([remap execute-extended-command] . counsel-M-x)
([remap find-file] . counsel-find-file)
("s-r" . counsel-recentf)
(defun a/eshell-setup ()
(make-local-variable 'company-idle-delay)
- (defvar company-idle-delay nil)
+ (defvar company-idle-delay)
+ (setq company-idle-delay nil)
(bind-keys :map eshell-mode-map
("C-d" . a/eshell-quit-or-delete-char)
("C-S-l" . a/eshell-clear)
#+begin_src emacs-lisp
(use-package ibuffer
- :defer t
:bind
(("C-x C-b" . ibuffer-other-window)
:map ibuffer-mode-map
#+begin_src emacs-lisp
(use-package outline
- :defer t
:hook (prog-mode . outline-minor-mode)
:bind
(:map
("s" . outline-show-subtree)))
#+end_src
-* Borg's =layer/essentials=
-:PROPERTIES:
-:CUSTOM_ID: borg-essentials
-:END:
+*** Dired
+
+#+begin_src emacs-lisp
+(use-package ls-lisp
+ :custom (ls-lisp-dirs-first t))
+
+(use-package dired
+ :config
+ (setq dired-listing-switches "-alh"
+ ls-lisp-use-insert-directory-program nil)
+
+ ;; easily diff 2 marked files
+ ;; https://oremacs.com/2017/03/18/dired-ediff/
+ (defun dired-ediff-files ()
+ (interactive)
+ (require 'dired-aux)
+ (defvar ediff-after-quit-hook-internal)
+ (let ((files (dired-get-marked-files))
+ (wnd (current-window-configuration)))
+ (if (<= (length files) 2)
+ (let ((file1 (car files))
+ (file2 (if (cdr files)
+ (cadr files)
+ (read-file-name
+ "file: "
+ (dired-dwim-target-directory)))))
+ (if (file-newer-than-file-p file1 file2)
+ (ediff-files file2 file1)
+ (ediff-files file1 file2))
+ (add-hook 'ediff-after-quit-hook-internal
+ (lambda ()
+ (setq ediff-after-quit-hook-internal nil)
+ (set-window-configuration wnd))))
+ (error "no more than 2 files should be marked"))))
+ :bind (:map dired-mode-map
+ ("b" . dired-up-directory)
+ ("e" . dired-ediff-files)
+ ("E" . dired-toggle-read-only)
+ ("\\" . dired-hide-details-mode)
+ ("z" . (lambda ()
+ (interactive)
+ (a/dired-start-process "zathura"))))
+ :hook (dired-mode . dired-hide-details-mode))
+#+end_src
+
+*** Help
+
+#+begin_src emacs-lisp
+(use-package help
+ :config
+ (temp-buffer-resize-mode)
+ (setq help-window-select t))
+#+end_src
+
+*** Tramp
+
+#+begin_src emacs-lisp
+(use-package tramp
+ :config
+ (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:"))
+ (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil))
+ (add-to-list 'tramp-default-proxies-alist
+ (list (regexp-quote (system-name)) nil nil)))
+#+end_src
-TODO: break this giant source block down into individual org sections.
+*** Dash
#+begin_src emacs-lisp
(use-package dash
:config (dash-enable-font-lock))
+#+end_src
+
+* Editing
+:PROPERTIES:
+:CUSTOM_ID: editing
+:END:
+** =diff-hl=
+
+Highlight uncommitted changes in the left fringe.
+
+#+begin_src emacs-lisp
(use-package diff-hl
:config
(setq diff-hl-draw-borders nil)
(global-diff-hl-mode)
- (add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh t))
+ :hook (magit-post-refresh . diff-hl-magit-post-refresh))
+#+end_src
-(use-package dired
- :defer t
- :config (setq dired-listing-switches "-alh"))
+** ElDoc
+
+Display Lisp objects at point in the echo area.
+#+begin_src emacs-lisp
(use-package eldoc
:when (version< "25" emacs-version)
:config (global-eldoc-mode))
+#+end_src
-(use-package help
- :defer t
- :config
- (temp-buffer-resize-mode)
- (setq help-window-select t))
-
-(progn ; `isearch'
- (setq isearch-allow-scroll t))
+** paren
-(use-package lisp-mode
- :config
- (add-hook 'emacs-lisp-mode-hook 'outline-minor-mode)
- (add-hook 'emacs-lisp-mode-hook 'reveal-mode)
- (defun indent-spaces-mode ()
- (setq indent-tabs-mode nil))
- (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode))
-
-(use-package man
- :defer t
- :config (setq Man-width 80))
+Highlight matching parens.
+#+begin_src emacs-lisp
(use-package paren
+ :demand
:config (show-paren-mode))
+#+end_src
-(use-package prog-mode
- :config (global-prettify-symbols-mode)
- (defun indicate-buffer-boundaries-left ()
- (setq indicate-buffer-boundaries 'left))
- (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left))
+** simple (for column numbers)
-(use-package recentf
- :defer 0.5
- :config
- (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:")
- (setq recentf-max-saved-items 40))
+#+begin_src emacs-lisp
+(use-package simple
+ :config (column-number-mode))
+#+end_src
+
+** =savehist=
+
+Save minibuffer history.
+#+begin_src emacs-lisp
(use-package savehist
:config (savehist-mode))
+#+end_src
+** =saveplace=
+
+Automatically save place in each file.
+
+#+begin_src emacs-lisp
(use-package saveplace
:when (version< "25" emacs-version)
:config (save-place-mode))
+#+end_src
-(use-package simple
- :config (column-number-mode))
+** =prog-mode=
-(progn ; `text-mode'
- (add-hook 'text-mode-hook #'indicate-buffer-boundaries-left)
- (add-hook 'text-mode-hook #'abbrev-mode))
+#+begin_src emacs-lisp
+(use-package prog-mode
+ :config (global-prettify-symbols-mode)
+ (defun indicate-buffer-boundaries-left ()
+ (setq indicate-buffer-boundaries 'left))
+ (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left))
+#+end_src
-(use-package tramp
- :defer t
- :config
- (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:"))
- (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil))
- (add-to-list 'tramp-default-proxies-alist
- (list (regexp-quote (system-name)) nil nil)))
+** =text-mode=
+#+begin_src emacs-lisp
+(use-package text-mode
+ :hook ((text-mode . indicate-buffer-boundaries-left)
+ (text-mode . abbrev-mode)))
#+end_src
-* Editing
-:PROPERTIES:
-:CUSTOM_ID: editing
-:END:
-
** Company
#+begin_src emacs-lisp
(global-company-mode t))
#+end_src
-* Syntax and spell checking
-:PROPERTIES:
-:CUSTOM_ID: syntax-spell-checking
-:END:
+** Flycheck
#+begin_src emacs-lisp
(use-package flycheck
:CUSTOM_ID: programming-modes
:END:
+** Lisp
+
+#+begin_src emacs-lisp
+(use-package lisp-mode
+ :config
+ (add-hook 'emacs-lisp-mode-hook 'outline-minor-mode)
+ (add-hook 'emacs-lisp-mode-hook 'reveal-mode)
+ (defun indent-spaces-mode ()
+ (setq indent-tabs-mode nil))
+ (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode))
+#+end_src
+
** [[http://alloytools.org][Alloy]] (with [[https://github.com/dwwmmn/alloy-mode][alloy-mode]])
#+begin_src emacs-lisp
(use-package alloy-mode
- :defer t
:config (setq alloy-basic-offset 2))
#+end_src
#+begin_src emacs-lisp
(use-package proof-site ; Proof General
- :defer t
:load-path "lib/proof-site/generic/")
#+end_src
#+begin_src emacs-lisp
(use-package haskell-mode
- :defer t
:config
(setq haskell-indentation-layout-offset 4
haskell-indentation-left-offset 4
("C-c l l" . hs-lint)))
#+end_src
-** Web dev
+** Web
*** SGML and HTML
#+begin_src emacs-lisp
(use-package sgml-mode
- :defer t
:config
(setq sgml-basic-offset 2))
#+end_src
#+begin_src emacs-lisp
(use-package css-mode
- :defer t
:config
(setq css-indent-offset 2))
#+end_src
#+begin_src emacs-lisp
(use-package web-mode
- :defer t
:mode "\\.html\\'"
:config
(a/setq-every 2
:CUSTOM_ID: emacs-enhancements
:END:
+** man
+
+#+begin_src emacs-lisp
+(use-package man
+ :config (setq Man-width 80))
+#+end_src
+
** [[https://github.com/justbur/emacs-which-key][which-key]]
#+begin_quote
#+begin_src emacs-lisp
(use-package which-key
:defer 1
- :config (which-key-mode))
+ :config
+ (which-key-add-key-based-replacements
+ ;; prefixes for global prefixes and minor modes
+ "C-c @" "outline"
+ "C-c !" "flycheck"
+ "C-c 8" "typo"
+ "C-c 8 -" "typo/dashes"
+ "C-c 8 <" "typo/left-brackets"
+ "C-c 8 >" "typo/right-brackets"
+ "C-x 8" "unicode"
+ "C-x a" "abbrev/expand"
+ "C-x r" "rectangle/register/bookmark"
+ "C-x v" "version control"
+ ;; prefixes for my personal bindings
+ "C-c a" "applications"
+ "C-c a s" "shells"
+ "C-c b" "borg"
+ "C-c c" "compile-and-comments"
+ "C-c e" "eval"
+ "C-c f" "files"
+ "C-c F" "frames"
+ "C-S-h" "help(ful)"
+ "C-c m" "multiple-cursors"
+ "C-c p" "projectile"
+ "C-c p s" "projectile/search"
+ "C-c p x" "projectile/execute"
+ "C-c p 4" "projectile/other-window"
+ "C-c q" "boxquote"
+ "s-g" "magit"
+ "s-o" "outline"
+ "s-t" "themes")
+
+ ;; prefixes for major modes
+ (which-key-add-major-mode-key-based-replacements 'message-mode
+ "C-c f" "footnote")
+ (which-key-add-major-mode-key-based-replacements 'org-mode
+ "C-c C-v" "org-babel")
+ (which-key-add-major-mode-key-based-replacements 'web-mode
+ "C-c C-a" "web/attributes"
+ "C-c C-b" "web/blocks"
+ "C-c C-d" "web/dom"
+ "C-c C-e" "web/element"
+ "C-c C-t" "web/tags")
+
+ (which-key-mode))
#+end_src
** theme
#+begin_src emacs-lisp
(use-package smart-mode-line
+ :demand
:config
(sml/setup))
#+end_src
#+begin_src emacs-lisp
(use-package projectile
- :defer t
:bind-keymap ("C-c p" . projectile-command-map)
:config
(projectile-mode)
Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]].
+** orgalist
+
+#+begin_src emacs-lisp
+(use-package orgalist
+ :after message
+ :hook (message-mode . orgalist-mode))
+#+end_src
+
** typo.el
#+begin_src emacs-lisp
#+begin_src emacs-lisp
(use-package shrink-path
+ :defer 2
:after eshell
:config
- (setq eshell-prompt-regexp "\\(.*\n\\)*λ "
- eshell-prompt-function #'+eshell/prompt)
-
(defun +eshell/prompt ()
(let ((base/dir (shrink-path-prompt default-directory)))
(concat (propertize (car base/dir)
collect match))))
(if (not (eq branch nil))
(concat " " (substring branch 2))
- ""))))
+ "")))
+ (setq eshell-prompt-regexp "\\(.*\n\\)*λ "
+ eshell-prompt-function #'+eshell/prompt))
#+end_src
** [[https://github.com/peterwvj/eshell-up][eshell-up]]
#+begin_src emacs-lisp
(use-package eshell-up
- :after eshell)
+ :after eshell
+ :commands eshell-up)
#+end_src
** multi-term
#+begin_src emacs-lisp
(use-package multi-term
:defer 1
- :bind (("C-c a s m m" . multi-term)
- ("C-c a s m p" . multi-term-dedicated-toggle)
+ :bind (("C-c a s m" . multi-term-dedicated-toggle)
:map term-mode-map
("C-c C-j" . term-char-mode)
:map term-raw-map
:bind ("C-=" . er/expand-region))
#+end_src
+** multiple-cursors
+
+#+begin_src emacs-lisp
+(use-package multiple-cursors
+ :bind
+ (("C-S-<mouse-1>" . mc/add-cursor-on-click)
+ (:prefix-map a/mc-prefix-map
+ :prefix "C-c m"
+ ("c" . mc/edit-lines)
+ ("n" . mc/mark-next-like-this)
+ ("p" . mc/mark-previous-like-this)
+ ("a" . mc/mark-all-like-this))))
+#+end_src
+
* Email
:PROPERTIES:
:CUSTOM_ID: email
read-mail-command 'gnus)
(use-package gnus
- :bind (("C-c m" . gnus)
- ("C-c M" . gnus-unplugged)
- ("s-m" . gnus)
+ :bind (("s-m" . gnus)
("s-M" . gnus-unplugged))
:init
(setq
#+begin_src emacs-lisp
(use-package ebdb
- :defer 1
+ :after gnus
:bind (:map gnus-group-mode-map ("e" . ebdb))
:config
(setq ebdb-sources (no-littering-expand-var-file-name "ebdb"))
'company-ebdb))))
(use-package ebdb-gnus
+ :demand
:after ebdb
:custom
(ebdb-gnus-window-configuration
(ebdb-gnus 0.3))))))
(use-package ebdb-mua
+ :demand
:after ebdb
;; :custom (ebdb-mua-pop-up nil)
)
* COMMENT Local Variables :ARCHIVE:
# Local Variables:
# eval: (add-hook 'after-save-hook #'a/async-babel-tangle 'append 'local)
-# eval: (typo-mode -1)
+# eval: (when (featurep 'typo (typo-mode -1)))
# End: