X-Git-Url: https://git.shemshak.org/gitweb.cgi/~bandali/configs/blobdiff_plain/0884b63b028514ff55208af9020e0dce5700e802..6ce4ebba1f57dfc0de56844b5bf580b083f9154c:/init.org?ds=sidebyside diff --git a/init.org b/init.org index 2bd523e..505a793 100644 --- a/init.org +++ b/init.org @@ -217,8 +217,11 @@ can then be managed with the help of Magit or other tools. 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) @@ -252,6 +255,8 @@ and without compromising on performance. debug-on-error t) (setq use-package-verbose nil use-package-expand-minimally t)) + +(setq use-package-always-defer t) #+end_src *** Epkg @@ -266,7 +271,6 @@ database, low-level functions for querying the database, and a #+begin_src emacs-lisp (use-package epkg - :defer t :bind (("C-c b d" . epkg-describe-package) ("C-c b p" . epkg-list-packages) @@ -674,6 +678,12 @@ for this. (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 @@ -724,7 +734,7 @@ customizing it. '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 @@ -772,23 +782,18 @@ In short, my favourite way of life. (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 @@ -808,6 +813,9 @@ file. (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) @@ -815,7 +823,7 @@ file. (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) @@ -824,6 +832,7 @@ file. `(lambda (result) (if result (progn + ;; (setq byte-compile-warnings '(not noruntime unresolved)) (message "Tangled %s%s" ,file-nodir (if a/show-async-tangle-time @@ -832,7 +841,9 @@ file. ',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 @@ -868,6 +879,30 @@ Not just how I do git, but /the/ way to do git. :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 @@ -902,6 +937,7 @@ There's no way I could top that, so I won't attempt to. #+begin_src emacs-lisp (use-package swiper + :after ivy :bind (("C-s" . swiper) ("C-r" . swiper) ("C-S-s" . isearch-forward))) @@ -912,6 +948,7 @@ There's no way I could top that, so I won't attempt to. #+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) @@ -947,7 +984,8 @@ There's no way I could top that, so I won't attempt to. (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) @@ -964,7 +1002,6 @@ There's no way I could top that, so I won't attempt to. #+begin_src emacs-lisp (use-package ibuffer - :defer t :bind (("C-x C-b" . ibuffer-other-window) :map ibuffer-mode-map @@ -1035,7 +1072,6 @@ There's no way I could top that, so I won't attempt to. #+begin_src emacs-lisp (use-package outline - :defer t :hook (prog-mode . outline-minor-mode) :bind (:map @@ -1053,33 +1089,23 @@ There's no way I could top that, so I won't attempt to. ("s" . outline-show-subtree))) #+end_src -* Borg's =layer/essentials= -:PROPERTIES: -:CUSTOM_ID: borg-essentials -:END: - -TODO: break this giant source block down into individual org sections. +*** Dired #+begin_src emacs-lisp -(use-package dash - :config (dash-enable-font-lock)) - -(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)) +(use-package ls-lisp + :custom (ls-lisp-dirs-first t)) (use-package dired - :defer t :config - (setq dired-listing-switches "-alh") + (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 'ediff) + (require 'dired-aux) + (defvar ediff-after-quit-hook-internal) (let ((files (dired-get-marked-files)) (wnd (current-window-configuration))) (if (<= (length files) 2) @@ -1098,6 +1124,7 @@ TODO: break this giant source block down into individual org sections. (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) @@ -1105,76 +1132,116 @@ TODO: break this giant source block down into individual org sections. (interactive) (a/dired-start-process "zathura")))) :hook (dired-mode . dired-hide-details-mode)) +#+end_src -(use-package eldoc - :when (version< "25" emacs-version) - :config (global-eldoc-mode)) +*** Help +#+begin_src emacs-lisp (use-package help - :defer t :config (temp-buffer-resize-mode) (setq help-window-select t)) +#+end_src -(progn ; `isearch' - (setq isearch-allow-scroll t)) +*** Tramp -(use-package lisp-mode +#+begin_src emacs-lisp +(use-package tramp :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)) + (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 -(use-package man - :defer t - :config (setq Man-width 80)) +*** 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) + :hook (magit-post-refresh . diff-hl-magit-post-refresh)) +#+end_src + +** 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 + +** paren + +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 @@ -1194,10 +1261,7 @@ TODO: break this giant source block down into individual org sections. (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 @@ -1246,11 +1310,22 @@ TODO: break this giant source block down into individual org sections. :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 @@ -1258,7 +1333,6 @@ TODO: break this giant source block down into individual org sections. #+begin_src emacs-lisp (use-package proof-site ; Proof General - :defer t :load-path "lib/proof-site/generic/") #+end_src @@ -1286,7 +1360,6 @@ TODO: break this giant source block down into individual org sections. #+begin_src emacs-lisp (use-package haskell-mode - :defer t :config (setq haskell-indentation-layout-offset 4 haskell-indentation-left-offset 4 @@ -1469,13 +1542,12 @@ instead. ("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 @@ -1484,7 +1556,6 @@ instead. #+begin_src emacs-lisp (use-package css-mode - :defer t :config (setq css-indent-offset 2)) #+end_src @@ -1493,7 +1564,6 @@ instead. #+begin_src emacs-lisp (use-package web-mode - :defer t :mode "\\.html\\'" :config (a/setq-every 2 @@ -1618,6 +1688,13 @@ treemacs :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 @@ -1627,7 +1704,51 @@ Emacs package that displays available keybindings in popup #+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 @@ -1641,6 +1762,7 @@ Emacs package that displays available keybindings in popup #+begin_src emacs-lisp (use-package smart-mode-line + :demand :config (sml/setup)) #+end_src @@ -1702,7 +1824,6 @@ Emacs package that displays available keybindings in popup #+begin_src emacs-lisp (use-package projectile - :defer t :bind-keymap ("C-c p" . projectile-command-map) :config (projectile-mode) @@ -1785,6 +1906,14 @@ Make =*scratch*= and =*Messages*= unkillable. 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 @@ -1808,11 +1937,9 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]]. #+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) @@ -1832,14 +1959,17 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]]. 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 @@ -1847,8 +1977,7 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]]. #+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 @@ -1893,7 +2022,19 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]]. :bind ("C-=" . er/expand-region)) #+end_src -** TODO multiple-cursors +** multiple-cursors + +#+begin_src emacs-lisp +(use-package multiple-cursors + :bind + (("C-S-" . 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: @@ -1915,9 +2056,7 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]]. 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 @@ -2109,7 +2248,7 @@ Convenient footnotes in =message-mode=. #+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")) @@ -2134,6 +2273,7 @@ Convenient footnotes in =message-mode=. 'company-ebdb)))) (use-package ebdb-gnus + :demand :after ebdb :custom (ebdb-gnus-window-configuration @@ -2145,6 +2285,7 @@ Convenient footnotes in =message-mode=. (ebdb-gnus 0.3)))))) (use-package ebdb-mua + :demand :after ebdb ;; :custom (ebdb-mua-pop-up nil) ) @@ -2224,5 +2365,5 @@ Display how long it took to load the init file. * 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: