├── .dir-locals.el ├── .gitignore ├── .gitmodules ├── LICENSE ├── Makefile ├── custom.el ├── early-init.el ├── etc ├── transient │ └── levels.el ├── window-purpose │ └── layouts │ │ └── irc.window-layout └── yasnippet │ └── snippets │ ├── c-lang-common │ └── once │ └── latex-mode │ └── equation ├── init.el └── lisp ├── bb-defs.el ├── bb-erc.el ├── bb-macros.el ├── bb-py-all-env.el └── bb-segments.el /.dir-locals.el: -------------------------------------------------------------------------------- 1 | ;;; Directory Local Variables 2 | ;;; For more information see (info "(emacs) Directory Variables") 3 | 4 | ((nil . ((projectile-project-compilation-cmd . "make build") 5 | (projectile-project-run-cmd . "emacs") 6 | (projectile-project-name . "dotemacs")))) 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /elpa 2 | /elpa.bak 3 | /var 4 | /epkgs 5 | *.elc 6 | /local.el 7 | /.cask 8 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "ace-link"] 2 | path = lib/ace-link 3 | url = git@github.com:abo-abo/ace-link.git 4 | [submodule "ace-window"] 5 | path = lib/ace-window 6 | url = git@github.com:abo-abo/ace-window.git 7 | [submodule "all-the-icons"] 8 | path = lib/all-the-icons 9 | url = git@github.com:domtronn/all-the-icons.el.git 10 | [submodule "annalist"] 11 | path = lib/annalist 12 | url = git@github.com:noctuid/annalist.el.git 13 | [submodule "apiwrap"] 14 | path = lib/apiwrap 15 | url = git@github.com:vermiculus/apiwrap.el.git 16 | [submodule "async"] 17 | path = lib/async 18 | url = git@github.com:jwiegley/emacs-async.git 19 | [submodule "auctex"] 20 | path = lib/auctex 21 | url = https://git.savannah.gnu.org/git/auctex.git 22 | build-step = ./autogen.sh 23 | build-step = ./configure 24 | build-step = make 25 | build-step = "(borg-update-autoloads \"auctex\")" 26 | [submodule "auctex-latexmk"] 27 | path = lib/auctex-latexmk 28 | url = git@github.com:tom-tan/auctex-latexmk.git 29 | [submodule "auto-compile"] 30 | path = lib/auto-compile 31 | url = git@github.com:emacscollective/auto-compile.git 32 | [submodule "avy"] 33 | path = lib/avy 34 | url = git@github.com:abo-abo/avy.git 35 | [submodule "borg"] 36 | path = lib/borg 37 | url = git@github.com:emacscollective/borg.git 38 | [submodule "bufler"] 39 | path = lib/bufler 40 | url = git@github.com:alphapapa/bufler.el 41 | no-byte-compile = helm-bufler.el 42 | [submodule "ccls"] 43 | path = lib/ccls 44 | url = git@github.com:MaskRay/emacs-ccls.git 45 | [submodule "closql"] 46 | path = lib/closql 47 | url = git@github.com:emacscollective/closql.git 48 | [submodule "cmake-mode"] 49 | path = lib/cmake-mode 50 | url = git@github.com:emacsmirror/cmake-mode.git 51 | [submodule "company"] 52 | path = lib/company 53 | url = git@github.com:company-mode/company-mode.git 54 | [submodule "company-auctex"] 55 | path = lib/company-auctex 56 | url = git@github.com:alexeyr/company-auctex.git 57 | [submodule "company-box"] 58 | path = lib/company-box 59 | url = git@github.com:TheBB/company-box.git 60 | [submodule "company-lsp"] 61 | path = lib/company-lsp 62 | url = git@github.com:tigersoldier/company-lsp.git 63 | [submodule "company-reftex"] 64 | path = lib/company-reftex 65 | url = git@github.com:TheBB/company-reftex.git 66 | [submodule "conda"] 67 | path = lib/conda 68 | url = git@github.com:necaris/conda.el.git 69 | [submodule "counsel-projectile"] 70 | path = lib/counsel-projectile 71 | url = git@github.com:ericdanan/counsel-projectile.git 72 | [submodule "cquery"] 73 | path = lib/cquery 74 | url = git@github.com:cquery-project/emacs-cquery.git 75 | [submodule "csv-mode"] 76 | path = lib/csv-mode 77 | url = git@github.com:emacsmirror/csv-mode.git 78 | [submodule "cython-mode"] 79 | path = lib/cython-mode 80 | url = git@github.com:emacsmirror/cython-mode.git 81 | [submodule "dart-mode"] 82 | path = lib/dart-mode 83 | url = git@github.com:bradyt/dart-mode.git 84 | [submodule "dash"] 85 | path = lib/dash 86 | url = git@github.com:magnars/dash.el.git 87 | no-makeinfo = dash-template.texi 88 | [submodule "diff-hl"] 89 | path = lib/diff-hl 90 | url = git@github.com:dgutov/diff-hl.git 91 | [submodule "diminish"] 92 | path = lib/diminish 93 | url = git@github.com:myrjola/diminish.el.git 94 | [submodule "dimmer"] 95 | path = lib/dimmer 96 | url = git@github.com:gonewest818/dimmer.el.git 97 | [submodule "doom-modeline"] 98 | path = lib/doom-modeline 99 | url = git@github.com:seagle0128/doom-modeline.git 100 | [submodule "emacsql"] 101 | path = lib/emacsql 102 | url = git@github.com:skeeto/emacsql.git 103 | no-byte-compile = emacsql-pg.el 104 | [submodule "embrace"] 105 | path = lib/embrace 106 | url = git@github.com:cute-jumper/embrace.el.git 107 | [submodule "epkg"] 108 | path = lib/epkg 109 | url = git@github.com:emacscollective/epkg.git 110 | [submodule "epl"] 111 | path = lib/epl 112 | url = git@github.com:cask/epl.git 113 | [submodule "erc-hl-nicks"] 114 | path = lib/erc-hl-nicks 115 | url = git@github.com:leathekd/erc-hl-nicks.git 116 | [submodule "evil"] 117 | path = lib/evil 118 | url = git@github.com:emacs-evil/evil.git 119 | info-path = doc/build/texinfo 120 | [submodule "evil-args"] 121 | path = lib/evil-args 122 | url = git@github.com:wcsmith/evil-args.git 123 | [submodule "evil-collection"] 124 | path = lib/evil-collection 125 | url = git@github.com:emacs-evil/evil-collection.git 126 | [submodule "evil-embrace"] 127 | path = lib/evil-embrace 128 | url = git@github.com:cute-jumper/evil-embrace.el.git 129 | [submodule "evil-escape"] 130 | path = lib/evil-escape 131 | url = git@github.com:syl20bnr/evil-escape.git 132 | [submodule "evil-indent-plus"] 133 | path = lib/evil-indent-plus 134 | url = git@github.com:TheBB/evil-indent-plus.git 135 | [submodule "evil-magit"] 136 | path = lib/evil-magit 137 | url = git@github.com:emacs-evil/evil-magit.git 138 | [submodule "evil-matchit"] 139 | path = lib/evil-matchit 140 | url = git@github.com:redguardtoo/evil-matchit.git 141 | [submodule "evil-nerd-commenter"] 142 | path = lib/evil-nerd-commenter 143 | url = git@github.com:redguardtoo/evil-nerd-commenter.git 144 | [submodule "evil-numbers"] 145 | path = lib/evil-numbers 146 | url = git@github.com:cofi/evil-numbers.git 147 | [submodule "evil-org"] 148 | path = lib/evil-org 149 | url = git@github.com:Somelauw/evil-org-mode.git 150 | [submodule "evil-plugins"] 151 | path = lib/evil-plugins 152 | url = git@github.com:tarao/evil-plugins 153 | no-byte-compile = evil-ex-registers.el 154 | no-byte-compile = evil-mode-line.el 155 | no-byte-compile = evil-operator-comment.el 156 | no-byte-compile = evil-operator-moccur.el 157 | no-byte-compile = evil-relative-linum.el 158 | no-byte-compile = evil-textobj-between.el 159 | no-byte-compile = hexl-evil-patch.el 160 | [submodule "evil-smartparens"] 161 | path = lib/evil-smartparens 162 | url = git@github.com:expez/evil-smartparens.git 163 | [submodule "evil-surround"] 164 | path = lib/evil-surround 165 | url = git@github.com:emacs-evil/evil-surround.git 166 | [submodule "exec-path-from-shell"] 167 | path = lib/exec-path-from-shell 168 | url = git@github.com:purcell/exec-path-from-shell.git 169 | [submodule "expand-region"] 170 | path = lib/expand-region 171 | url = git@github.com:magnars/expand-region.el.git 172 | [submodule "eyebrowse"] 173 | path = lib/eyebrowse 174 | url = git@github.com:wasamasa/eyebrowse.git 175 | [submodule "f"] 176 | path = lib/f 177 | url = git@github.com:rejeep/f.el.git 178 | [submodule "fish-mode"] 179 | path = lib/fish-mode 180 | url = git@github.com:wwwjfy/emacs-fish.git 181 | [submodule "flycheck"] 182 | path = lib/flycheck 183 | url = git@github.com:flycheck/flycheck.git 184 | [submodule "forge"] 185 | path = lib/forge 186 | url = git@github.com:magit/forge.git 187 | [submodule "frame-local"] 188 | path = lib/frame-local 189 | url = git@github.com:sebastiencs/frame-local.git 190 | [submodule "general"] 191 | path = lib/general 192 | url = git@github.com:noctuid/general.el.git 193 | [submodule "ghub"] 194 | path = lib/ghub 195 | url = git@github.com:magit/ghub.git 196 | [submodule "ghub+"] 197 | path = lib/ghub+ 198 | url = git@github.com:vermiculus/ghub-plus.git 199 | [submodule "git-modes"] 200 | path = lib/git-modes 201 | url = git@github.com:magit/git-modes.git 202 | [submodule "goto-chg"] 203 | path = lib/goto-chg 204 | url = git@github.com:emacs-evil/goto-chg.git 205 | [submodule "graphql"] 206 | path = lib/graphql 207 | url = git@github.com:vermiculus/graphql.el.git 208 | [submodule "hierarchy"] 209 | path = lib/hierarchy 210 | url = git@github.com:DamienCassou/hierarchy.git 211 | [submodule "highlight-numbers"] 212 | path = lib/highlight-numbers 213 | url = git@github.com:Fanael/highlight-numbers.git 214 | [submodule "highlight-operators"] 215 | path = lib/highlight-operators 216 | url = git@github.com:emacsmirror/highlight-operators.git 217 | [submodule "hl-todo"] 218 | path = lib/hl-todo 219 | url = git@github.com:tarsius/hl-todo.git 220 | [submodule "ht"] 221 | path = lib/ht 222 | url = git@github.com:Wilfred/ht.el.git 223 | [submodule "hydra"] 224 | path = lib/hydra 225 | url = git@github.com:abo-abo/hydra.git 226 | [submodule "ialign"] 227 | path = lib/ialign 228 | url = git@github.com:mkcms/interactive-align.git 229 | [submodule "iedit"] 230 | path = lib/iedit 231 | url = git@github.com:victorhge/iedit.git 232 | [submodule "imenu-list"] 233 | path = lib/imenu-list 234 | url = git@github.com:bmag/imenu-list.git 235 | [submodule "ivy"] 236 | path = lib/ivy 237 | url = git@github.com:abo-abo/swiper.git 238 | [submodule "ivy-posframe"] 239 | path = lib/ivy-posframe 240 | url = git@github.com:tumashu/ivy-posframe.git 241 | [submodule "julia-mode"] 242 | path = lib/julia-mode 243 | url = git@github.com:JuliaLang/julia-emacs.git 244 | [submodule "libegit2"] 245 | path = lib/libegit2 246 | url = git@github.com:magit/libegit2.git 247 | build-step = git submodule init 248 | build-step = git submodule update 249 | build-step = mkdir -p build 250 | build-step = cd build && cmake .. 251 | build-step = cd build && make 252 | [submodule "lispy"] 253 | path = lib/lispy 254 | url = git@github.com:abo-abo/lispy.git 255 | [submodule "lispyville"] 256 | path = lib/lispyville 257 | url = git@github.com:noctuid/lispyville.git 258 | [submodule "lsp-julia"] 259 | path = lib/lsp-julia 260 | url = git@github.com:gdkrmr/lsp-julia 261 | [submodule "lsp-mode"] 262 | path = lib/lsp-mode 263 | url = git@github.com:emacs-lsp/lsp-mode.git 264 | load-path = . 265 | load-path = clients 266 | [submodule "lsp-pyright"] 267 | path = lib/lsp-pyright 268 | url = git@github.com:emacs-lsp/lsp-pyright.git 269 | [submodule "lsp-python-ms"] 270 | path = lib/lsp-python-ms 271 | url = git@github.com:emacs-lsp/lsp-python-ms.git 272 | [submodule "lsp-ui"] 273 | path = lib/lsp-ui 274 | url = git@github.com:emacs-lsp/lsp-ui.git 275 | [submodule "lua-mode"] 276 | path = lib/lua-mode 277 | url = git@github.com:immerrr/lua-mode.git 278 | [submodule "macrostep"] 279 | path = lib/macrostep 280 | url = git@github.com:joddie/macrostep.git 281 | [submodule "magit"] 282 | path = lib/magit 283 | url = git@github.com:magit/magit.git 284 | info-path = Documentation 285 | [submodule "magit-popup"] 286 | path = lib/magit-popup 287 | url = git@github.com:magit/magit-popup.git 288 | [submodule "magit-todos"] 289 | path = lib/magit-todos 290 | url = git@github.com:alphapapa/magit-todos.git 291 | [submodule "major-mode-hydra"] 292 | path = lib/major-mode-hydra 293 | url = git@github.com:jerrypnz/major-mode-hydra.el.git 294 | [submodule "markdown-mode"] 295 | path = lib/markdown-mode 296 | url = git@github.com:jrblevin/markdown-mode.git 297 | [submodule "matlab-mode"] 298 | path = lib/matlab-mode 299 | url = https://git.code.sf.net/p/matlab-emacs/src 300 | [submodule "memoize"] 301 | path = lib/memoize 302 | url = git@github.com:skeeto/emacs-memoize.git 303 | [submodule "monokai-theme"] 304 | path = lib/monokai-theme 305 | url = git@github.com:oneKelvinSmith/monokai-emacs.git 306 | [submodule "no-littering"] 307 | path = lib/no-littering 308 | url = git@github.com:emacscollective/no-littering.git 309 | [submodule "org-mode"] 310 | path = lib/org-mode 311 | url = https://code.orgmode.org/bzg/org-mode.git 312 | recursive-byte-compile = true 313 | [submodule "ox-reveal"] 314 | path = lib/ox-reveal 315 | url = git@github.com:yjwen/org-reveal.git 316 | [submodule "ox-texinfo-plus"] 317 | path = lib/ox-texinfo-plus 318 | url = https://github.com/tarsius/ox-texinfo-plus.git 319 | [submodule "package-lint"] 320 | path = lib/package-lint 321 | url = git@github.com:purcell/package-lint.git 322 | [submodule "packed"] 323 | path = lib/packed 324 | url = git@github.com:emacscollective/packed.git 325 | [submodule "page-break-lines"] 326 | path = lib/page-break-lines 327 | url = git@github.com:purcell/page-break-lines.git 328 | [submodule "parent-mode"] 329 | path = lib/parent-mode 330 | url = git@github.com:Fanael/parent-mode.git 331 | [submodule "pcre2el"] 332 | path = lib/pcre2el 333 | url = git@github.com:joddie/pcre2el.git 334 | [submodule "pkg-info"] 335 | path = lib/pkg-info 336 | url = git@github.com:lunaryorn/pkg-info.el.git 337 | [submodule "po-mode"] 338 | path = lib/po-mode 339 | url = git@github.com:emacsmirror/po-mode.git 340 | [submodule "popup"] 341 | path = lib/popup 342 | url = git@github.com:auto-complete/popup-el.git 343 | [submodule "popwin"] 344 | path = lib/popwin 345 | url = git@github.com:m2ym/popwin-el.git 346 | [submodule "posframe"] 347 | path = lib/posframe 348 | url = git@github.com:tumashu/posframe.git 349 | [submodule "powerline"] 350 | path = lib/powerline 351 | url = git@github.com:milkypostman/powerline.git 352 | [submodule "powershell-mode"] 353 | path = lib/powershell-mode 354 | url = git@github.com:fperrin/powershell-mode.git 355 | [submodule "prescient"] 356 | path = lib/prescient 357 | url = git@github.com:raxod502/prescient.el.git 358 | [submodule "projectile"] 359 | path = lib/projectile 360 | url = git@github.com:bbatsov/projectile.git 361 | [submodule "pythonic"] 362 | path = lib/pythonic 363 | url = git@github.com:proofit404/pythonic.git 364 | [submodule "pyvenv"] 365 | path = lib/pyvenv 366 | url = git@github.com:jorgenschaefer/pyvenv.git 367 | [submodule "rainbow-delimiters"] 368 | path = lib/rainbow-delimiters 369 | url = git@github.com:Fanael/rainbow-delimiters.git 370 | [submodule "rust-mode"] 371 | path = lib/rust-mode 372 | url = git@github.com:rust-lang/rust-mode.git 373 | [submodule "s"] 374 | path = lib/s 375 | url = git@github.com:magnars/s.el.git 376 | [submodule "selectrum"] 377 | path = lib/selectrum 378 | url = git@github.com:raxod502/selectrum 379 | [submodule "shrink-path"] 380 | path = lib/shrink-path 381 | url = git@gitlab.com:bennya/shrink-path.el.git 382 | [submodule "smartparens"] 383 | path = lib/smartparens 384 | url = git@github.com:Fuco1/smartparens.git 385 | [submodule "spinner"] 386 | path = lib/spinner 387 | url = git@github.com:Malabarba/spinner.el.git 388 | [submodule "transient"] 389 | path = lib/transient 390 | url = git@github.com:magit/transient.git 391 | [submodule "tree-sitter"] 392 | path = lib/tree-sitter 393 | url = git@github.com:ubolonton/emacs-tree-sitter 394 | load-path = lisp 395 | load-path = langs 396 | [submodule "treepy"] 397 | path = lib/treepy 398 | url = git@github.com:volrath/treepy.el.git 399 | [submodule "typescript-mode"] 400 | path = lib/typescript-mode 401 | url = git@github.com:ananthakumaran/typescript.el.git 402 | [submodule "typoel"] 403 | path = lib/typoel 404 | url = git@github.com:jorgenschaefer/typoel.git 405 | [submodule "undo-fu"] 406 | path = lib/undo-fu 407 | url = git@gitlab.com:ideasman42/emacs-undo-fu.git 408 | [submodule "undo-tree"] 409 | path = lib/undo-tree 410 | url = http://www.dr-qubit.org/git/undo-tree.git 411 | [submodule "use-package"] 412 | path = lib/use-package 413 | url = git@github.com:jwiegley/use-package.git 414 | [submodule "vterm"] 415 | path = lib/vterm 416 | url = git@github.com:akermu/emacs-libvterm 417 | build-step = mkdir -p build 418 | build-step = cd build && cmake .. 419 | build-step = cd build && make 420 | [submodule "web-mode"] 421 | path = lib/web-mode 422 | url = git@github.com:fxbois/web-mode.git 423 | [submodule "wgrep"] 424 | path = lib/wgrep 425 | url = git@github.com:mhayashi1120/Emacs-wgrep.git 426 | no-byte-compile = wgrep-subtest.el 427 | [submodule "which-key"] 428 | path = lib/which-key 429 | url = git@github.com:justbur/emacs-which-key.git 430 | [submodule "which-key-posframe"] 431 | path = lib/which-key-posframe 432 | url = git@github.com:yanghaoxie/which-key-posframe.git 433 | [submodule "with-editor"] 434 | path = lib/with-editor 435 | url = git@github.com:magit/with-editor.git 436 | [submodule "ws-butler"] 437 | path = lib/ws-butler 438 | url = git@github.com:lewang/ws-butler.git 439 | [submodule "yaml-mode"] 440 | path = lib/yaml-mode 441 | url = git@github.com:yoshiki/yaml-mode.git 442 | [submodule "yasnippet"] 443 | path = lib/yasnippet 444 | url = git@github.com:joaotavora/yasnippet.git 445 | [submodule "yasnippet-snippets"] 446 | path = lib/yasnippet-snippets 447 | url = git@github.com:AndreaCrotti/yasnippet-snippets.git 448 | [submodule "zoutline"] 449 | path = lib/zoutline 450 | url = git@github.com:abo-abo/zoutline.git 451 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | EMACS ?= emacs 2 | EMACS_ARGUMENTS ?= -Q 3 | 4 | .PHONY: all help clean build build-init quick bootstrap 5 | 6 | all: build 7 | 8 | SILENCIO = --load subr-x 9 | SILENCIO += --eval "(put 'if-let 'byte-obsolete-info nil)" 10 | SILENCIO += --eval "(put 'when-let 'byte-obsolete-info nil)" 11 | SILENCIO += --eval "(fset 'original-message (symbol-function 'message))" 12 | SILENCIO += --eval "(fset 'message\ 13 | (lambda (format &rest args)\ 14 | (unless (equal format \"pcase-memoize: equal first branch, yet different\")\ 15 | (apply 'original-message format args))))" 16 | 17 | ELFILES = $(wildcard lisp/*.el) 18 | ELCFILES = $(ELFILES:.el=.elc) 19 | 20 | build build-init quick: $(ELCFILES) 21 | @$(MAKE) -f lib/borg/borg.mk $@ 22 | 23 | lisp: $(ELCFILES) 24 | 25 | $(ELCFILES): %.elc: %.el 26 | @$(EMACS) $(EMACS_ARGUMENTS) \ 27 | --batch -L lisp \ 28 | -L lib/borg --load borg $(SILENCIO) \ 29 | --funcall borg-initialize \ 30 | -f batch-byte-compile $< 31 | 32 | clean bootstrap: 33 | @$(MAKE) -f lib/borg/borg.mk $@ 34 | 35 | %: force 36 | @$(MAKE) -f lib/borg/borg.mk $@ 37 | force: ; 38 | -------------------------------------------------------------------------------- /custom.el: -------------------------------------------------------------------------------- 1 | (custom-set-variables 2 | ;; custom-set-variables was added by Custom. 3 | ;; If you edit it by hand, you could mess it up, so be careful. 4 | ;; Your init file should contain only one such instance. 5 | ;; If there is more than one, they won't work right. 6 | '(safe-local-variable-values 7 | '((flycheck-disabled-checkers emacs-lisp-checkdoc) 8 | (projectile-project-compilation-cmd . "make build") 9 | (projectile-project-test-cmd . "julia --project=. --eval 'using Pkg; Pkg.test(\"Aroma\")'") 10 | (projectile-project-test-cmd . "julia --project=. --color=yes --eval 'using Pkg; Pkg.test(\"Aroma\")'") 11 | (projectile-project-run-cmd . "julia --project=. run.jl") 12 | (projectile-project-run-cmd . "emacs") 13 | (projectile-project-compilaton-cmd . "make") 14 | (helm-make-build-dir . "doc") 15 | (projectile-project-run-cmd . "mkdir -p build; cd build; cmake ..; make run") 16 | (projectile-project-compilation-cmd . "mkdir -p build; cd build; cmake ..; make") 17 | (helm-make-build-dir . "Apps/bld-sd")))) 18 | (custom-set-faces 19 | ;; custom-set-faces was added by Custom. 20 | ;; If you edit it by hand, you could mess it up, so be careful. 21 | ;; Your init file should contain only one such instance. 22 | ;; If there is more than one, they won't work right. 23 | ) 24 | -------------------------------------------------------------------------------- /early-init.el: -------------------------------------------------------------------------------- 1 | ;;; -*- lexical-binding: t -*- 2 | 3 | (setq package-enable-at-startup nil 4 | tool-bar-mode nil 5 | menu-bar-mode nil) 6 | 7 | (set-scroll-bar-mode nil) 8 | -------------------------------------------------------------------------------- /etc/transient/levels.el: -------------------------------------------------------------------------------- 1 | ((magit-commit 2 | (magit:--gpg-sign . 1))) 3 | -------------------------------------------------------------------------------- /etc/window-purpose/layouts/irc.window-layout: -------------------------------------------------------------------------------- 1 | (nil (0 0 265 65) (t (0 0 133 65) (:purpose erc-evil-mode :purpose-dedicated t :width 0.5076335877862596 :height 0.5076923076923077 :edges (0.0 0.0 0.5076335877862596 0.5076923076923077)) (:purpose erc-emacs-beginners :purpose-dedicated t :width 0.5076335877862596 :height 0.49230769230769234 :edges (0.0 0.5076923076923077 0.5076335877862596 1.0))) (t (133 0 265 65) (:purpose erc-emacs :purpose-dedicated t :width 0.5038167938931297 :height 0.5076923076923077 :edges (0.5076335877862596 0.0 1.0114503816793894 0.5076923076923077)) (:purpose erc :purpose-dedicated t :width 0.5038167938931297 :height 0.49230769230769234 :edges (0.5076335877862596 0.5076923076923077 1.0114503816793894 1.0)))) -------------------------------------------------------------------------------- /etc/yasnippet/snippets/c-lang-common/once: -------------------------------------------------------------------------------- 1 | #name : #ifndef XXX; #define XXX; #endif 2 | # key: once 3 | # -- 4 | #ifndef ${1:`(upcase (replace-regexp-in-string "-" "_" (file-name-nondirectory (file-name-sans-extension (or (buffer-file-name) "")))))`_H} 5 | #define $1 6 | 7 | $0 8 | 9 | #endif /* $1 */ 10 | -------------------------------------------------------------------------------- /etc/yasnippet/snippets/latex-mode/equation: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: equation 3 | # key: eq 4 | # -- 5 | \begin{equation} 6 | \label{eqn:$1} 7 | $0 8 | \end{equation} -------------------------------------------------------------------------------- /init.el: -------------------------------------------------------------------------------- 1 | ;;; init.el --- Personal configuration. -*- lexical-binding: t -*- 2 | 3 | ;; Copyright (C) 2018 Eivind Fonn 4 | 5 | ;; This file is not part of GNU Emacs. 6 | 7 | ;;; License: 8 | 9 | ;; This file is free software; you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; This file is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this file. If not, see . 21 | 22 | ;;; Commentary: 23 | 24 | ;; General init of Emacs. 25 | 26 | ;;; Code: 27 | 28 | 29 | ;;; Initialize borg and set up load path 30 | 31 | (setq user-init-file (or load-file-name buffer-file-name) 32 | user-emacs-directory (file-name-directory user-init-file) 33 | custom-file (concat user-emacs-directory "custom.el") 34 | custom-theme-directory user-emacs-directory 35 | 36 | load-prefer-newer t 37 | 38 | evil-want-keybinding nil 39 | 40 | ;; Enable Keyboardio Model 01 mode 41 | ;; Disable this for the moment on all computers 42 | ;; keyboardiop (string= (system-name) "cauchy") 43 | keyboardiop nil 44 | 45 | ;; Computer ID 46 | cauchyp (string= (system-name) "cauchy") 47 | 48 | bb-left (kbd (if keyboardiop "" "C-h")) 49 | bb-down (kbd (if keyboardiop "" "C-j")) 50 | bb-up (kbd (if keyboardiop "" "C-k")) 51 | bb-right (kbd (if keyboardiop "" "C-l")) 52 | 53 | bb-font "Iosevka SS09 Semibold" 54 | bb-font-size 55 | (pcase (system-name) 56 | ("leibniz" 110) 57 | (_ 100))) 58 | 59 | (push (concat user-emacs-directory "lisp") load-path) 60 | (push (concat user-emacs-directory "lib/borg") load-path) 61 | (require 'borg) 62 | (borg-initialize) 63 | 64 | 65 | ;;; Local settings, if any 66 | 67 | (let ((filename (expand-file-name "local.el" user-emacs-directory))) 68 | (when (file-exists-p filename) 69 | (load-file filename))) 70 | 71 | 72 | ;;; Packages that should be enabled early 73 | 74 | (use-package exec-path-from-shell 75 | :config 76 | (setq exec-path-from-shell-check-startup-files nil) 77 | (exec-path-from-shell-initialize)) 78 | 79 | (use-package general 80 | :config 81 | (setq general-override-states '(normal visual motion)) 82 | (general-override-mode)) 83 | 84 | (use-package no-littering) 85 | 86 | (use-package popwin 87 | :config 88 | (setq popwin:special-display-config nil) 89 | (popwin-mode)) 90 | 91 | (use-package which-key 92 | :diminish which-key-mode 93 | :config 94 | (which-key-mode)) 95 | 96 | 97 | ;;; Function, variable, and macro definitions 98 | 99 | (require 'bb-defs) 100 | (require 'bb-macros) 101 | 102 | 103 | ;;; Theme 104 | 105 | (setq monokai-height-minus-1 1.0 106 | monokai-height-plus-1 1.0 107 | monokai-height-plus-2 1.0 108 | monokai-height-plus-3 1.0 109 | monokai-height-plus-4 1.0 110 | monokai-red "#ff4185" 111 | monokai-doc-face-as-comment t) 112 | (load-theme 'monokai 'noconfirm) 113 | 114 | (bb-after-display 115 | (set-face-attribute 'default nil :font bb-font :height bb-font-size) 116 | (set-face-attribute 'fixed-pitch nil :font bb-font :height bb-font-size) 117 | (set-face-attribute 'fixed-pitch-serif nil :font bb-font :height bb-font-size)) 118 | (set-face-attribute 'font-lock-comment-face nil :slant 'italic) 119 | (set-face-attribute 'font-lock-string-face nil :slant 'italic) 120 | (set-face-attribute 'font-lock-keyword-face nil :weight 'bold) 121 | (set-face-attribute 'font-lock-builtin-face nil :foreground "#ffabd6" :weight 'bold) 122 | (set-face-attribute 'mode-line nil :background monokai-background) 123 | (set-face-attribute 'mode-line-emphasis nil :foreground "#ffabd6" :weight 'ultra-bold) 124 | (set-face-attribute 'region nil :background monokai-gray) 125 | 126 | (with-eval-after-load 'doom-modeline 127 | (set-face-attribute 'doom-modeline-evil-emacs-state nil :foreground "SkyBlue2") 128 | (set-face-attribute 'doom-modeline-evil-insert-state nil :foreground "chartreuse3") 129 | (set-face-attribute 'doom-modeline-evil-normal-state nil :foreground "DarkGoldenrod2") 130 | (set-face-attribute 'doom-modeline-evil-operator-state nil :foreground "DarkGoldenrod2") 131 | (set-face-attribute 'doom-modeline-evil-replace-state nil :foreground "chocolate") 132 | (set-face-attribute 'doom-modeline-evil-visual-state nil :foreground "gray") 133 | (set-face-attribute 'doom-modeline-evil-motion-state nil :foreground "plum3") 134 | (set-face-attribute 'doom-modeline-project-dir nil :italic nil)) 135 | 136 | (with-eval-after-load 'company 137 | (set-face-attribute 'company-tooltip-selection nil :extend t)) 138 | (with-eval-after-load 'hl-line 139 | (set-face-attribute 'hl-line nil :extend t)) 140 | (with-eval-after-load 'magit 141 | (set-face-attribute 'magit-diff-hunk-heading nil :extend t) 142 | (set-face-attribute 'magit-diff-hunk-heading-highlight nil :extend t) 143 | (set-face-attribute 'magit-diff-added-highlight nil :extend t) 144 | (set-face-attribute 'magit-diff-context-highlight nil :extend t) 145 | (set-face-attribute 'magit-diff-removed-highlight nil :extend t) 146 | (set-face-attribute 'magit-section-highlight nil :extend t)) 147 | (with-eval-after-load 'org 148 | (set-face-attribute 'org-block nil :extend t) 149 | (set-face-attribute 'org-block-begin-line nil :extend t) 150 | (set-face-attribute 'org-block-end-line nil :extend t)) 151 | 152 | (let ((alist `((?- . ,(rx (: (+ "-") (? ">")))) 153 | (?= . ,(rx (: (+ "=") (? ">")))) 154 | (?< . ,(rx (: "<" (| (: (+ "=") (? ">")) (+ "~") (: "!--" (* "-")) (: "|" (? ">")))))) 155 | (?> . ,(rx ">=")) 156 | (?! . ,(rx "!" (** 1 2 "="))) 157 | (?: . ,(rx ":" (| "+" "-" "=" (** 1 2 ":")))) 158 | (?+ . ,(rx "++"))))) 159 | (dolist (char-regexp alist) 160 | (set-char-table-range composition-function-table (car char-regexp) 161 | `([,(cdr char-regexp) 0 font-shape-gstring])))) 162 | 163 | ;; (use-package dimmer 164 | ;; :init 165 | ;; (setq dimmer-fraction 0.25) 166 | ;; :config 167 | ;; (push 'bb-dimmer-predicate dimmer-prevent-dimming-predicates) 168 | ;; (dimmer-configure-which-key) 169 | ;; (dimmer-mode)) 170 | 171 | 172 | ;;; Modeline 173 | 174 | (use-package doom-modeline 175 | :init 176 | (bb-after-display 177 | (setq doom-modeline-icon t)) 178 | (setq doom-modeline-buffer-file-name-style 'relative-to-project 179 | doom-modeline-column-zero-based nil 180 | doom-modeline-buffer-encoding nil 181 | doom-modeline-minor-modes t 182 | doom-modeline-project-detection 'projectile) 183 | (setq-default doom-modeline-env-python-parser-fn 'bb-py-all-env-parse) 184 | :config 185 | (require 'bb-segments) 186 | (doom-modeline-mode)) 187 | 188 | 189 | ;;; General Emacs settings (built-ins, etc.) 190 | 191 | (setq user-init-file (or load-file-name buffer-file-name) 192 | user-emacs-directory (file-name-directory user-init-file) 193 | 194 | inhibit-startup-buffer-menu t 195 | inhibit-startup-screen t 196 | initial-buffer-choice t 197 | initial-scratch-message "" 198 | 199 | auto-save-list-file-prefix nil 200 | backup-by-copying t 201 | delete-old-versions t 202 | kept-new-versions 6 203 | kept-old-versions 2 204 | create-lockfiles nil 205 | 206 | auto-revert-check-vc-info t 207 | read-quoted-char-radix 16 208 | require-final-newline t 209 | ring-bell-function 'ignore 210 | scroll-conservatively 101 211 | vc-follow-symlinks t 212 | x-wait-for-event-timeout 0.05) 213 | 214 | (setq-default fill-column 70 215 | indent-tabs-mode nil) 216 | 217 | (fset 'yes-or-no-p 'y-or-n-p) 218 | (fset 'startup-echo-area-message (lambda () "")) 219 | (put 'set-face-attribute 'lisp-indent-function 2) 220 | (push '(buffer-predicate . bb-useful-buffer-p) default-frame-alist) 221 | (bb-popwin special-mode) 222 | 223 | (global-set-key [C-mouse-4] 'text-scale-increase) 224 | (global-set-key [C-mouse-5] 'text-scale-decrease) 225 | 226 | (blink-cursor-mode -1) 227 | 228 | (use-package abbrev 229 | :defer t 230 | :diminish abbrev-mode) 231 | 232 | (use-package autorevert 233 | :diminish auto-revert-mode 234 | :config 235 | (global-auto-revert-mode)) 236 | 237 | (use-package compile 238 | :defer t 239 | :init 240 | (bb-popwin compilation-mode) 241 | (setq compilation-scroll-output 'first-error) 242 | :config 243 | (require 'ansi-color) 244 | (add-hook 'compilation-filter-hook 'bb-compilation-filter)) 245 | 246 | (use-package eldoc 247 | :defer t 248 | :diminish eldoc-mode) 249 | 250 | (use-package face-remap 251 | :defer t 252 | :diminish text-scale-mode) 253 | 254 | (use-package help-mode 255 | :defer t 256 | :init 257 | (bb-popwin help-mode)) 258 | 259 | (use-package hl-line 260 | :config 261 | (global-hl-line-mode)) 262 | 263 | (use-package outline 264 | :defer t 265 | :diminish outline-minor-mode) 266 | 267 | (use-package recentf 268 | :init 269 | (setq recentf-max-saved-items 10000) 270 | :config 271 | (recentf-mode)) 272 | 273 | (use-package simple 274 | :defer t 275 | :diminish auto-fill-function) 276 | 277 | (use-package smerge-mode 278 | :defer t 279 | :diminish (smerge-mode . "[sm]")) 280 | 281 | (use-package tree-widget 282 | :defer t 283 | :config 284 | (bb-after-display 285 | (setq tree-widget-image-enable (display-images-p)))) 286 | 287 | (use-package uniquify) 288 | 289 | (use-package winner 290 | :config 291 | (winner-mode)) 292 | 293 | (use-package whitespace 294 | :defer t 295 | :diminish (whitespace-mode . "w") 296 | :init 297 | (bb-leader ("tw" 'whitespace-mode "Toggle whitespace mode"))) 298 | 299 | 300 | ;;; Leader bindings, categories and descriptions 301 | 302 | (bb-leader 303 | ("" 'bb-alternate-buffer "Prev buf") 304 | (";" 'eval-expression "Eval elisp") 305 | ("bd" 'bb-kill-buffer "Kill buf") 306 | ("fd" 'bb-kill-buffer-file "Kill buf, del file") 307 | ("fs" 'save-buffer "Save buf") 308 | ("fy" 'bb-show-and-copy-filename "Copy filename") 309 | ("hdc" 'describe-char "Desc character") 310 | ("hdf" 'counsel-describe-function "Desc function") 311 | ("hdF" 'counsel-describe-face "Desc face") 312 | ("hdk" 'describe-key "Desc key") 313 | ("hdv" 'counsel-describe-variable "Desc var") 314 | ("hi" 'bb-find-init "init.el") 315 | ("hs" 'bb-find-scratch "Scratch buf") 316 | ("td" 'bb-toggle-debug-on-error "Toggle debug-on-error") 317 | ("u" 'universal-argument "Universal arg") 318 | ("w" 'hydra-windows/body "Window mgmt")) 319 | 320 | (which-key-add-key-based-replacements 321 | "SPC a" "Apps" 322 | "SPC b" "Buffers" 323 | "SPC c" "Compile" 324 | "SPC e" "Errors" 325 | "SPC f" "Files" 326 | "SPC h" "Help" 327 | "SPC hd" "Describe" 328 | "SPC j" "Jump" 329 | "SPC p" "Project" 330 | "SPC q" "Quit" 331 | "SPC s" "Search" 332 | "SPC t" "Toggle" 333 | "SPC v" "Venvs") 334 | 335 | (which-key-add-key-based-replacements 336 | "SPC ==" "Align" 337 | "SPC cc" "Build" 338 | "SPC cv" "Show build" 339 | "SPC cb" "Eval buf" 340 | "SPC cf" "Eval fun" 341 | "SPC cm" "Eval macro" 342 | "SPC cs" "Eval expr" 343 | "SPC l" "Struct-ed" 344 | "SPC qq" "Quit connections" 345 | "SPC te" "Engine" 346 | "SPC va" "Activate" 347 | "SPC vd" "Deactivate") 348 | 349 | 350 | ;;; Evil and Co. 351 | 352 | (use-package evil 353 | :init 354 | (setq evil-normal-state-cursor '("DarkGoldenrod2" box) 355 | evil-insert-state-cursor '("chartreuse3" (bar . 2)) 356 | evil-emacs-state-cursor '("SkyBlue2" box) 357 | evil-replace-state-cursor '("chocolate" (hbar . 2)) 358 | evil-visual-state-cursor '("gray" (hbar . 2)) 359 | evil-motion-state-cursor '("plum3" box) 360 | evil-want-integration t 361 | evil-want-C-u-scroll t 362 | evil-undo-system 'undo-redo) 363 | :config 364 | (unless (fboundp 'evil-bind-key) 365 | (defun evil-bind-key (state keymap &rest body) 366 | (if (and (symbolp keymap) (not (memq keymap '(local global)))) 367 | (apply #'evil-define-minor-mode-key state keymap body) 368 | (apply #'evil-define-key* state keymap body)))) 369 | 370 | (evil-mode) 371 | (bb-add-hook evil-insert-state-exit-hook 372 | (deactivate-mark)) 373 | 374 | ;; Miscellaneous keybindings 375 | (define-key evil-motion-state-map (kbd "") 'windmove-left) 376 | (define-key evil-motion-state-map (kbd "") 'windmove-down) 377 | (define-key evil-motion-state-map (kbd "") 'windmove-up) 378 | (define-key evil-motion-state-map (kbd "") 'windmove-right) 379 | 380 | (define-key evil-motion-state-map (kbd "gd") 'xref-find-definitions) 381 | (define-key evil-motion-state-map (kbd "gD") 'xref-find-definitions-other-window) 382 | (define-key evil-visual-state-map (kbd "J") (concat ":m '>+1" (kbd "RET") "gv=gv")) 383 | (define-key evil-visual-state-map (kbd "K") (concat ":m '<-2" (kbd "RET") "gv=gv")) 384 | 385 | ;; Unimpaired 386 | (define-key evil-motion-state-map (kbd "[ b") 'previous-buffer) 387 | (define-key evil-motion-state-map (kbd "] b") 'next-buffer) 388 | (define-key evil-normal-state-map (kbd "[ SPC") 'bb-insert-line-above) 389 | (define-key evil-normal-state-map (kbd "] SPC") 'bb-insert-line-below) 390 | (define-key evil-normal-state-map (kbd "[ s") 'bb-insert-spaces-before) 391 | (define-key evil-normal-state-map (kbd "] s") 'bb-insert-spaces-after) 392 | 393 | ;; Other 394 | (evil-set-command-property 'xref-find-definitions :jump t) 395 | (evil-set-command-property 'xref-find-references :jump t) 396 | (define-key evil-visual-state-map (kbd ">") 'bb-shift-right) 397 | (define-key evil-visual-state-map (kbd "<") 'bb-shift-left) 398 | 399 | (add-hook 'after-change-major-mode-hook 'bb-set-evil-shift-width) 400 | (add-hook 'hack-local-variables-hook 'bb-set-evil-shift-width)) 401 | 402 | (use-package evil-args 403 | :defer t 404 | :init 405 | (define-key evil-inner-text-objects-map "a" 'evil-inner-arg) 406 | (define-key evil-outer-text-objects-map "a" 'evil-outer-arg)) 407 | 408 | (use-package evil-collection 409 | :after evil 410 | :config 411 | (setq evil-collection-setup-minibuffer nil 412 | evil-collection-mode-list 413 | '(compile 414 | ediff 415 | elisp-mode 416 | flycheck 417 | ivy 418 | magit 419 | magit-todos)) 420 | (evil-collection-init)) 421 | 422 | (use-package evil-embrace 423 | :after evil-surround 424 | :config 425 | (evil-embrace-enable-evil-surround-integration)) 426 | 427 | (use-package evil-escape 428 | :diminish evil-escape-mode 429 | :config 430 | (push 'emacs evil-escape-excluded-states) 431 | (unless keyboardiop 432 | (evil-escape-mode)) 433 | (define-key minibuffer-local-map [escape] 'evil-escape) 434 | (define-key minibuffer-local-ns-map [escape] 'evil-escape) 435 | (define-key minibuffer-local-completion-map [escape] 'evil-escape) 436 | (define-key minibuffer-local-must-match-map [escape] 'evil-escape) 437 | (define-key minibuffer-local-isearch-map [escape] 'evil-escape)) 438 | 439 | (use-package evil-indent-plus 440 | :config 441 | (evil-indent-plus-default-bindings)) 442 | 443 | (use-package evil-little-word 444 | :after evil) 445 | 446 | (use-package evil-nerd-commenter 447 | :defer t 448 | :init 449 | (define-key evil-normal-state-map (kbd "gc") 'evilnc-comment-operator) 450 | (bb-leader 451 | ("cl" 'evilnc-comment-or-uncomment-lines "Comment lines") 452 | ("cp" 'evilnc-comment-or-uncomment-paragraphs "Comment paragraphs") 453 | ("cy" 'evilnc-copy-and-comment-lines "Copy and comment"))) 454 | 455 | (use-package evil-matchit 456 | :config 457 | (global-evil-matchit-mode)) 458 | 459 | (use-package evil-numbers 460 | :defer t 461 | :init 462 | (define-key evil-normal-state-map (kbd "+") 'hydra-numbers/evil-numbers/inc-at-pt) 463 | (define-key evil-normal-state-map (kbd "_") 'hydra-numbers/evil-numbers/dec-at-pt)) 464 | 465 | (use-package evil-smartparens 466 | :hook (smartparens-enabled . evil-smartparens-mode) 467 | :diminish evil-smartparens-mode 468 | :config 469 | (bb-advise after evil-sp--add-bindings () 470 | (evil-bind-key 'visual evil-smartparens-mode-map (kbd "o") nil)) 471 | (bb-advise before evil-delete-backward-char-and-join (count &rest _args) 472 | (save-match-data 473 | (sp-delete-pair count)))) 474 | 475 | (use-package evil-surround 476 | :after evil 477 | :config 478 | (global-evil-surround-mode) 479 | :config 480 | (evil-bind-key 'visual evil-surround-mode-map "s" 'evil-surround-region)) 481 | 482 | 483 | ;;; Bufler and eyebrowse 484 | 485 | (use-package bufler 486 | :init 487 | (bb-leader 488 | ("bb" 'bb-counsel-ibuffer "switch buffer")) 489 | :config 490 | (bufler-mode) 491 | (add-hook 'bufler-workspace-set-hook 'bb-bufler-workspace-frame-set-hook) 492 | (bb-advise around bufler-workspace-mode-lighter ())) 493 | 494 | (use-package eyebrowse 495 | :init 496 | (setq eyebrowse-new-workspace t 497 | eyebrowse-wrap-around t) 498 | :config 499 | (add-hook 'eyebrowse-pre-window-switch-hook 'bb-bufler-eyebrowse-pre-switch) 500 | (add-hook 'eyebrowse-post-window-switch-hook 'bb-bufler-eyebrowse-post-switch) 501 | (define-key evil-motion-state-map (kbd "") 'eyebrowse-next-window-config) 502 | (define-key evil-motion-state-map (kbd "") 'eyebrowse-prev-window-config) 503 | (define-key evil-emacs-state-map (kbd "") 'eyebrowse-next-window-config) 504 | (define-key evil-emacs-state-map (kbd "") 'eyebrowse-prev-window-config) 505 | (eyebrowse-mode)) 506 | 507 | 508 | ;;; Company and Co. 509 | 510 | (use-package company 511 | :defer t 512 | :diminish (company-mode . "c") 513 | :init 514 | (setq company-idle-delay 0.1 515 | company-minimum-prefix-length 1 516 | company-require-match nil 517 | company-tooltip-align-annotations t 518 | company-tooltip-minimum-width 60) 519 | (bb-leader ("tc" 'company-mode "Toggle auto-completion")) 520 | :config 521 | (define-key company-active-map bb-right 'company-complete-selection) 522 | (define-key company-active-map bb-down 'company-select-next-or-abort) 523 | (define-key company-active-map bb-up 'company-select-previous-or-abort) 524 | (define-key company-active-map (kbd "RET") nil) 525 | (define-key company-active-map (kbd "") nil) 526 | (define-key company-active-map (kbd "TAB") nil) 527 | (define-key company-active-map (kbd "") nil) 528 | (define-key company-active-map (kbd "C-w") nil) 529 | (set-face-attribute 'company-tooltip-selection nil 530 | :background monokai-comments :foreground monokai-emphasis) 531 | (set-face-attribute 'company-tooltip-common-selection nil 532 | :foreground monokai-blue :background monokai-comments) 533 | (set-face-attribute 'company-tooltip-annotation-selection nil 534 | :background monokai-comments)) 535 | 536 | (use-package company-box 537 | :diminish company-box-mode 538 | :hook (company-mode . company-box-mode) 539 | :init 540 | (setq company-box-icons-alist 'company-box-icons-all-the-icons) 541 | :config 542 | (require 'all-the-icons) 543 | (setf (alist-get 'min-height company-box-frame-parameters) 6) 544 | (setq company-box-icons-alist 'company-box-icons-all-the-icons 545 | company-box-backends-colors nil 546 | 547 | ;; These are the Doom Emacs defaults 548 | company-box-icons-all-the-icons 549 | `((Unknown . ,(all-the-icons-material "find_in_page" :face 'all-the-icons-purple)) 550 | (Text . ,(all-the-icons-material "text_fields" :face 'all-the-icons-green)) 551 | (Method . ,(all-the-icons-material "functions" :face 'all-the-icons-red)) 552 | (Function . ,(all-the-icons-material "functions" :face 'all-the-icons-red)) 553 | (Constructor . ,(all-the-icons-material "functions" :face 'all-the-icons-red)) 554 | (Field . ,(all-the-icons-material "functions" :face 'all-the-icons-red)) 555 | (Variable . ,(all-the-icons-material "adjust" :face 'all-the-icons-blue)) 556 | (Class . ,(all-the-icons-material "class" :face 'all-the-icons-red)) 557 | (Interface . ,(all-the-icons-material "settings_input_component" :face 'all-the-icons-red)) 558 | (Module . ,(all-the-icons-material "view_module" :face 'all-the-icons-red)) 559 | (Property . ,(all-the-icons-material "settings" :face 'all-the-icons-red)) 560 | (Unit . ,(all-the-icons-material "straighten" :face 'all-the-icons-red)) 561 | (Value . ,(all-the-icons-material "filter_1" :face 'all-the-icons-red)) 562 | (Enum . ,(all-the-icons-material "plus_one" :face 'all-the-icons-red)) 563 | (Keyword . ,(all-the-icons-material "filter_center_focus" :face 'all-the-icons-red)) 564 | (Snippet . ,(all-the-icons-material "short_text" :face 'all-the-icons-red)) 565 | (Color . ,(all-the-icons-material "color_lens" :face 'all-the-icons-red)) 566 | (File . ,(all-the-icons-material "insert_drive_file" :face 'all-the-icons-red)) 567 | (Reference . ,(all-the-icons-material "collections_bookmark" :face 'all-the-icons-red)) 568 | (Folder . ,(all-the-icons-material "folder" :face 'all-the-icons-red)) 569 | (EnumMember . ,(all-the-icons-material "people" :face 'all-the-icons-red)) 570 | (Constant . ,(all-the-icons-material "pause_circle_filled" :face 'all-the-icons-red)) 571 | (Struct . ,(all-the-icons-material "streetview" :face 'all-the-icons-red)) 572 | (Event . ,(all-the-icons-material "event" :face 'all-the-icons-red)) 573 | (Operator . ,(all-the-icons-material "control_point" :face 'all-the-icons-red)) 574 | (TypeParameter . ,(all-the-icons-material "class" :face 'all-the-icons-red)) 575 | (Template . ,(all-the-icons-material "short_text" :face 'all-the-icons-green)))) 576 | 577 | ;; Add a space after the icon 578 | (dolist (elt company-box-icons-all-the-icons) 579 | (setcdr elt (concat (cdr elt) " ")))) 580 | 581 | 582 | ;;; Flycheck and Co. 583 | 584 | (use-package flycheck 585 | :hook (lsp-mode . flycheck-mode) 586 | :diminish (flycheck-mode . "f") 587 | :init 588 | (setq-default flycheck-check-syntax-automatically '(save mode-enabled)) 589 | (bb-leader 590 | ("tf" 'flycheck-mode "Toggle flycheck") 591 | ("el" 'flycheck-list-errors "List flycheck errors") 592 | ("eb" 'flycheck-buffer "Run flycheck on buffer") 593 | ("ec" 'flycheck-clear "Clear flycheck errors")) 594 | (bb-popwin flycheck-error-list-mode) 595 | :config 596 | (aset flycheck-error-list-format 5 '("Message" 0 t))) 597 | 598 | 599 | ;;; Ivy and Co. 600 | 601 | (use-package ivy 602 | :diminish ivy-mode 603 | :init 604 | (bb-leader ("rl" 'ivy-resume "Resume ivy")) 605 | (setq ivy-format-functions-alist 606 | '((t . ivy-format-function-line))) 607 | (setq ivy-re-builders-alist 608 | '((swiper . ivy--regex-plus) 609 | (counsel-ag . ivy--regex-plus) 610 | (t . ivy--regex-fuzzy))) 611 | :config 612 | (ivy-mode) 613 | (define-key ivy-minibuffer-map (kbd "C-j") 'ivy-next-line) 614 | (define-key ivy-minibuffer-map (kbd "C-k") 'ivy-previous-line) 615 | (define-key ivy-minibuffer-map (kbd "C-d") 'ivy-scroll-down-command) 616 | (define-key ivy-minibuffer-map (kbd "C-u") 'ivy-scroll-up-command) 617 | (define-key ivy-minibuffer-map (kbd "C-l") 'ivy-alt-done) 618 | (define-key ivy-minibuffer-map (kbd "M-l") 'ivy-dispatching-done) 619 | (define-key ivy-minibuffer-map (kbd "C-M-l") 'ivy-immediate-done)) 620 | 621 | (use-package ivy-posframe 622 | :diminish ivy-posframe-mode 623 | :after ivy 624 | :init 625 | (setq ivy-posframe-display-functions-alist 626 | '((t . bb-ivy-posframe-display-frame-top-center))) 627 | :config 628 | (ivy-posframe-mode)) 629 | 630 | (use-package counsel 631 | :defer t 632 | :init 633 | (bb-leader 634 | ("SPC" 'counsel-M-x "Run command") 635 | ("/" 'counsel-ag "Search in project") 636 | ("ff" 'counsel-find-file "Find file") 637 | ("fl" 'counsel-find-library "Find library") 638 | ("fr" 'counsel-recentf "Recent files") 639 | ("ji" 'counsel-imenu "Find location in file")) 640 | :config 641 | (ivy-add-actions 'counsel-find-file '(("w" bb-counsel-find-file-new-workspace-action "new workspace"))) 642 | (ivy-add-actions 'counsel-recentf '(("w" bb-counsel-recentf-new-workspace-action "new workspace"))) 643 | (define-key counsel-ag-map (kbd "M-l") 'ivy-call-and-recenter) 644 | (define-key counsel-ag-map (kbd "C-l") 'ivy-done) 645 | (define-key counsel-find-file-map (kbd "C-h") 'counsel-up-directory) 646 | (define-key counsel-find-file-map (kbd "C-l") 'ivy-alt-done) 647 | (define-key counsel-imenu-map (kbd "M-l") 'ivy-call-and-recenter) 648 | (define-key counsel-imenu-map (kbd "C-l") 'ivy-done)) 649 | 650 | (use-package counsel-projectile 651 | :defer t 652 | :init 653 | (bb-leader 654 | ("pb" 'counsel-projectile-switch-to-buffer "Switch to project buffer") 655 | ("pd" 'counsel-projectile-find-dir "Find project directory") 656 | ("pf" 'counsel-projectile-find-file "Find project file") 657 | ("ph" 'counsel-projectile "Projectile") 658 | ("pp" 'counsel-projectile-switch-project "Find project")) 659 | :config 660 | (ivy-add-actions 'counsel-projectile '(("w" bb-counsel-projectile-new-workspace-action "new workspace")))) 661 | 662 | (use-package swiper 663 | :defer t 664 | :init 665 | (bb-leader ("ss" 'swiper "Search in buffer")) 666 | :config 667 | (define-key swiper-map (kbd "C-l") 'ivy-done)) 668 | 669 | (use-package ivy-prescient 670 | :after counsel 671 | :init 672 | (setq ivy-prescient-enable-filtering nil 673 | ivy-prescient-retain-classic-highlighting t) 674 | :config 675 | (ivy-prescient-mode)) 676 | 677 | 678 | ;;; IRC and Co. 679 | 680 | (use-package bb-erc 681 | :commands (bb-erc) 682 | :init 683 | (setq erc-timestamp-format-let "\n%A %B %e, %Y\n\n" 684 | erc-timestamp-format-right "%H:%M" 685 | erc-timestamp-right-column 80 686 | erc-prompt-for-nickserv-password nil 687 | erc-image-inline-rescale 200 688 | erc-hide-list '("JOIN" "PART" "QUIT" "NICK") 689 | erc-track-position-in-mode-line t 690 | erc-track-exclude-server-buffer t 691 | erc-track-exclude-types 692 | '("JOIN" "NICK" "PART" "QUIT" "MODE" "305" "324" "329" "332" "333" "353" "477") 693 | erc-track-shorten-function 694 | (lambda (names) (and names (list (propertize "!" 'face 'erc-notice-face)))) 695 | erc-track-use-faces nil 696 | erc-join-buffer 'bury) 697 | (bb-leader 698 | ("ai" 'bb-erc "Open IRC") 699 | ("bi" 'erc-track-switch-buffer "Switch to IRC buffer with unread messages")) 700 | (bb-mm-leader erc-mode "qq" 'erc-quit-server) 701 | (evil-set-initial-state 'erc-mode 'normal) 702 | (bb-add-hook erc-mode-hook 703 | (setq-local global-hl-line-mode nil))) 704 | 705 | 706 | ;;; LSP and Co. 707 | 708 | (use-package lsp 709 | :diminish lsp-mode 710 | :defer t 711 | :init 712 | (setq lsp-auto-guess-root t 713 | lsp-diagnostic-provider :flycheck 714 | lsp-enable-snippet nil 715 | lsp-flycheck-live-reporting nil 716 | lsp-log-io nil 717 | lsp-progress-via-spinner nil 718 | lsp-signature-auto-activate nil) 719 | (bb-leader ("tl" 'lsp-mode "Toggle LSP") 720 | ("vr" 'lsp-restart-workspace "Restart LSP")) 721 | (define-key evil-insert-state-map (kbd "C-l") 'company-complete) 722 | 723 | :config 724 | (remove-hook 'lsp-eldoc-hook 'lsp-document-highlight) 725 | (set-face-attribute 'lsp-face-highlight-textual nil 726 | :background monokai-highlight-line)) 727 | 728 | (use-package lsp-mode 729 | :defer t 730 | :config 731 | (bb-advise around lsp-mode-line ())) 732 | 733 | (use-package lsp-clangd 734 | :defer t 735 | :config 736 | (bb-lsp-set-priority 'clangd 1)) 737 | 738 | (use-package lsp-ui 739 | :hook (lsp-mode . lsp-ui-mode) 740 | :init 741 | (setq lsp-ui-doc-enable nil 742 | lsp-ui-sideline-enable nil 743 | lsp-enable-symbol-highlighting nil) 744 | (bb-leader ("tr" 'lsp-ui-sideline-mode "Toggle LSP sideline")) 745 | :config 746 | (evil-bind-key 'motion lsp-ui-mode-map "gr" 'lsp-ui-peek-find-references)) 747 | 748 | (use-package lsp-ui-peek 749 | :defer t 750 | :init 751 | (add-hook 'lsp-ui-peek-mode-hook 'evil-normalize-keymaps) 752 | :config 753 | (evil-make-intercept-map lsp-ui-peek-mode-map) 754 | (define-key lsp-ui-peek-mode-map (kbd "j") 'lsp-ui-peek--select-next) 755 | (define-key lsp-ui-peek-mode-map (kbd "k") 'lsp-ui-peek--select-prev) 756 | (define-key lsp-ui-peek-mode-map bb-down 'lsp-ui-peek--select-next-file) 757 | (define-key lsp-ui-peek-mode-map bb-up 'lsp-ui-peek--select-prev-file) 758 | (define-key lsp-ui-peek-mode-map bb-right 'lsp-ui-peek--goto-xref)) 759 | 760 | 761 | ;;; Magit and Co. 762 | 763 | (use-package magit 764 | :init 765 | (setq magit-bury-buffer-function 'magit-mode-quit-window) 766 | (bb-leader 767 | ("gf" 'magit-file-dispatch "Git file actions") 768 | ("gs" 'magit-status "Open Magit status") 769 | ("gb" 'magit-blame "Git blame buffer")) 770 | (push "magit.*" bb-useless-buffers-regexp)) 771 | 772 | (use-package evil-magit 773 | :after magit) 774 | 775 | (use-package forge 776 | :after magit 777 | :config 778 | (evil-bind-key '(normal visual) magit-mode-map "," 'forge-dispatch) 779 | (evil-bind-key 'normal magit-commit-section-map (kbd "gb") 'forge-browse-dwim) 780 | (evil-bind-key 'normal magit-remote-section-map (kbd "gb") 'forge-browse-remote) 781 | (evil-bind-key 'normal magit-branch-section-map (kbd "gb") 'forge-browse-branch) 782 | (evil-bind-key 'normal forge-topic-mode-map (kbd "C-c C-c") 'forge-create-post)) 783 | 784 | (use-package forge-list 785 | :defer t 786 | :config 787 | (evil-bind-key 'normal forge-topic-list-mode-map (kbd "q") 'quit-window) 788 | (evil-bind-key 'normal forge-topic-list-mode-map (kbd "o") 'forge-browse-topic)) 789 | 790 | (use-package magit-todos 791 | :after magit 792 | :config 793 | (magit-todos-mode)) 794 | 795 | (use-package with-editor 796 | :defer t 797 | :diminish with-editor-mode) 798 | 799 | 800 | ;;; Org and Co. 801 | 802 | (use-package org 803 | :defer t 804 | :init 805 | (setq org-src-window-setup 'current-window 806 | org-adapt-indentation nil) 807 | (add-hook 'org-src-mode-hook 'evil-normalize-keymaps 'end) 808 | :config 809 | ;; Use C-c C-c as a 'commit' binding when editing org source blocks 810 | (evil-bind-key 'normal org-src-mode-map (kbd "C-c C-c") 'org-edit-src-exit)) 811 | 812 | (use-package evil-org 813 | :diminish evil-org-mode 814 | :hook (org-mode . evil-org-mode)) 815 | 816 | 817 | ;;; C/C++ and Co. 818 | 819 | (use-package cc-mode 820 | :defer t 821 | :init 822 | (add-hook 'c-mode-hook 'lsp) 823 | (add-hook 'c++-mode-hook 'lsp)) 824 | 825 | (use-package cc-styles 826 | :defer t 827 | :config 828 | (c-add-style "personal" 829 | '((indent-tabs-mode . nil) 830 | (c-basic-offset . 4) 831 | (c-offsets-alist 832 | (arglist-close . 0) 833 | (inextern-lang . 0) 834 | (inline-open . 0) 835 | (innamespace . 0) 836 | (statement-cont . c-lineup-assignments) 837 | (substatement-open . 0)))) 838 | (push '(other . "personal") c-default-style)) 839 | 840 | (use-package cmake-mode 841 | :defer t 842 | :init 843 | (bb-company cmake-mode company-cmake)) 844 | 845 | (use-package ccls 846 | :if (bb-has-executable-p 'lsp-cc-ccls) 847 | :after lsp 848 | :config 849 | (bb-lsp-set-priority 'ccls 0)) 850 | 851 | (use-package cquery 852 | ;; Use cquery if ccls is not available 853 | :if (and (not (bb-has-executable-p 'lsp-cc-ccls)) 854 | (bb-has-executable-p 'lsp-cc-cquery)) 855 | :after lsp) 856 | 857 | 858 | ;;; HTML and Co. 859 | 860 | (use-package web-mode 861 | :mode ("\\.\\(dj\\)?html?\\'" "\\.xinp\\'") 862 | :init 863 | (bb-mm-leader web-mode "te" 'web-mode-set-engine) 864 | (setq-default web-mode-markup-indent-offset 2 865 | web-mode-css-indent-offset 2 866 | web-mode-code-indent-offset 4) 867 | (when (bb-has-executable-p 'lsp-html) 868 | (add-hook 'web-mode-hook 'lsp)) 869 | :config 870 | (set-face-attribute 'web-mode-comment-face nil :slant 'italic)) 871 | 872 | 873 | ;;; Julia and Co. 874 | 875 | (use-package julia-mode 876 | :defer t 877 | :init 878 | (add-hook 'julia-mode-hook 'lsp)) 879 | 880 | (use-package lsp-julia 881 | :after lsp 882 | :init 883 | (setq lsp-julia-package-dir (no-littering-expand-var-file-name "lsp-julia/") 884 | lsp-julia-default-environment "~/.julia/environments/v1.3")) 885 | 886 | 887 | ;;; LaTeX and Co. 888 | 889 | (use-package auctex-latexmk 890 | :commands auctex-latexmk-setup 891 | :after latex 892 | :init 893 | (setq auctex-latexmk-inherit-TeX-PDF-mode t) 894 | :config 895 | (auctex-latexmk-setup)) 896 | 897 | (use-package bibtex 898 | :defer t 899 | :init 900 | (setq bibtex-align-at-equal-sign t) 901 | (bb-mm-leader bibtex-mode "==" 'bibtex-fill-entry)) 902 | 903 | (use-package company-reftex 904 | :defer t 905 | :init 906 | (setq company-reftex-max-annotation-length 100)) 907 | 908 | (use-package reftex 909 | :hook (LaTeX-mode . reftex-mode) 910 | :diminish reftex-mode) 911 | 912 | (use-package tex-buf 913 | :defer t 914 | :diminish (compilation-in-progress . "[c]")) 915 | 916 | (use-package tex-mode 917 | :defer t 918 | :config 919 | (with-eval-after-load 'smartparens 920 | (bb-apply-newline-indent (latex-mode) "{" ("\\[" "\\]")))) 921 | 922 | (use-package tex-site 923 | ;; Not deferred, since tex-site.el is essentially an autoloads file. 924 | :init 925 | (setq tex-fontify-script nil 926 | font-latex-fontify-script nil 927 | TeX-parse-self nil) 928 | (add-hook 'latex-mode-hook 'TeX-PDF-mode) 929 | (bb-company LaTeX-mode 930 | company-reftex-labels company-reftex-citations 931 | company-auctex-macros company-auctex-environments) 932 | (bb-mm-leader latex-mode 933 | "cc" 'bb-latex-build 934 | "cv" 'bb-latex-check-compilation 935 | "ie" 'LaTeX-environment)) 936 | 937 | 938 | ;;; Python and Co. 939 | 940 | (use-package bb-py-all-env 941 | :commands (bb-py-all-env-activate bb-py-all-env-deactivate bb-py-all-env-parse) 942 | :init 943 | (bb-mm-leader python-mode 944 | "va" 'bb-py-all-env-activate 945 | "vd" 'bb-py-all-env-deactivate)) 946 | 947 | (use-package conda 948 | :defer t 949 | :init 950 | (setq conda-anaconda-home 951 | (if (file-exists-p "~/source/miniconda3") 952 | (expand-file-name "~/source/miniconda3/") 953 | (when (file-exists-p "~/miniconda3") 954 | (expand-file-name "~/miniconda3")))) 955 | (add-hook 'conda-postactivate-hook 'lsp-restart-workspace) 956 | (add-hook 'conda-postdeactivate-hook 'lsp-restart-workspace) 957 | (add-hook 'conda-postactivate-hook 'doom-modeline-env-update-python) 958 | (add-hook 'conda-postdeactivate-hook 'doom-modeline-env-update-python)) 959 | 960 | (use-package lsp-python-ms 961 | :after python 962 | :init 963 | (setq lsp-python-ms-python-executable-cmd "python3") 964 | :config 965 | (bb-lsp-set-priority 'mspyls 1) 966 | (fset 'lsp-python-ms--begin-progress-callback (lambda (&rest args))) 967 | (fset 'lsp-python-ms--end-progress-callback (lambda (&rest args)))) 968 | 969 | (use-package lsp-pyright 970 | :after python 971 | :config 972 | (bb-lsp-set-priority 'pyright 2)) 973 | 974 | (use-package python 975 | :defer t 976 | :init 977 | (add-hook 'python-mode-hook 'lsp) 978 | (setq-default python-shell-interpreter "python3")) 979 | 980 | (use-package pyvenv 981 | :defer t 982 | :init 983 | (add-hook 'pyvenv-post-activate-hooks 'lsp-restart-workspace) 984 | (add-hook 'pyvenv-post-deactivate-hooks 'lsp-restart-workspace) 985 | (add-hook 'conda-postactivate-hook 'doom-modeline-env-update-python) 986 | (add-hook 'conda-postdeactivate-hook 'doom-modeline-env-update-python)) 987 | 988 | 989 | ;;; Programming languages and other major modes 990 | 991 | (use-package elisp-mode 992 | :defer t 993 | :init 994 | (bb-mm-leader emacs-lisp-mode 995 | "cs" 'eval-last-sexp 996 | "cf" 'eval-defun 997 | "cb" 'eval-buffer 998 | "l" 'hydra-structured-editing-lisp/body) 999 | (bb-company emacs-lisp-mode company-capf) 1000 | (add-hook 'emacs-lisp-mode-hook 'outline-minor-mode) 1001 | (bb-add-hook emacs-lisp-mode-hook 1002 | (push '("Package" "\\(^\\s-*(use-package +\\)\\(\\_<[^ ]+\\_>\\)" 2) imenu-generic-expression))) 1003 | 1004 | (use-package lisp-mode 1005 | :defer t 1006 | :init 1007 | (bb-mm-leader lisp-mode "l" 'hydra-structured-editing-lisp/body)) 1008 | 1009 | (use-package lua-mode 1010 | :defer t 1011 | :init 1012 | (setq lua-indent-level 2)) 1013 | 1014 | (use-package po-mode 1015 | :defer t 1016 | :config 1017 | (evil-set-initial-state 'po-mode 'motion) 1018 | (evil-bind-key 'motion po-mode-map "j" 'po-next-entry) 1019 | (evil-bind-key 'motion po-mode-map "k" 'po-previous-entry) 1020 | (evil-bind-key 'motion po-mode-map "e" 'po-edit-msgstr) 1021 | (evil-bind-key 'motion po-mode-map "u" 'po-undo) 1022 | (evil-bind-key 'motion po-mode-map "u" 'po-undo)) 1023 | 1024 | (use-package powershell-mode 1025 | :mode "\\.ps1\\'") 1026 | 1027 | (use-package rust-mode 1028 | :defer t 1029 | :init 1030 | (cond 1031 | ((bb-has-executable-p 'lsp-rust-analyzer) 1032 | (setq lsp-rust-server 'rust-analyzer) 1033 | (add-hook 'rust-mode-hook 'lsp)) 1034 | ((bb-has-executable-p 'lsp-rust-rls) 1035 | (setq lsp-rust-server 'rust-rls) 1036 | (add-hook 'rust-mode-hook 'lsp)))) 1037 | 1038 | (use-package text-mode 1039 | :hook (text-mode . bb-maybe-auto-fill-mode)) 1040 | 1041 | 1042 | ;;; Miscellaneous 1043 | 1044 | (use-package ace-link 1045 | :config 1046 | (ace-link-setup-default)) 1047 | 1048 | (use-package ace-window 1049 | :defer t 1050 | :init 1051 | (setq aw-keys '(?s ?d ?f ?g ?h ?j ?k ?l)) 1052 | (bb-leader ("jw" 'ace-window "goto window"))) 1053 | 1054 | (use-package avy 1055 | :defer t 1056 | :init 1057 | (bb-leader ("jl" 'avy-goto-line "goto line"))) 1058 | 1059 | (use-package expand-region 1060 | :defer t 1061 | :init 1062 | (bb-leader ("vv" 'er/expand-region "Run expand-region"))) 1063 | 1064 | (use-package hierarchy 1065 | :defer t 1066 | :config 1067 | (evil-set-initial-state 'hierarchy-tabulated-mode 'motion)) 1068 | 1069 | (use-package highlight-operators 1070 | :hook (prog-mode . highlight-operators-mode) 1071 | :init 1072 | (bb-advise-except-derived-modes highlight-operators-mode 1073 | lisp-mode scheme-mode emacs-lisp-mode python-mode) 1074 | :config 1075 | (set-face-attribute 'highlight-operators-face nil 1076 | :inherit 'font-lock-keyword-face)) 1077 | 1078 | (use-package highlight-numbers 1079 | :hook (prog-mode . highlight-numbers-mode)) 1080 | 1081 | (use-package hl-todo 1082 | :hook (prog-mode . hl-todo-mode)) 1083 | 1084 | (use-package lispy 1085 | :commands lispy-define-key 1086 | :diminish (lispy-mode . "L") 1087 | :hook ((lisp-mode scheme-mode emacs-lisp-mode) . lispy-mode) 1088 | :config 1089 | (lispy-define-key lispy-mode-map "o" 'lispy-different) 1090 | (lispy-define-key lispy-mode-map ">" 'lispy-slurp-or-barf-right) 1091 | (lispy-define-key lispy-mode-map "<" 'lispy-slurp-or-barf-left) 1092 | (define-key lispy-mode-map (kbd "C-j") 'lispy-split) 1093 | (define-key lispy-mode-map (kbd "M-j") 'lispy-newline-and-indent)) 1094 | 1095 | (use-package lispyville 1096 | :diminish lispyville-mode 1097 | :hook (lispy-mode . lispyville-mode)) 1098 | 1099 | (use-package macrostep 1100 | :defer t 1101 | :init 1102 | (bb-mm-leader emacs-lisp-mode "cm" 'hydra-macrostep/body)) 1103 | 1104 | (use-package page-break-lines 1105 | :diminish page-break-lines-mode 1106 | :config 1107 | (setq page-break-lines-modes '(prog-mode julia-mode-prog-mode)) 1108 | (global-page-break-lines-mode)) 1109 | 1110 | (use-package projectile 1111 | :diminish projectile-mode 1112 | :init 1113 | (bb-leader 1114 | ("ga" 'projectile-find-other-file "Find alternate project file") 1115 | ("pC" 'projectile-configure-project "Configure") 1116 | ("pc" 'projectile-compile-project "Compile") 1117 | ("pr" 'projectile-run-project "Run") 1118 | ("pt" 'projectile-test-project "Test")) 1119 | (put 'projectile-project-name 'safe-local-variable 'stringp) 1120 | :config 1121 | (projectile-mode) 1122 | (setq projectile-completion-system 'ivy) 1123 | (push '("C" . ("h")) projectile-other-file-alist)) 1124 | 1125 | (use-package rainbow-delimiters 1126 | :hook (prog-mode . rainbow-delimiters-mode)) 1127 | 1128 | (use-package smartparens 1129 | :commands (sp-delete-pair sp-local-pair) 1130 | :hook ((prog-mode LaTeX-mode) . smartparens-mode) 1131 | :diminish (smartparens-mode . "s") 1132 | :init 1133 | (setq sp-highlight-pair-overlay nil 1134 | sp-highlight-wrap-overlay nil 1135 | sp-highlight-wrap-tag-overlay nil) 1136 | (bb-leader ("ts" 'smartparens-mode "Toggle smartparens")) 1137 | :config 1138 | (bb-advise-except-derived-modes smartparens-mode 1139 | lisp-mode scheme-mode emacs-lisp-mode web-mode) 1140 | (sp-local-pair '(c-mode c++-mode) "'" nil :post-handlers '(:rem sp-escape-quotes-after-insert)) 1141 | (bb-apply-newline-indent (c-mode c++-mode lua-mode python-mode rust-mode) "{" "[" "(") 1142 | (bb-apply-newline-indent (css-mode scss-mode) "{") 1143 | (bb-apply-newline-indent (js-mode typescript-mode) "{") 1144 | ;; Workaround smartparens #963 1145 | ;; (push 'c-electric-brace sp--special-self-insert-commands) 1146 | ;; (push 'c-electric-paren sp--special-self-insert-commands) 1147 | ) 1148 | 1149 | (use-package smartparens-config 1150 | :after smartparens) 1151 | 1152 | (use-package typo 1153 | :diminish typo-mode 1154 | :hook (org-mode . typo-mode)) 1155 | 1156 | (use-package tree-sitter 1157 | :diminish (tree-sitter-mode . "T") 1158 | :hook ((c-mode 1159 | c++-mode 1160 | css-mode 1161 | js-mode 1162 | json-mode 1163 | julia-mode 1164 | python-mode 1165 | rust-mode 1166 | typescript-mode) 1167 | . tree-sitter-mode) 1168 | :init 1169 | (bb-leader ("tT" 'tree-sitter-mode "Toggle tree-sitter")) 1170 | :config 1171 | (require 'tree-sitter-langs)) 1172 | 1173 | (use-package undo-tree 1174 | :if (or (not (boundp 'evil-undo-provider)) 1175 | (eq 'undo-tree (bound-and-true-p evil-undo-provider))) 1176 | :diminish undo-tree-mode 1177 | :init 1178 | (setq undo-tree-enable-undo-in-region nil) 1179 | (bb-leader ("au" 'undo-tree-visualize "Show undo history")) 1180 | :config 1181 | (global-undo-tree-mode)) 1182 | 1183 | (use-package vterm 1184 | :commands (vterm) 1185 | :init 1186 | (evil-set-initial-state 'vterm-mode 'emacs) 1187 | (bb-add-hook vterm-mode-hook 1188 | (setq-local global-hl-line-mode nil) 1189 | (setq-local truncate-lines t)) 1190 | ;; Default value plus F12 1191 | (setq vterm-keymap-exceptions '("C-c" "C-x" "C-u" "C-g" "C-h" "M-x" "M-o" "C-v" "M-v" "C-y" "M-y" "")) 1192 | (global-set-key (kbd "") 'bb-vterm) 1193 | :config 1194 | (set-face-attribute 'vterm-color-black nil :background monokai-comments :foreground monokai-comments) 1195 | (set-face-attribute 'vterm-color-blue nil :background monokai-blue :foreground monokai-blue) 1196 | (set-face-attribute 'vterm-color-green nil :background monokai-green :foreground monokai-green) 1197 | (set-face-attribute 'vterm-color-red nil :background monokai-red :foreground monokai-red) 1198 | (set-face-attribute 'vterm-color-yellow nil :background monokai-yellow :foreground monokai-yellow) 1199 | (set-face-attribute 'vterm-color-magenta nil :background monokai-magenta :foreground monokai-magenta) 1200 | (set-face-attribute 'vterm-color-cyan nil :background monokai-cyan :foreground monokai-cyan)) 1201 | 1202 | (use-package wgrep 1203 | :init 1204 | (setq wgrep-auto-save-buffer t) 1205 | :config 1206 | (evil-define-key 'normal wgrep-mode-map (kbd "C-c C-c") 'wgrep-finish-edit)) 1207 | 1208 | (use-package which-key-posframe 1209 | :init 1210 | (setq which-key-posframe-poshandler 'posframe-poshandler-frame-bottom-center) 1211 | :config 1212 | (which-key-posframe-mode)) 1213 | 1214 | (use-package ws-butler 1215 | :diminish ws-butler-mode 1216 | :config 1217 | (ws-butler-global-mode)) 1218 | 1219 | (use-package yasnippet 1220 | :commands yas-reload-all 1221 | :hook ((prog-mode LaTeX-mode) . yas-minor-mode) 1222 | :diminish (yas-minor-mode . "y") 1223 | :init 1224 | (push 'company-yasnippet bb-company-global-backends) 1225 | (define-key evil-insert-state-map (kbd "C-SPC") 'yas-expand) 1226 | (bb-leader ("ty" 'yas-minor-mode "Toggle yasnippet")) 1227 | :config 1228 | (yas-reload-all)) 1229 | 1230 | 1231 | ;;; Load customizations, if any 1232 | 1233 | (load custom-file) 1234 | 1235 | 1236 | ;;; init.el ends here 1237 | -------------------------------------------------------------------------------- /lisp/bb-defs.el: -------------------------------------------------------------------------------- 1 | ;;; bb-defs.el --- Personal definitions. -*- lexical-binding: t -*- 2 | 3 | ;; Copyright (C) 2018 Eivind Fonn 4 | 5 | ;; This file is not part of GNU Emacs. 6 | 7 | ;;; License: 8 | 9 | ;; This file is free software; you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; This file is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this file. If not, see . 21 | 22 | ;;; Commentary: 23 | 24 | ;; Miscellaneous functions, macros and associated variables needed in 25 | ;; my Emacs init. 26 | 27 | ;;; Code: 28 | 29 | 30 | (eval-when-compile 31 | (require 'cl-lib) 32 | (require 'hydra) 33 | (require 'ivy) 34 | (require 'lsp) 35 | (require 'bb-macros)) 36 | 37 | (require 'ht) 38 | 39 | 40 | (declare-function ansi-color-apply-on-region "ansi-color") 41 | (declare-function bufler-group-tree-leaf-path "ext:bufler-group-tree") 42 | (declare-function bufler-buffers "ext:bufler") 43 | (declare-function bufler-buffer-alist-at "ext:bufler") 44 | (declare-function bufler-workspace-buffers "ext:bufler-workspace") 45 | (declare-function counsel-find-file-action "ext:counsel") 46 | (declare-function counsel-ibuffer--get-buffers "ext:counsel") 47 | (declare-function counsel-ibuffer-visit-buffer "ext:counsel") 48 | (declare-function counsel-projectile-action "ext:counsel-projectile") 49 | (declare-function hydra-default-pre "ext:hydra") 50 | (declare-function hydra-keyboard-quit "ext:hydra") 51 | (declare-function hydra-set-transient-map "ext:hydra") 52 | (declare-function hydra-show-hint "ext:hydra") 53 | (declare-function hydra--call-interactively-remap-maybe "ext:hydra") 54 | (declare-function evil-insert-newline-above "ext:evil-common") 55 | (declare-function evil-insert-newline-below "ext:evil-common") 56 | (declare-function evil-window-split "ext:evil-commands") 57 | (declare-function evil-window-vsplit "ext:evil-commands") 58 | (declare-function eyebrowse-create-window-config "ext:eyebrowse") 59 | (declare-function eyebrowse-switch-to-window-config "ext:eyebrowse") 60 | (declare-function eyebrowse-rename-window-config "ext:eyebrowse") 61 | (declare-function eyebrowse-next-window-config "ext:eyebrowse") 62 | (declare-function eyebrowse-prev-window-config "ext:eyebrowse") 63 | (declare-function eyebrowse--get "ext:eyebrowse") 64 | (declare-function ivy--get-window "ext:ivy") 65 | (declare-function ivy-posframe--display "ext:ivy-posframe") 66 | (declare-function macrostep-collapse "ext:macrostep") 67 | (declare-function macrostep-next-macro "ext:macrostep") 68 | (declare-function macrostep-prev-macro "ext:macrostep") 69 | (declare-function macrostep-collapse-all "ext:macrostep") 70 | (declare-function posframe-poshandler-frame-top-center "ext:posframe") 71 | (declare-function projectile-project-root "ext:projectile") 72 | (declare-function sp-wrap-with-pair "ext:smartparens") 73 | (declare-function sp-forward-barf-sexp "ext:smartparens") 74 | (declare-function sp-backward-barf-sexp "ext:smartparens") 75 | (declare-function sp-forward-slurp-sexp "ext:smartparens") 76 | (declare-function sp-backward-slurp-sexp "ext:smartparens") 77 | (declare-function sp-forward-sexp "ext:smartparens") 78 | (declare-function sp-backward-sexp "ext:smartparens") 79 | (declare-function sp-forward-symbol "ext:smartparens") 80 | (declare-function sp-backward-symbol "ext:smartparens") 81 | (declare-function sp-kill-sexp "ext:smartparens") 82 | (declare-function sp-kill-symbol "ext:smartparens") 83 | (declare-function sp-kill-word "ext:smartparens") 84 | (declare-function TeX-active-buffer "ext:tex-buf") 85 | (declare-function TeX-command-master "ext:tex-buf") 86 | (declare-function TeX-command "ext:tex-buf") 87 | (declare-function TeX-recenter-output-buffer "ext:tex-buf") 88 | (declare-function undo-tree-undo "ext:undo-tree") 89 | (declare-function vterm "ext:vterm") 90 | (declare-function winner-undo "winner") 91 | 92 | (defvar counsel-ibuffer--buffer-name) 93 | (defvar evil-shift-width) 94 | (defvar eyebrowse-new-workspace) 95 | 96 | 97 | ;;; Executables 98 | 99 | (defvar bb-executables 100 | '((lsp-cc-ccls 101 | (executable . "ccls") 102 | (version-cmd . "ccls --version") 103 | (version-regexp . "ccls version \\([0-9\\.]*\\)")) 104 | (lsp-cc-cquery 105 | (executable . "cquery")) 106 | (lsp-html 107 | (executable . "html-languageserver") 108 | (version-cmd . "npm list -g vscode-html-languageserver-bin") 109 | (version-regexp . "vscode-html-languageserver-bin@\\([0-9\\.]*\\)")) 110 | (lsp-julia 111 | (command . "julia -e 'using LanguageServer'") 112 | (version-cmd . "julia -e 'import Pkg; Pkg.status()'") 113 | (version-regexp . "LanguageServer v\\([0-9\\.+]*\\)")) 114 | (lsp-rust-rls 115 | (executable . "rls") 116 | (version-cmd . "rls --version") 117 | (version-regexp . "rls \\([0-9\\.]*\\)")) 118 | (lsp-rust-analyzer 119 | (executable . "rust-analyzer")))) 120 | 121 | (defun bb-check-executable (exec) 122 | (let ((entry (assq exec bb-executables))) 123 | (unless (assq 'found (cdr entry)) 124 | (let* ((executable (alist-get 'executable (cdr entry))) 125 | (command (alist-get 'command (cdr entry))) 126 | (version-cmd (alist-get 'version-cmd (cdr entry))) 127 | (version-regexp (alist-get 'version-regexp (cdr entry))) 128 | (found (or (and executable (executable-find executable)) 129 | (and command (= 0 (call-process-shell-command command))))) 130 | (version "?")) 131 | (when (and found version-cmd version-regexp) 132 | (let ((output (with-temp-buffer 133 | (call-process-shell-command version-cmd nil t) 134 | (buffer-string)))) 135 | (when (string-match version-regexp output) 136 | (setq version (match-string 1 output))))) 137 | (push `(found . ,found) (cdr entry)) 138 | (push `(version . ,version) (cdr entry)))) 139 | (cdr entry))) 140 | 141 | (defun bb-has-executable-p (exec) 142 | (alist-get 'found (bb-check-executable exec))) 143 | 144 | (defun bb-executable-version (exec) 145 | (alist-get 'version (bb-check-executable exec))) 146 | 147 | 148 | ;;; Buffer predicate function 149 | 150 | (defvar bb-useful-buffers-regexp nil 151 | "Regular expressions to determine if a buffer is useful.") 152 | 153 | (defvar bb-useless-buffers-regexp 154 | '("\\*Messages\\*" 155 | "\\*Help\\*") 156 | "Regular expressions to determine if a buffer is useless.") 157 | 158 | (defun bb-useful-buffer-p (buffer) 159 | "Determine if BUFFER is useful." 160 | (let ((name (buffer-name buffer))) 161 | (or (with-current-buffer buffer 162 | (derived-mode-p 'comint-mode)) 163 | (cl-loop for regexp in bb-useful-buffers-regexp 164 | thereis (string-match-p regexp name)) 165 | (cl-loop for regexp in bb-useless-buffers-regexp 166 | never (string-match-p regexp name))))) 167 | 168 | 169 | ;;; Evil-numbers 170 | 171 | (defhydra hydra-numbers () 172 | ("=" evil-numbers/inc-at-pt) 173 | ("+" evil-numbers/inc-at-pt) 174 | ("-" evil-numbers/dec-at-pt) 175 | ("_" evil-numbers/dec-at-pt)) 176 | 177 | 178 | ;;; Evil-unimpaired 179 | 180 | (defun bb-insert-line-above (count) 181 | "Insert COUNT lines above point." 182 | (interactive "p") 183 | (dotimes (_ count) (save-excursion (evil-insert-newline-above)))) 184 | 185 | (defun bb-insert-line-below (count) 186 | "Insert COUNT lines below point." 187 | (interactive "p") 188 | (dotimes (_ count) (save-excursion (evil-insert-newline-below)))) 189 | 190 | (defun bb-insert-spaces-before (count) 191 | "Insert COUNT spaces before point." 192 | (interactive "p") 193 | (dotimes (_ count) (insert " "))) 194 | 195 | (defun bb-insert-spaces-after (count) 196 | "Insert COUNT spaces after point." 197 | (interactive "p") 198 | (forward-char) 199 | (dotimes (_ count) (insert " ")) 200 | (backward-char (1+ count))) 201 | 202 | 203 | ;;; Evil other 204 | 205 | (defun bb-shift-left () 206 | (interactive) 207 | (call-interactively 'evil-shift-left) 208 | (execute-kbd-macro "gv")) 209 | 210 | (defun bb-shift-right () 211 | (interactive) 212 | (call-interactively 'evil-shift-right) 213 | (execute-kbd-macro "gv")) 214 | 215 | 216 | ;; Incremental fill paragraph (modified from @alphapapa) 217 | 218 | (defvar bb--flex-fill-paragraph-column nil) 219 | 220 | (bb-advise around fill-paragraph (&rest args) 221 | (let ((fill-column 222 | (setq bb--flex-fill-paragraph-column 223 | (if (equal last-command this-command) 224 | (+ 5 (or bb--flex-fill-paragraph-column fill-column)) 225 | fill-column)))) 226 | (apply orig-fn args) 227 | (message "Fill column: %s" fill-column))) 228 | 229 | 230 | ;;; Macrostep 231 | 232 | (defhydra hydra-macrostep (:foreign-keys run) 233 | ("e" macrostep-expand) 234 | ("c" macrostep-collapse) 235 | ("" macrostep-next-macro) 236 | ("" macrostep-prev-macro) 237 | ("q" macrostep-collapse-all :exit t)) 238 | 239 | 240 | ;;; Smartparens 241 | 242 | (defun bb-sp-pair-newline-and-indent (&rest _) 243 | "Create an empty line between two delimiters." 244 | (save-excursion 245 | (newline) 246 | (indent-according-to-mode)) 247 | (indent-according-to-mode)) 248 | 249 | (defmacro bb-apply-newline-indent (modes &rest pairs) 250 | "Apply newline and indent behaviour for all PAIRS in all MODES." 251 | `(progn 252 | ,@(cl-loop for pair in pairs 253 | collect `(sp-local-pair 254 | ',modes 255 | ,@(if (stringp pair) (list pair nil) pair) :post-handlers 256 | '(:add (bb-sp-pair-newline-and-indent "RET")))))) 257 | 258 | 259 | ;;; Structured editing 260 | 261 | (defun bb-wrap-paren () 262 | "Wrap the symbol under point with parentheses." 263 | (interactive) 264 | (sp-wrap-with-pair "(")) 265 | 266 | (defhydra hydra-structured-editing-lisp () 267 | ("u" undo-tree-undo) 268 | 269 | ("b" sp-forward-barf-sexp) 270 | ("B" sp-backward-barf-sexp) 271 | ("s" sp-forward-slurp-sexp) 272 | ("S" sp-backward-slurp-sexp) 273 | 274 | ("dd" sp-kill-sexp) 275 | ("ds" sp-kill-symbol) 276 | ("dw" sp-kill-word) 277 | 278 | ("w" bb-wrap-paren) 279 | 280 | ("h" sp-backward-symbol) 281 | ("" sp-backward-sexp) 282 | ("l" sp-forward-symbol) 283 | ("" sp-forward-sexp)) 284 | 285 | 286 | ;;; Window management 287 | 288 | (defun bb-shrink-window-horizontally (delta) 289 | "Shrink the current window horizontally by DELTA units." 290 | (interactive "p") 291 | (shrink-window delta 'horizontal)) 292 | 293 | (defun bb-shrink-window-vertically (delta) 294 | "Shrink the current window vertically by DELTA units." 295 | (interactive "p") 296 | (shrink-window delta nil)) 297 | 298 | (defun bb-enlarge-window-horizontally (delta) 299 | "Enlarge the current window horizontally by DELTA units." 300 | (interactive "p") 301 | (enlarge-window delta 'horizontal)) 302 | 303 | (defun bb-enlarge-window-vertically (delta) 304 | "Enlarge the current window vertically by DELTA units." 305 | (interactive "p") 306 | (enlarge-window delta nil)) 307 | 308 | (defhydra hydra-windows () 309 | ("e" ace-select-window :exit t) 310 | 311 | ("h" windmove-left :exit t) 312 | ("j" windmove-down :exit t) 313 | ("k" windmove-up :exit t) 314 | ("l" windmove-right :exit t) 315 | 316 | ("H" windmove-left) 317 | ("J" windmove-down) 318 | ("K" windmove-up) 319 | ("L" windmove-right) 320 | 321 | ("s" evil-window-split) 322 | ("v" evil-window-vsplit) 323 | ("d" delete-window) 324 | ("(" bb-shrink-window-horizontally) 325 | ("[" bb-shrink-window-vertically) 326 | (")" bb-enlarge-window-horizontally) 327 | ("]" bb-enlarge-window-vertically) 328 | ("u" winner-undo) 329 | ("=" balance-windows-area :exit t) 330 | 331 | ("n" eyebrowse-create-window-config :exit t) 332 | ("w" eyebrowse-switch-to-window-config :exit t) 333 | ("r" eyebrowse-rename-window-config :exit t) 334 | ("C-j" eyebrowse-next-window-config) 335 | ("C-k" eyebrowse-prev-window-config) 336 | 337 | ("q" nil :exit t)) 338 | 339 | 340 | ;;; VTerm 341 | 342 | (defvar bb--vterms (make-hash-table :test 'equal)) 343 | 344 | (defun bb--get-or-create-vterm () 345 | (let* ((root (or (projectile-project-root) "~/")) 346 | (buffer (ht-get bb--vterms root))) 347 | (when (and buffer (not (buffer-live-p buffer))) 348 | (ht-remove bb--vterms root) 349 | (setq buffer nil)) 350 | (if buffer 351 | (switch-to-buffer buffer) 352 | (require 'vterm) 353 | (let ((default-directory root)) 354 | (vterm)) 355 | (rename-buffer (format "vterm: ~/%s" (file-relative-name root (getenv "HOME")))) 356 | (ht-set bb--vterms root (current-buffer))))) 357 | 358 | (defun bb-vterm () 359 | "Pop or hide a vterm." 360 | (interactive) 361 | (if (derived-mode-p 'vterm-mode) 362 | (previous-buffer) 363 | (bb--get-or-create-vterm))) 364 | 365 | 366 | ;;; Evil shift width 367 | 368 | (defvar bb-indent-vars 369 | '((latex-mode . LaTeX-indent-level)) 370 | "Alist associating major modes to indent level variables.") 371 | 372 | (defun bb-set-evil-shift-width () 373 | (catch 'done 374 | (dolist (elt bb-indent-vars) 375 | (when (derived-mode-p (car elt)) 376 | (setq-local evil-shift-width (symbol-value (cdr elt))) 377 | (throw 'done nil))))) 378 | 379 | 380 | ;;; Counsel, projectile, eyebrowse and bufler 381 | 382 | (defvar bb-eyebrowse-plists 383 | (make-hash-table) 384 | "Hash table for storing extra data about eyebrowse workspaces.") 385 | 386 | (defun bb-eyebrowse-plist-get (key &optional slot) 387 | "Get a property for an eyebrowse workspace." 388 | (unless slot (setq slot (eyebrowse--get 'current-slot))) 389 | (plist-get (ht-get bb-eyebrowse-plists slot) key)) 390 | 391 | (defun bb-eyebrowse-plist-set (key val &optional slot) 392 | "Set a property for an eyebrowse workspace." 393 | (unless slot (setq slot (eyebrowse--get 'current-slot))) 394 | (ht-set bb-eyebrowse-plists slot 395 | (plist-put (ht-get bb-eyebrowse-plists slot) 396 | key val))) 397 | 398 | (defun bb-bufler-eyebrowse-pre-switch () 399 | "Before switching eyebrowse workspace, store the bufler path." 400 | (bb-eyebrowse-plist-set :bufler-path (frame-parameter nil 'bufler-workspace-path))) 401 | 402 | (defun bb-bufler-eyebrowse-post-switch () 403 | "After switching eyebrowse workspace, restore the bufler path." 404 | (bufler-workspace-frame-set (bb-eyebrowse-plist-get :bufler-path))) 405 | 406 | (defun bb-bufler-workspace-frame-set-hook (path) 407 | "When the bufler path changes, set an eyebrowse workspace name." 408 | (when-let* ((project 409 | (catch 'done 410 | (dolist (entry (reverse path)) 411 | (save-match-data 412 | (when (and (stringp entry) 413 | (or (string-match "\\`Projectile: \\(.*\\)\\'" entry) 414 | (string-match "\\`Dir: \\(.*\\)\\'" entry))) 415 | (throw 'done (match-string 1 entry)))))))) 416 | (eyebrowse-rename-window-config (eyebrowse--get 'current-slot) project))) 417 | 418 | (defun bb-bufler-workspace-frame-set () 419 | "Set a bufler path based on best guess principles." 420 | (bufler-workspace-frame-set 421 | (butlast (bufler-group-tree-leaf-path (bufler-buffers) (current-buffer))))) 422 | 423 | (defun bb-counsel-find-file-new-workspace-action (arg) 424 | "Action for `counsel-find-file' to open in a new workspace." 425 | (let ((eyebrowse-new-workspace t)) 426 | (eyebrowse-create-window-config) 427 | (with-current-buffer (counsel-find-file-action arg) 428 | (bb-bufler-workspace-frame-set)))) 429 | 430 | (defun bb-counsel-projectile-new-workspace-action (arg) 431 | "Action for `counsel-projectile' to open in a new workspace." 432 | (let ((eyebrowse-new-workspace t) 433 | (prev-default-directory default-directory)) 434 | (eyebrowse-create-window-config) 435 | (let ((default-directory prev-default-directory)) 436 | (counsel-projectile-action arg)) 437 | (bb-bufler-workspace-frame-set))) 438 | 439 | (defun bb-counsel-recentf-new-workspace-action (arg) 440 | "Action for `counsel-recentf' to open in a new workspace." 441 | (let ((eyebrowse-new-workspace t)) 442 | (eyebrowse-create-window-config) 443 | (with-current-buffer 444 | (with-ivy-window 445 | (find-file arg)) 446 | (bb-bufler-workspace-frame-set)))) 447 | 448 | (defun bb-filter-bufler-workspace (candidates) 449 | "Filter candidates for `counsel-ibuffer' according to 450 | `bufler-workspace-buffers'." 451 | (let ((active-buffers (bufler-workspace-buffers))) 452 | (cl-remove-if (lambda (c) (not (member (cdr c) active-buffers))) candidates))) 453 | 454 | (defun bb-counsel-ibuffer (&optional all-p name) 455 | (interactive "P") 456 | (require 'counsel) 457 | (setq counsel-ibuffer--buffer-name (or name "*Ibuffer*")) 458 | (let ((candidates (if (or all-p (not (frame-parameter nil 'bufler-workspace-path))) 459 | (bufler-buffer-alist-at nil) 460 | (bb-filter-bufler-workspace (counsel-ibuffer--get-buffers))))) 461 | (ivy-read "Switch to buffer: " candidates 462 | :history 'counsel-ibuffer-history 463 | :action 'counsel-ibuffer-visit-buffer 464 | :caller 'counsel-ibuffer))) 465 | 466 | ;;; Miscellaneous 467 | 468 | (defun bb-alternate-buffer () 469 | "Switch to the previous buffer displayed in the current window." 470 | (interactive) 471 | (let ((buf (window-buffer))) 472 | (switch-to-buffer 473 | (cl-find-if (lambda (b) (not (eq b buf))) 474 | (mapcar 'car (window-prev-buffers)))))) 475 | 476 | (defun bb-dimmer-predicate () 477 | (string-prefix-p " *company-box-" (buffer-name))) 478 | 479 | (defun bb-find-init () 480 | "Open `user-init-file'." 481 | (interactive) 482 | (find-file user-init-file)) 483 | 484 | (defun bb-find-scratch () 485 | "Open the scratch buffer." 486 | (interactive) 487 | (switch-to-buffer "*scratch*")) 488 | 489 | (defun bb-kill-buffer () 490 | "Kill the current buffer." 491 | (interactive) 492 | (kill-buffer nil)) 493 | 494 | (defun bb-kill-buffer-file () 495 | "Kill the current buffer and delete its associated file, if any." 496 | (interactive) 497 | (let ((filename (buffer-file-name)) 498 | (buffer (current-buffer))) 499 | (if (not (and filename (file-exists-p filename))) 500 | (kill-buffer buffer) 501 | (when (y-or-n-p "Are you sure you want to delete this file? ") 502 | (delete-file filename 'trash) 503 | (kill-buffer buffer))))) 504 | 505 | (defun bb-lsp-set-priority (server priority) 506 | (setf (lsp--client-priority (gethash server lsp-clients)) priority)) 507 | 508 | (defun bb-lsp-priority (server) 509 | (lsp--client-priority (gethash server lsp-clients))) 510 | 511 | (defun bb-show-and-copy-filename () 512 | "Show and copy the full path to the current file in the minibuffer." 513 | (interactive) 514 | (let ((file-name (or (buffer-file-name) list-buffers-directory))) 515 | (when file-name 516 | (message (kill-new file-name))))) 517 | 518 | (defun bb-latex-build (arg) 519 | "Build the document with latexmk. 520 | If ARG is given, query for a command." 521 | (interactive "P") 522 | (if arg 523 | (TeX-command-master) 524 | (TeX-command "LatexMk" 'TeX-master-file nil))) 525 | 526 | (defun bb-latex-check-compilation () 527 | "View the output buffer if compiling. 528 | If done compiling, kill the auxiliary buffer." 529 | (interactive) 530 | (cond 531 | (compilation-in-progress (TeX-recenter-output-buffer nil)) 532 | (t (-when-let* ((buf (TeX-active-buffer))) 533 | (kill-buffer buf))))) 534 | 535 | (defun bb-toggle-debug-on-error () 536 | "Toggle the value of `debug-on-error'." 537 | (interactive) 538 | (setq debug-on-error (not debug-on-error)) 539 | (message "Debug on error now: %S" debug-on-error)) 540 | 541 | (defun bb-maybe-auto-fill-mode () 542 | "Enable auto-fill mode except in certain major modes." 543 | (unless (derived-mode-p 'forge-post-mode) 544 | (auto-fill-mode))) 545 | 546 | (defun bb-compilation-filter () 547 | "Filter and apply ANSI sequences in compilation output." 548 | (read-only-mode 'toggle) 549 | (ansi-color-apply-on-region compilation-filter-start (point)) 550 | (read-only-mode 'toggle) 551 | ) 552 | 553 | (defun bb-ivy-posframe-display-frame-top-center (str) 554 | (ivy-posframe--display str #'posframe-poshandler-frame-top-center)) 555 | 556 | (provide 'bb-defs) 557 | 558 | ;;; bb-defs.el ends here 559 | -------------------------------------------------------------------------------- /lisp/bb-erc.el: -------------------------------------------------------------------------------- 1 | ;;; bb-erc.el --- Personal ERC functions. -*- lexical-binding: t -*- 2 | 3 | ;; Copyright (C) 2018 Eivind Fonn 4 | 5 | ;; This file is not part of GNU Emacs. 6 | 7 | ;;; License: 8 | 9 | ;; This file is free software; you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; This file is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this file. If not, see . 21 | 22 | ;;; Commentary: 23 | 24 | ;; Miscellaneous functions needed for ERC in my Emacs init. 25 | 26 | ;;; Code: 27 | 28 | (require 'erc) 29 | 30 | (defvar bb-znc-pwd nil) 31 | 32 | (defun bb-erc () 33 | "Start `erc'." 34 | (interactive) 35 | (if bb-znc-pwd 36 | (erc :server "efonn.no" 37 | :port 1025 38 | :nick "TheBB" 39 | :password (format "TheBB/freenode:%s" bb-znc-pwd)) 40 | (user-error "Missing ZNC password"))) 41 | 42 | (provide 'bb-erc) 43 | 44 | ;;; bb-erc.el ends here 45 | -------------------------------------------------------------------------------- /lisp/bb-macros.el: -------------------------------------------------------------------------------- 1 | ;;; bb-macros.el --- Macro definitions. -*- lexical-binding: t -*- 2 | 3 | ;; Copyright (C) 2018 Eivind Fonn 4 | 5 | ;; This file is not part of GNU Emacs. 6 | 7 | ;;; License: 8 | 9 | ;; This file is free software; you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; This file is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this file. If not, see . 21 | 22 | ;;; Commentary: 23 | 24 | ;; Miscellaneous macros needed in my Emacs init. 25 | 26 | ;;; Code: 27 | 28 | (require 'hierarchy) 29 | (require 'seq) 30 | 31 | 32 | ;;; Postpone code until after display is initialized 33 | 34 | (defvar bb--after-display-functions nil 35 | "List of functions to be run (in reverse order) after the 36 | display system is initialized.") 37 | 38 | (defun bb--server-create-window-system-frame (&rest _) 39 | (dolist (func (reverse bb--after-display-functions)) 40 | (funcall func)) 41 | (advice-remove 'server-create-window-system-frame 'bb--server-create-window-system-frame)) 42 | (advice-add 'server-create-window-system-frame :after 'bb--server-create-window-system-frame) 43 | 44 | (defmacro bb-after-display (&rest body) 45 | "Run BODY after the display system is initialized." 46 | (declare (indent 0)) 47 | `(let ((initializedp (cond ((boundp 'ns-initialized) ns-initialized) 48 | ((boundp 'w32-initialized) (font-family-list)) 49 | ((boundp 'x-initialized) x-initialized) 50 | (t (display-graphic-p))))) 51 | (if initializedp 52 | (progn ,@body) 53 | (push (lambda () ,@body) bb--after-display-functions)))) 54 | 55 | 56 | ;;; Convenience macro for hooks 57 | 58 | (defmacro bb-add-hook (hook &rest body) 59 | "Run BODY in HOOK." 60 | (declare (indent 1)) 61 | (let ((funcname (intern (format "bb-hook--%s" hook)))) 62 | `(progn 63 | (defun ,funcname () ,@body) 64 | (add-hook ',hook ',funcname)))) 65 | 66 | 67 | ;;; Convenience macro for advice 68 | 69 | (defmacro bb-advise (type func arglist &rest body) 70 | (declare (indent 3)) 71 | (unless arglist 72 | (setq arglist '(&rest _args))) 73 | (when (eq 'around type) 74 | (push 'orig-fn arglist)) 75 | (let ((funcname (intern (format "bb-advise--%s--%s" func type))) 76 | (type (intern (format ":%s" type)))) 77 | `(progn 78 | (defun ,funcname ,arglist 79 | ,@(when (memq 'orig-fn arglist) '((ignore orig-fn))) 80 | ,@body) 81 | (advice-add ',func ,type ',funcname)))) 82 | 83 | (defmacro bb-advise-only-in-modes (func &rest modes) 84 | "Advice FUNC only to run when `major-mode' is exactly any of MODES." 85 | (declare (indent 1)) 86 | (let ((funcname 87 | (intern (format "bb--only-in-modes-%s" (mapconcat 'symbol-name modes "-or-"))))) 88 | `(progn 89 | (defun ,funcname (orig-fn &rest args) 90 | (when (or ,@(cl-loop for mode in modes collect `(eq major-mode ',mode))) 91 | (apply orig-fn args))) 92 | (advice-add ',func :around ',funcname)))) 93 | 94 | (defmacro bb-advise-except-derived-modes (func &rest modes) 95 | "Advice FUNC only to run when `major-mode' is derived from any of MODES." 96 | (declare (indent 1)) 97 | (let ((funcname 98 | (intern (format "bb--except-derived-modes-%s" (mapconcat 'symbol-name modes "-or-"))))) 99 | `(progn 100 | (defun ,funcname (orig-fn &rest args) 101 | (unless (derived-mode-p ,@(cl-loop for mode in modes collect `(quote ,mode))) 102 | (apply orig-fn args))) 103 | (advice-add ',func :around ',funcname)))) 104 | 105 | 106 | ;;; Convenience functions for leader bindings 107 | 108 | (declare-function 'general-define-key "general") 109 | 110 | (defmacro bb-leader (&rest args) 111 | "Bind ARGS as leader bindings." 112 | (declare (indent 0)) 113 | `(progn 114 | (require 'general) 115 | ,@(cl-loop for (key func doc) in args 116 | collect 117 | `(progn 118 | (when ,doc 119 | (which-key-add-key-based-replacements ,(concat "SPC " key) ,doc)) 120 | (general-define-key :prefix "SPC" :states '(normal motion) :keymaps 'override ,key ,func))))) 121 | 122 | (defun bb--get-dispatch (table mode) 123 | "Find a dispatch function in TABLE according to MODE." 124 | (cl-loop for entry in table 125 | if (provided-mode-derived-p mode (car entry)) 126 | return (cdr entry))) 127 | 128 | (defmacro bb-create-dispatch (keys) 129 | "Generate a major mode dispatch system for KEYS." 130 | (let ((funcname (intern (format "bb-dispatch-%s" keys))) 131 | (varname (intern (format "bb-dispatch-table-%s" keys)))) 132 | `(progn 133 | (unless (boundp ',varname) 134 | (defvar ,varname nil) 135 | (defun ,funcname () 136 | (interactive) 137 | (if-let ((dispatch (bb--get-dispatch ,varname major-mode))) 138 | (call-interactively dispatch) 139 | (user-error "No dispatch found for \"%s\" in %s" ,keys major-mode))) 140 | ;; (bb-assign-leader ,keys ',varname nil) 141 | (bb-leader (,keys ',funcname)))))) 142 | 143 | (defmacro bb-mm-leader (mode &rest args) 144 | "Bind ARGS in MODE as leader bindings." 145 | (declare (indent 1)) 146 | (let (bindings) 147 | (while args 148 | (push (cons (car args) (cadr args)) bindings) 149 | (setq args (cddr args))) 150 | `(progn 151 | ,@(cl-loop for binding in bindings 152 | collect `(bb-create-dispatch ,(car binding))) 153 | ,@(cl-loop for binding in bindings 154 | collect `(push (cons ',mode ,(cdr binding)) 155 | ,(intern (format "bb-dispatch-table-%s" (car binding)))))))) 156 | 157 | 158 | ;;; Company 159 | 160 | (defvar bb-company-global-backends nil 161 | "List of backends to enable everywhere.") 162 | 163 | (defmacro bb-company (mode &rest backends) 164 | "Run `company-mode' in MODE with BACKENDS." 165 | (declare (indent 1)) 166 | (let ((funcname (intern (format "bb-company-%s" mode))) 167 | (hookname (intern (format "%s-hook" mode)))) 168 | `(progn 169 | (defun ,funcname () 170 | (company-mode) 171 | (setq-local company-backends 172 | (list (append ',backends bb-company-global-backends)))) 173 | (add-hook ',hookname ',funcname)))) 174 | 175 | 176 | ;;; Miscellaneous 177 | 178 | (defmacro bb-popwin (mode &rest args) 179 | "Push (MODE ARGS...) to `popwin:special-display-config'." 180 | `(push '(,mode ,@args) popwin:special-display-config)) 181 | 182 | 183 | (provide 'bb-macros) 184 | 185 | ;;; bb-macros.el ends here 186 | -------------------------------------------------------------------------------- /lisp/bb-py-all-env.el: -------------------------------------------------------------------------------- 1 | ;;; bb-defs.el --- Code for switching between any kind of Python environment. -*- lexical-binding: t -*- 2 | 3 | ;; Copyright (C) 2018 Eivind Fonn 4 | 5 | ;; This file is not part of GNU Emacs. 6 | 7 | ;;; License: 8 | 9 | ;; This file is free software; you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; This file is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this file. If not, see . 21 | 22 | ;;; Commentary: 23 | 24 | ;; Wraps pyvenv and conda in one sweet package. 25 | 26 | ;;; Code: 27 | 28 | (require 'pyvenv nil t) 29 | (require 'conda nil t) 30 | 31 | (declare-function pyenv-mode-version "ext:pyenv-mode") 32 | 33 | (defmacro bb-py-all-env-annotate (name func list) 34 | (declare (indent 2)) 35 | `(mapcar (lambda (c) 36 | (cons (format "(%s) %s" ',name c) 37 | (list ',func c))) 38 | ,list)) 39 | 40 | (defun bb-py-all-env-list () 41 | (append 42 | (bb-py-all-env-annotate pyvenv pyvenv-workon 43 | (and (fboundp 'pyvenv-virtualenv-list) (pyvenv-virtualenv-list 'noerror))) 44 | (bb-py-all-env-annotate conda conda-env-activate 45 | (and (fboundp 'conda-env-candidates) (conda-env-candidates))))) 46 | 47 | (defun bb-py-all-env-activate () 48 | (interactive) 49 | (let* ((candidates (bb-py-all-env-list)) 50 | (env (completing-read "Environment: " candidates nil t))) 51 | (eval (cdr (assoc env candidates))))) 52 | 53 | (defun bb-py-all-env-deactivate () 54 | (interactive) 55 | (cond 56 | ((bound-and-true-p pyvenv-virtual-env-name) 57 | (pyvenv-deactivate)) 58 | ((bound-and-true-p conda-env-current-name) 59 | (conda-env-deactivate)))) 60 | 61 | (defun bb-py-all-env-parse (line) 62 | "Return version and venv info. 63 | Useful as parsing function for `doom-modeline-env'." 64 | (let (name source (version (cadr (split-string line)))) 65 | (cond 66 | ((bound-and-true-p pyvenv-virtual-env-name) 67 | (setq name pyvenv-virtual-env-name source "pyvenv")) 68 | ((bound-and-true-p conda-env-current-name) 69 | (setq name conda-env-current-name source "conda")) 70 | ((and (fboundp 'pyenv-mode) (setq name (pyenv-mode-version))) 71 | (setq source "pyenv"))) 72 | (if name 73 | (format "%s %s" version 74 | (propertize name 'help-echo (format "Virtual environment (via %s)" source))) 75 | version))) 76 | 77 | 78 | (provide 'bb-py-all-env) 79 | 80 | ;;; bb-py-all-env.el ends here 81 | -------------------------------------------------------------------------------- /lisp/bb-segments.el: -------------------------------------------------------------------------------- 1 | ;;; bb-segments.el --- Modeline segments. -*- lexical-binding: t -*- 2 | 3 | ;; Copyright (C) 2018 Eivind Fonn 4 | 5 | ;; This file is not part of GNU Emacs. 6 | 7 | ;;; License: 8 | 9 | ;; This file is free software; you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; This file is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this file. If not, see . 21 | 22 | ;;; Commentary: 23 | 24 | ;; General init of Emacs. 25 | 26 | ;;; Code: 27 | 28 | (require 'doom-modeline-core) 29 | (require 'doom-modeline-segments) 30 | 31 | 32 | (doom-modeline-def-segment workspace-name 33 | "The current workspace name or number. 34 | Requires `eyebrowse-mode' to be enabled." 35 | (if (and (bound-and-true-p eyebrowse-mode) 36 | (< 1 (length (eyebrowse--get 'window-configs)))) 37 | (let* ((num (eyebrowse--get 'current-slot)) 38 | (tag (when num (nth 2 (assoc num (eyebrowse--get 'window-configs))))) 39 | (str (if (and tag (< 0 (length tag))) 40 | (format "%d·%s" num tag) 41 | (when num (int-to-string num))))) 42 | (assq-delete-all 'eyebrowse-mode mode-line-misc-info) 43 | (propertize (format " %s " str) 'face 44 | (if (doom-modeline--active) 45 | 'doom-modeline-buffer-major-mode 46 | 'mode-line-inactive))))) 47 | 48 | (provide 'bb-segments) 49 | 50 | ;;; bb-segments.el ends here 51 | --------------------------------------------------------------------------------