├── .gitignore ├── LICENSE ├── README.org ├── custom.el ├── docs ├── contributing.org ├── dependencies.org ├── emacsfromsource.org ├── emacsonwin.org └── setupemail.org ├── early-init.el ├── exwm ├── README.md ├── Xmodmap ├── desktop.el ├── dunstrc ├── exwm-apps.el ├── exwm-debug.desktop ├── exwm.desktop ├── picom.conf ├── start-exwm-debug.sh └── start-exwm.sh ├── img ├── gnu.png ├── gnusstorm-2.gif └── spacemacs-logo.png ├── init.el ├── lisp ├── base.el ├── cgpt.el ├── copilot.el ├── functions.el ├── gpt.el ├── jira.el ├── keybinds.el ├── languages.el ├── mail.el └── packages.el ├── modules ├── archive │ ├── acme.org │ ├── b.org │ ├── catppuccin.org │ ├── doom.org │ ├── gantt.org │ ├── gruber.org │ ├── honeydew.org │ ├── leuven.org │ ├── mpv.org │ ├── naysayer.org │ ├── org-hyper.org │ ├── pulsar.org │ ├── scrollbar.el │ ├── spacemacs.org │ ├── standard.org │ ├── sweet.org │ ├── tarps.org │ ├── undofu.org │ └── zenburn.org ├── discord.org ├── evil.org ├── mail.org └── reddit.org └── themes ├── lensor-min-theme.el └── lensor-theme.el /.gitignore: -------------------------------------------------------------------------------- 1 | # ignore all by default 2 | /* 3 | 4 | # do not ignore (whitelist) 5 | !bin/* 6 | !docs/* 7 | !img/* 8 | !modules/* 9 | !resources/* 10 | !snippets/* 11 | 12 | !straight/versions/default.el 13 | 14 | !.gitignore 15 | 16 | !LICENSE 17 | !README.org 18 | 19 | !config.org 20 | globals.org 21 | 22 | !bin/tangle.sh 23 | 24 | !modules/*.org 25 | 26 | # ignore userconfig.org 27 | userconfig.org 28 | 29 | # emacs state files 30 | places 31 | recentf 32 | history 33 | 34 | # straight.el related 35 | straight/build-cache.el 36 | straight/build/ 37 | straight/repos/ 38 | transient/ 39 | 40 | # tangled files 41 | early-init.el 42 | init.el 43 | globals.el 44 | config.el 45 | userconfig.el 46 | custom.el 47 | 48 | # tangled modules 49 | modules/discord.el 50 | modules/evil.el 51 | modules/mail.el 52 | modules/reddit.el 53 | /modules/private 54 | 55 | # emacs generated misc 56 | .cache/ 57 | auto-save-list/ 58 | eln-cache/ 59 | emacs.html 60 | forge-database.sqlite 61 | network-security.data 62 | 63 | # misc 64 | .DS_Store 65 | *~ 66 | *.*~ 67 | \#* 68 | .\#* 69 | .local/ 70 | .extension/ 71 | *.cache* 72 | *.log 73 | test/.local*/ 74 | test/result 75 | 76 | # emacs tempfiles that shouldn't be there 77 | .dap-breakpoints 78 | .org-id-locations 79 | .tern-port 80 | .yas-compiled-snippets.el 81 | cask/ 82 | ede-projects.el 83 | elpa/ 84 | places 85 | semanticdb 86 | server/ 87 | smex-items 88 | tramp 89 | var/ 90 | 91 | # compiled files 92 | *.elc 93 | *.lib 94 | *.fas 95 | *.dat 96 | *.eld -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2022 Diamond Bond 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Diamond's Emacs 2 | #+AUTHOR: index 3 | #+EMAIL: diamondbond1@gmail.com 4 | #+LANGUAGE: en 5 | #+CREATOR: Emacs 28.1 (Org mode 9.5.3) 6 | #+OPTIONS: toc:2 7 | 8 | * Installation 9 | 10 | [[https://github.com/DiamondBond/emacs/blob/master/docs/emacsfromsource.org][Emacs build instructions]]. 11 | 12 | Clone this repo: 13 | 14 | #+begin_src sh 15 | $ git clone https://github.com/diamondbond/emacs.git ~/.emacs.d --depth 1 16 | #+end_src 17 | 18 | ** Icons 19 | 20 | Install the fonts provided by [[https://github.com/domtronn/all-the-icons.el][all the icons]]: 21 | 22 | #+begin_src emacs-lisp 23 | M-x all-the-icons-install-fonts 24 | #+end_src 25 | 26 | If you are using Windows then [[https://github.com/domtronn/all-the-icons.el/archive/refs/heads/master.zip][Download]] all-the-icons fonts & extract to C:\Windows\Fonts 27 | 28 | ** LSP 29 | 30 | Most IDE-like features are provided by the [[https://github.com/emacs-lsp/lsp-mode][LSP]] package. For it to work properly, you need to install the appropriate [[https://github.com/emacs-lsp/lsp-mode#supported-languages][language servers]] although Emacs will prompt you to install them automatically upon encountering a file for that language. 31 | 32 | ** Dependencies 33 | 34 | Refer to the [[https://github.com/DiamondBond/emacs/blob/master/docs/dependencies.org][Dependencies documentation]]. 35 | 36 | If you are on Windows then refer to the *WIP* [[https://github.com/DiamondBond/emacs/blob/master/docs/emacsonwin.org][Windows Dependencies documentation]]. 37 | 38 | * Thanks 39 | 40 | Nicolas Rougier - CSS 41 | 42 | Xah Lee - wolfram-mode & math-input-mode 43 | 44 | wereket - testing 45 | -------------------------------------------------------------------------------- /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 | '(ispell-alternate-dictionary "/usr/bin/ispell") 7 | '(org-file-apps 8 | '((auto-mode . emacs) (directory . emacs) ("\\.mm\\'" . default) 9 | ("\\.x?html?\\'" . default) ("\\.pdf\\'" . emacs))) 10 | '(warning-suppress-log-types '(((use-package) (browse-url) (comp))))) 11 | (custom-set-faces 12 | ;; custom-set-faces was added by Custom. 13 | ;; If you edit it by hand, you could mess it up, so be careful. 14 | ;; Your init file should contain only one such instance. 15 | ;; If there is more than one, they won't work right. 16 | '(js2-error ((t (:foreground unspecified :weight normal)))) 17 | '(minimap-active-region-background ((((background dark)) (:background "#151515151515")) (t (:background "#d9d9d9d9d9d9"))) nil :group)) 18 | -------------------------------------------------------------------------------- /docs/contributing.org: -------------------------------------------------------------------------------- 1 | * Contributing documentation 2 | 3 | The documentation provided here is written in Org mode files. The 4 | primary file is the =config.org= file. 5 | 6 | To export the org file to an info file, run the following command: 7 | =M-x org-texinfo-export-to-info RET=. To use the org export 8 | interface to reach this function, make sure to first run: 9 | 10 | #+begin_src emacs-lisp 11 | (require 'ox-texinfo) 12 | #+end_src 13 | 14 | Then you can use =C-c C-e i= to export to info. 15 | 16 | * Documenting a module 17 | 18 | Add an Org file named for the module. Once you are ready to include 19 | it in the =config.org= file, add it to the modules section 20 | following the pattern provided there, here is an example: 21 | 22 | #+begin_example 23 | ,#+include: module1.org 24 | #+end_example 25 | 26 | Once you have added the module documentation, export the info file 27 | and submit a PR for inclusion. 28 | 29 | * Guidelines 30 | 31 | + Make sure your grammar is correct. 32 | + Spellcheck your work. 33 | + Preview the info document in Emacs to make sure the formatting 34 | works. 35 | + Use =@@texinfo:@code{}@@= or =@@texinfo:@samp{}@@= tags in 36 | headers, captions, or other places where org formatting does not 37 | directly translate correctly. 38 | + Provide examples. 39 | -------------------------------------------------------------------------------- /docs/dependencies.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Dependencies 2 | #+LANGUAGE: en 3 | #+OPTIONS: num:nil toc:2 4 | #+SETUPFILE: resources/white.theme 5 | #+EXPORT_FILE_NAME: emacs.html 6 | 7 | Declarative dependency listing for this Emacs configuration [WIP]. 8 | 9 | * Packages 10 | 11 | ** System 12 | 13 | #+begin_quote 14 | gcc make 15 | cmake ninja meson 16 | autoreconf 17 | offlineimap 18 | fzf ripgrep ag 19 | clang clangd llvm 20 | texlive-core texlive-bin texlive-science (ubuntu: texlive-latex-recommended) 21 | imagemagick 22 | editorconfig 23 | libjansson 24 | rust-all cargo 25 | nodejs npm 26 | libxml2 27 | gopls 28 | gnuplot 29 | prettier 30 | hunspell 31 | aspell 32 | python 33 | java 34 | jupyter-notebook 35 | wolframengine wolframscript 36 | wolframlanguageforjupyter 37 | mit-scheme 38 | chez-scheme 39 | sbcl quicklisp 40 | mpv 41 | wordnet 42 | direnv 43 | astyle 44 | #+end_quote 45 | 46 | ** Python 47 | 48 | LSP handles the python language server. 49 | 50 | Some useful python packages: 51 | 52 | #+begin_src sh 53 | pip3 install pyflakes isort nose pytest pygifsicle nose2 httpserver future pandas numpy matplotlib python-rofi jupyter grip git-lines-graph black epc orjson sexpdata six 54 | pip install 'python-lsp-server[all]' 55 | 56 | # for chatgpt.el 57 | pip install epc rich playwright 58 | pip install git+https://github.com/mmabrouk/chatgpt-wrapper 59 | playwright install 60 | chatgpt install 61 | #+end_src 62 | 63 | ** NodeJS 64 | 65 | Deno & typescript-language-server as well as prettier for Typescript (TS/TSX) support. 66 | 67 | #+begin_src sh 68 | sudo npm install -g deno typescript-language-server bash-language-server prettier 69 | #+end_src 70 | 71 | ** Quicklisp 72 | https://lisp-lang.org/learn/getting-started 73 | 74 | ARCH: `pacman -S sbcl quicklisp` 75 | UBUNTU: `sudo apt install sbcl` 76 | 77 | ** Upstream 78 | #+begin_src sh 79 | $ curl -o /tmp/ql.lisp http://beta.quicklisp.org/quicklisp.lisp 80 | $ sbcl --no-sysinit --no-userinit --load /tmp/ql.lisp \ 81 | --eval '(quicklisp-quickstart:install :path "~/.quicklisp")' \ 82 | --eval '(ql:add-to-init-file)' \ 83 | --quit 84 | #+end_src 85 | 86 | ** Mu for mu4e 87 | Will be autoinstalled by straight.el to =~/.emacs.d/straight/repos/mu/build/mu=. 88 | 89 | * Files 90 | 91 | ** Userconfig 92 | 93 | #+begin_quote 94 | ~/.emacs.d/userconfig.org 95 | 96 | ~/.emacs.d/globals.org 97 | 98 | ~/.emacs.d/custom.el 99 | #+end_quote 100 | 101 | ** Auth Files 102 | 103 | #+begin_quote 104 | ~/.authinfo.gpg 105 | 106 | ~/.secrets.el.gpg 107 | 108 | ~/.emacs.d/network-security.data 109 | #+end_quote 110 | 111 | ** Sync Folders 112 | 113 | Symlink ~/org & ~/pdf to their respective subdirs within ~/Dropbox. 114 | 115 | #+begin_src sh 116 | mkdir -p ~/Dropbox/{org,pdfs}; ln -s ~/Dropbox/org ~/org; ln -s ~/Dropbox/pdfs ~/pdfs 117 | #+end_src 118 | -------------------------------------------------------------------------------- /docs/emacsfromsource.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Emacs From Source 2 | #+AUTHOR: Diamond Bond 3 | #+EMAIL: diamondbond1@gmail.com 4 | #+LANGUAGE: en 5 | #+CREATOR: Emacs 28.1 (Org mode 9.5.3) 6 | #+STARTUP: inlineimages show2levels 7 | #+SETUPFILE: resources/white.theme 8 | #+EXPORT_FILE_NAME: efs.html 9 | #+OPTIONS: num:nil toc:nil 10 | 11 | * How to compile and install Emacs 12 | 13 | ** Grabbing sources 14 | 15 | Clone the latest Emacs@HEAD sources: 16 | 17 | #+begin_src sh 18 | 19 | cd ~/git 20 | git clone -b master git://git.sv.gnu.org/emacs.git --depth 1 21 | 22 | #+end_src 23 | 24 | Or alternatively download the [[https://www.gnu.org/software/emacs/download.html][latest Emacs stable release]]. 25 | 26 | ** Configuring (28.2) 27 | 28 | Configure Emacs with native-comp, xinput2, imagemagick, harfbuzz, json, athena-toolkit with xaw3d-toolbars & O3 CFLAGS for some minor performance improvements. 29 | 30 | NOTE: If you are intending to compile Emacs<=29 then omit the =--with-xinput2= flag when running =./configure= below. 31 | 32 | #+begin_src sh 33 | 34 | # Navigate to the srcdir 35 | cd ~/git/emacs 36 | 37 | # Run the auto-generation script 38 | ./autogen.sh 39 | 40 | # Configure Emacs with GTK toolkit 41 | ./configure --with-dbus --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xft --with-xpm --with-gpm=no --disable-silent-rules --with-modules --with-file-notification=inotify --with-mailutils --with-x=yes --with-x-toolkit=gtk3 --with-xwidgets --with-lcms2 --with-imagemagick --with-xml2 --with-json --with-harfbuzz --without-compress-install --with-native-compilation --with-xinput2 CFLAGS="-O3 -mtune=native -march=native -fomit-frame-pointer" 42 | 43 | # Configure Emacs with Athena toolkit 44 | # ./configure --with-dbus --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xft --with-xpm --with-gpm=no --disable-silent-rules --with-modules --with-file-notification=inotify --with-mailutils --with-x=yes --with-x-toolkit=athena --without-gconf --without-gsettings --with-lcms2 --with-imagemagick --with-xml2 --with-json --with-harfbuzz --without-compress-install --with-native-compilation --with-xinput2 CFLAGS="-O3 -mtune=native -march=native -fomit-frame-pointer -flto -fno-semantic-interposition" 45 | 46 | #+end_src 47 | 48 | ** Configuring (29) 49 | 50 | #+begin_src sh 51 | 52 | # Run the auto-generation script 53 | ./autogen.sh 54 | 55 | # Configure Emacs with Gtk3 toolkit 56 | ./configure --with-dbus --with-webp --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xft --with-xpm --with-gpm=no --disable-silent-rules --with-modules --with-file-notification=inotify --with-mailutils --with-x=gtk3 --without-gconf --without-gsettings --with-lcms2 --with-imagemagick --with-xml2 --with-json --with-sqlite3 --with-harfbuzz --without-compress-install --with-native-compilation=aot --with-xinput2 --with-tree-sitter CFLAGS="-O3 -mtune=native -march=native -fomit-frame-pointer -flto -fno-semantic-interposition" 57 | 58 | # Configure Emacs with Athena toolkit 59 | ./configure --with-dbus --with-webp --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xft --with-xpm --with-gpm=no --disable-silent-rules --with-modules --with-file-notification=inotify --with-mailutils --with-x-toolkit=athena --without-gconf --without-gsettings --with-lcms2 --with-imagemagick --with-xml2 --with-json --with-sqlite3 --with-harfbuzz --without-compress-install --with-native-compilation --with-xinput2 --with-tree-sitter CFLAGS="-O3 -mtune=native -march=native -fomit-frame-pointer -flto -fno-semantic-interposition" 60 | 61 | #+end_src 62 | 63 | ** Compiling 64 | 65 | Compile with n-1 cores and do native compilation ahead of time. 66 | 67 | #+begin_src sh 68 | 69 | make NATIVE_FULL_AOT=1 -j$(($(nproc)-1)) 70 | 71 | #+end_src 72 | 73 | NOTE: This may take awhile. 74 | 75 | ** Installing 76 | 77 | Finally, install Emacs. 78 | 79 | #+begin_src sh 80 | sudo make install 81 | #+end_src 82 | -------------------------------------------------------------------------------- /docs/emacsonwin.org: -------------------------------------------------------------------------------- 1 | * warning 2 | Windows support is experimental currently. 3 | 4 | * lazy pkg dump 5 | Alot of this is probably repeated and/or unneeded. 6 | 7 | #+begin_src sh 8 | 9 | pacman -Sy --needed filesystem msys2-runtime bash libreadline libiconv libarchive libgpgme libcurl pacman ncurses libintl 10 | 11 | pacman -Su autoconf autogen automake automake-wrapper diffutils git guile libgc libguile libltdl libunistring make mingw-w64-x86_64-binutils mingw-w64-x86_64-bzip2 mingw-w64-x86_64-cairo mingw-w64-x86_64-crt-git mingw-w64-x86_64-dbus mingw-w64-x86_64-expat mingw-w64-x86_64-fontconfig mingw-w64-x86_64-freetype mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-libs mingw-w64-x86_64-gdk-pixbuf2 mingw-w64-x86_64-gettext mingw-w64-x86_64-giflib mingw-w64-x86_64-glib2 mingw-w64-x86_64-gmp mingw-w64-x86_64-gnutls mingw-w64-x86_64-harfbuzz mingw-w64-x86_64-headers-git mingw-w64-x86_64-imagemagick mingw-w64-x86_64-isl mingw-w64-x86_64-libffi mingw-w64-x86_64-libgccjit mingw-w64-x86_64-libiconv mingw-w64-x86_64-libjpeg-turbo mingw-w64-x86_64-libpng mingw-w64-x86_64-librsvg mingw-w64-x86_64-libtiff mingw-w64-x86_64-libwinpthread-git mingw-w64-x86_64-libxml2 mingw-w64-x86_64-mpc mingw-w64-x86_64-mpfr mingw-w64-x86_64-pango mingw-w64-x86_64-pixman mingw-w64-x86_64-winpthreads mingw-w64-x86_64-xpm-nox mingw-w64-x86_64-lcms2 mingw-w64-x86_64-xz mingw-w64-x86_64-zlib tar wget 12 | 13 | pacman -Sy\ 14 | --needed \ 15 | filesystem \ 16 | msys2-runtime \ 17 | bash \ 18 | libreadline \ 19 | libiconv \ 20 | libarchive \ 21 | libgpgme \ 22 | libcurl \ 23 | pacman \ 24 | ncurses \ 25 | libintl 26 | 27 | pacman -Su \ 28 | autoconf \ 29 | autogen \ 30 | automake \ 31 | automake-wrapper \ 32 | diffutils \ 33 | git \ 34 | guile \ 35 | libgc \ 36 | libguile \ 37 | libidn-devel \ 38 | libltdl \ 39 | libnettle-devel \ 40 | libopenssl \ 41 | libp11-kit-devel \ 42 | libtasn1-devel \ 43 | libunistring \ 44 | make \ 45 | mingw-w64-x86_64-binutils \ 46 | mingw-w64-x86_64-bzip2 \ 47 | mingw-w64-x86_64-cairo \ 48 | mingw-w64-x86_64-crt-git \ 49 | mingw-w64-x86_64-dbus \ 50 | mingw-w64-x86_64-expat \ 51 | mingw-w64-x86_64-fontconfig \ 52 | mingw-w64-x86_64-freetype \ 53 | mingw-w64-x86_64-gcc \ 54 | mingw-w64-x86_64-gcc-libs \ 55 | mingw-w64-x86_64-gdk-pixbuf2 \ 56 | mingw-w64-x86_64-gettext \ 57 | mingw-w64-x86_64-giflib \ 58 | mingw-w64-x86_64-glib2 \ 59 | mingw-w64-x86_64-gmp \ 60 | mingw-w64-x86_64-gnutls \ 61 | mingw-w64-x86_64-harfbuzz \ 62 | mingw-w64-x86_64-headers-git \ 63 | mingw-w64-x86_64-imagemagick \ 64 | mingw-w64-x86_64-isl \ 65 | mingw-w64-x86_64-jansson \ 66 | mingw-w64-x86_64-libffi \ 67 | mingw-w64-x86_64-libgccjit \ 68 | mingw-w64-x86_64-libiconv \ 69 | mingw-w64-x86_64-libidn2 \ 70 | mingw-w64-x86_64-libjpeg-turbo \ 71 | mingw-w64-x86_64-libpng \ 72 | mingw-w64-x86_64-librsvg \ 73 | mingw-w64-x86_64-libsystre \ 74 | mingw-w64-x86_64-libtasn1 \ 75 | mingw-w64-x86_64-libtiff \ 76 | mingw-w64-x86_64-libunistring \ 77 | mingw-w64-x86_64-libwinpthread-git \ 78 | mingw-w64-x86_64-libxml2 \ 79 | mingw-w64-x86_64-mpc \ 80 | mingw-w64-x86_64-mpfr \ 81 | mingw-w64-x86_64-nettle \ 82 | mingw-w64-x86_64-p11-kit \ 83 | mingw-w64-x86_64-pango \ 84 | mingw-w64-x86_64-pixman \ 85 | mingw-w64-x86_64-winpthreads \ 86 | mingw-w64-x86_64-xpm-nox \ 87 | mingw-w64-x86_64-xz \ 88 | mingw-w64-x86_64-zlib \ 89 | mingw-w64-x86_64-jbigkit \ 90 | nano \ 91 | openssl \ 92 | pkgconf \ 93 | tar \ 94 | texinfo \ 95 | wget 96 | 97 | pacman -S base-devel msys-devel gcc git 98 | 99 | pacman -S mingw-w64-x86_64-jansson \ 100 | base-devel \ 101 | mingw-w64-x86_64-toolchain \ 102 | mingw-w64-x86_64-zlib \ 103 | mingw-w64-x86_64-libpng \ 104 | mingw-w64-x86_64-poppler \ 105 | mingw-w64-x86_64-imagemagick 106 | 107 | #+end_src 108 | 109 | * steps 110 | 111 | *** install mingw 112 | #+begin_src pwsh 113 | choco install msys2 114 | #+end_src 115 | 116 | *** install emacs 117 | #+begin_src sh 118 | pacman -S mingw-w64-x86_64-emacs 119 | #+end_src 120 | 121 | *** install icons 122 | https://github.com/domtronn/all-the-icons.el 123 | download the zip and extract the fonts to C:\Windows\Fonts 124 | 125 | *** install latex support 126 | #+begin_src sh 127 | pacman -S mingw-w64-clang-x86_64-texlive-latex-recommended 128 | #+end_src 129 | 130 | *** install libgit support 131 | #+begin_src sh 132 | pacman -S mingw-w64-x86_64-libgit2 133 | #+end_src 134 | 135 | *** install pdf-tool support 136 | URL: https://gist.github.com/justbur/afb5f605def2376eeffc643f7b7daae9 137 | 138 | #+begin_src sh 139 | pacman -S mingw-w64-x86_64-emacs-pdf-tools-server 140 | #+end_src 141 | 142 | *** install aspell & en dictionary 143 | #+begin_src sh 144 | pacman -S aspell aspell6-en 145 | #+end_src 146 | 147 | *** sbcl & mit-scheme 148 | SBCL Bin: https://sourceforge.net/projects/sbcl/files/sbcl 149 | Compile SBCL: https://tomrake.github.io/2020-03-15-sbcl-compile-under-ming64/ 150 | 151 | Racket: https://download.racket-lang.org 152 | Racket SICP Collection: https://docs.racket-lang.org/sicp-manual/Installation.html 153 | 154 | ** WIP 155 | 156 | *** mu4e 157 | more hassle than worth it currently to setup on Windows, just use a webmail client for now or Thunderbird. 158 | 159 | URL: https://github.com/msys2-unofficial/MSYS2-packages/tree/master/mu 160 | 161 | *** vterm 162 | vterm currently does not work under non posix environments like msys2 as it relies on termios.h, it may work under cygwin though. 163 | -------------------------------------------------------------------------------- /docs/setupemail.org: -------------------------------------------------------------------------------- 1 | * How to setup Email within Emacs 2 | 3 | /mu4e/ (/mu/) & /offlineimap/ to manage Email within Emacs. 4 | 5 | /mu/ is the server. 6 | 7 | /mu4e/ is the mail client within Emacs. 8 | 9 | /offlineimap/ is the imap synchronization utility. 10 | 11 | [[https://www.djcbsoftware.nl/code/mu/mu4e/Installation.html][mu4e docs]] 12 | 13 | ** 0. Prerequisites 14 | 15 | *** 0.1 maildir 16 | Create your maildir in $HOME as ~/mail 17 | 18 | #+begin_src sh 19 | mkdir -p ~/mail 20 | #+end_src 21 | 22 | Also create your attachments dir in $HOME/$maildir/attachments 23 | 24 | #+begin_src sh 25 | mkdir -p ~/mail/attachments 26 | #+end_src 27 | 28 | *** 0.2 offlineimap 29 | 30 | #+begin_src sh 31 | yay -S offlineimap 32 | #+end_src 33 | 34 | ** 1. Configuring offlineimap 35 | 36 | ~/[[https://github.com/DiamondBond/dotfiles/blob/master/.offlineimaprc][offlineimap.rc]] 37 | 38 | [[https://github.com/DiamondBond/dotfiles/blob/master/.offlineimap.py][~/offlineimap.py]] 39 | 40 | ** 2. Configuring mu 41 | 42 | Please refer to the [[https://github.com/DiamondBond/emacs/blob/master/modules/mail.org][Email]] module to understand what these functions do, you'll have to change the maildir & my-address flags to correspond to your environments setup. 43 | 44 | *** Automatically 45 | 46 | #+begin_quote 47 | M-x mu-setup/automagic 48 | #+end_quote 49 | 50 | *** Manually 51 | 52 | **** Compile mu 53 | 54 | Compile mu & mu4e. 55 | 56 | #+begin_quote 57 | M-x mu-setup/build-mu-binary 58 | #+end_quote 59 | 60 | **** Initialize mu 61 | 62 | Initialize mu with maildir & address. 63 | 64 | #+begin_quote 65 | M-x mu-setup/init-mu 66 | #+end_quote 67 | 68 | **** Build mu index 69 | 70 | Inform mu as to the contents of ~/mail by building/rebuilding the mu index. 71 | 72 | #+begin_quote 73 | M-x mu-setup/rebuild-mu-index 74 | #+end_quote 75 | -------------------------------------------------------------------------------- /early-init.el: -------------------------------------------------------------------------------- 1 | ;;; early-init.el --- Early Initialization. -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2023 Diamond Bond 4 | ;; This file is NOT part of GNU Emacs. 5 | ;; This file is free software. 6 | 7 | ;; Author: Diamond Bond 8 | ;; URL: https://github.com/diamondbond/emacs 9 | ;; Package-Requires: ((emacs "28.1")) 10 | 11 | ;;; Commentary: 12 | ;; This file provides the early-bootstrap configuration. 13 | ;; Emacs HEAD (27+) introduces early-init.el, which is run before init.el, 14 | ;; before package and UI initialization happens. 15 | 16 | ;;; Code: 17 | 18 | ;; Garbage Collection 19 | ;; A big contributor to startup times is garbage collection. We up the gc 20 | ;; threshold to temporarily prevent it from running, then reset it later. 21 | (setq gc-cons-percentage-original gc-cons-percentage 22 | gc-cons-threshold-original gc-cons-threshold) 23 | (setq gc-cons-threshold most-positive-fixnum 24 | gc-cons-percentage 0.6) 25 | 26 | ;; Silence compiler warnings 27 | (setq warning-minimum-level :emergency) 28 | (setq warning-suppress-types '((comp))) 29 | (setq native-comp-async-report-warnings-errors nil) 30 | (setq byte-compile-warnings '(not free-vars unresolved noruntime lexical make-local cl-functions)) 31 | 32 | ;; Warning: with 3, the compiler is free to perform dangerous optimizations. 33 | (setq-default native-comp-speed 3) ;; -O3 34 | 35 | ;; Prevent unwanted runtime compilation for gccemacs (native-comp) users; 36 | ;; packages are compiled ahead-of-time when they are installed and site files 37 | ;; are compiled when gccemacs is installed. 38 | (setq native-comp-deferred-compilation nil) 39 | (setq native-comp-deferred-compilation-deny-list nil) 40 | 41 | ;; In Emacs 27+, package initialization occurs before `user-init-file' is 42 | ;; loaded, but after `early-init-file'. 43 | (setq package-enable-at-startup nil) 44 | 45 | ;; In noninteractive sessions, prioritize non-byte-compiled source files to 46 | ;; prevent the use of stale byte-code. Otherwise, it saves us a little IO time 47 | ;; to skip the mtime checks on every *.elc file. 48 | (setq load-prefer-newer noninteractive) 49 | 50 | ;; Initialise installed packages 51 | (setq package-enable-at-startup t) 52 | 53 | ;; Allow loading from the package cache 54 | (defvar package-quickstart) 55 | (setq package-quickstart t) 56 | 57 | ;; Fully redraw the display before processing queued input events 58 | (setq redisplay-dont-pause t) 59 | 60 | ;; Prevent the glimpse of un-styled Emacs by disabling these UI elements early. 61 | (setq tool-bar-mode nil 62 | menu-bar-mode nil) 63 | (when (fboundp 'set-scroll-bar-mode) 64 | (set-scroll-bar-mode nil)) 65 | 66 | ;; Allow resizing the Emacs frame by individual pixels. 67 | (setq frame-resize-pixelwise t) 68 | 69 | ;; Resizing the Emacs frame can be a terribly expensive part of changing the 70 | ;; font. By inhibiting this, we easily halve startup times with fonts that are 71 | ;; larger than the system default. 72 | (setq frame-inhibit-implied-resize t) 73 | 74 | ;; Ignore X resources; its settings would be redundant with the other settings 75 | ;; in this file and can conflict with later config (particularly where the 76 | ;; cursor color is concerned). 77 | (advice-add #'x-apply-session-resources :override #'ignore) 78 | 79 | ;; Update Emacs ui more frequently 80 | (setq idle-update-delay 0.1) 81 | 82 | ;; Disable bidirectional text scanning for a modest performance boost. I've set 83 | ;; this to `nil' in the past, but the `bidi-display-reordering's docs say that 84 | ;; is an undefined state and suggest this to be just as good: 85 | (setq-default bidi-display-reordering 'left-to-right 86 | bidi-paragraph-direction 'left-to-right) 87 | 88 | ;; Disabling the BPA makes redisplay faster, but might produce incorrect display 89 | ;; reordering of bidirectional text with embedded parentheses and other bracket 90 | ;; characters whose 'paired-bracket' Unicode property is non-nil. 91 | (setq bidi-inhibit-bpa t) ; Emacs 27+ only 92 | 93 | ;; MISC OPTIMIZATIONS ---- 94 | (setq-default cursor-in-non-selected-windows nil) 95 | (setq highlight-nonselected-windows nil) 96 | (setq fast-but-imprecise-scrolling t) 97 | (setq inhibit-compacting-font-caches t) 98 | 99 | ;;; early-init.el ends here 100 | -------------------------------------------------------------------------------- /exwm/README.md: -------------------------------------------------------------------------------- 1 | Link: 2 | ``` 3 | sudo ln -f ~/.emacs.d/exwm/exwm.desktop /usr/share/xsessions/exwm.desktop 4 | sudo systemctl restart gdm 5 | ``` 6 | 7 | Dependencies: 8 | ``` 9 | arandr 10 | xss-lock 11 | nm-applet 12 | pasystray 13 | blueman 14 | picom 15 | dunst 16 | mpd mpc ncmpcpp 17 | ``` 18 | 19 | DE Deps: 20 | https://github.com/DamienCassou/desktop-environment#configuration 21 | ``` 22 | amixer 23 | brightnessctl 24 | scrot 25 | slock 26 | playerctl 27 | ``` 28 | 29 | Ubuntu: 30 | ``` 31 | sudo apt install -y arandr xss-lock network-manager pasystray blueman picom dunst mpd mpc ncmpcpp alsa-utils brightnessctl scrot slock playerctl 32 | ``` 33 | 34 | ``` 35 | cp ~/.emacs.d/exwm/dunstrc ~/.config/dunst/dunstrc 36 | cp ~/.emacs.d/exwm/picom.conf ~/.config/picom.conf 37 | ``` 38 | -------------------------------------------------------------------------------- /exwm/Xmodmap: -------------------------------------------------------------------------------- 1 | clear lock 2 | clear control 3 | keycode 66 = Control_L 4 | add control = Control_L 5 | add Lock = Control_R -------------------------------------------------------------------------------- /exwm/desktop.el: -------------------------------------------------------------------------------- 1 | (defun run-in-background (command) 2 | (let ((command-parts (split-string command "[ ]+"))) 3 | (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) 4 | 5 | ;; EXWM Init 6 | (defun efs/exwm-init-hook () 7 | ;; Make workspace 1 be the one where we land at startup 8 | (exwm-workspace-switch 1) 9 | 10 | ;; Show battery status in the mode line 11 | (when (string= (system-name) "matebook") 12 | (progn 13 | (display-battery-mode 1))) 14 | 15 | ;; Show the time and date in modeline 16 | (setq display-time-day-and-date t) 17 | (display-time-mode 1) 18 | 19 | ;; Alt-Tab setup 20 | (defvar exwm-workspace-previous-index nil "The previous active workspace index.") 21 | (advice-add 'exwm-workspace-switch :before #'exwm-workspace--current-to-previous-index) 22 | 23 | ;; Launch apps that will run in the background 24 | (run-in-background "nm-applet") 25 | (when (string= (system-name) "matebook") 26 | (progn 27 | (run-in-background "pasystray") 28 | (run-in-background "blueman-applet") 29 | (run-in-background "flatpak run com.dropbox.Client")))) 30 | 31 | ;; Alt-Tab functions 32 | (defun exwm-workspace--current-to-previous-index (_x) 33 | (setq exwm-workspace-previous-index exwm-workspace-current-index)) 34 | (defun exwm-workspace-switch-to-previous () 35 | (interactive) 36 | "Switch to the previous active workspace." 37 | (let ((index exwm-workspace-previous-index)) 38 | (exwm-workspace-switch index))) 39 | 40 | ;; EXWM Functions 41 | (defun efs/exwm-update-class () 42 | (exwm-workspace-rename-buffer exwm-class-name)) 43 | 44 | (defun efs/exwm-update-title () 45 | (pcase exwm-class-name 46 | ("Firefox" (exwm-workspace-rename-buffer (format "Firefox: %s" exwm-title))))) 47 | 48 | (defun efs/configure-window-by-class () 49 | (interactive) 50 | (pcase exwm-class-name 51 | ;;("Firefox" (exwm-workspace-move-window 2)) 52 | ("Nm-connection-editor" (exwm-floating-toggle-floating)) 53 | ("Blueman-manager" (exwm-floating-toggle-floating)) 54 | ;; ("gnome-calendar" (exwm-floating-toggle-floating)) 55 | ("gnome-calculator" (exwm-floating-toggle-floating)) 56 | ("Gnome-terminal" (exwm-floating-toggle-floating)) 57 | ("Gnome-system-monitor" (exwm-floating-toggle-floating)) 58 | ("Pavucontrol" (exwm-floating-toggle-floating) 59 | (exwm-layout-toggle-mode-line)) 60 | ("Transmission-gtk" (exwm-floating-toggle-floating)) 61 | ("TelegramDesktop" (exwm-floating-toggle-floating) 62 | (exwm-layout-toggle-mode-line)) 63 | ("org.gnome.Nautilus" (exwm-floating-toggle-floating) 64 | (exwm-layout-toggle-mode-line)) 65 | ("Image Lounge" (exwm-floating-toggle-floating) 66 | (exwm-layout-toggle-mode-line)) 67 | ;; ("nomacs" (exwm-floating-toggle-floating) 68 | ;; (exwm-layout-toggle-mode-line)) 69 | ("Gpick" (exwm-floating-toggle-floating) 70 | (exwm-layout-toggle-mode-line)) 71 | ("Cheese" (exwm-floating-toggle-floating)) 72 | ("mpv" (exwm-floating-toggle-floating) 73 | (exwm-layout-toggle-mode-line)))) 74 | 75 | ;; Misc Functions 76 | (defun rofi-linux-app () 77 | (interactive) 78 | (start-process-shell-command 79 | "rofi" nil "rofi -show combi")) 80 | 81 | (defun x11-fav-launcher () 82 | (interactive) 83 | (start-process-shell-command 84 | "bash" nil "bash -ic ~/bin/launcher.sh")) 85 | 86 | (defun statf () 87 | (interactive) 88 | (start-process-shell-command 89 | "bash" nil "bash -ic ~/bin/statf")) 90 | 91 | (defun window-center () 92 | (interactive) 93 | (start-process-shell-command 94 | "bash" nil "bash -ic ~/bin/windowcenter")) 95 | 96 | ;;** `counsel-linux-app' 97 | (defvar counsel-linux-apps-alist nil 98 | "List of data located in /usr/share/applications.") 99 | 100 | (defvar counsel-linux-apps-faulty nil 101 | "List of faulty data located in /usr/share/applications.") 102 | 103 | (defun counsel-linux-apps-list () 104 | (setq counsel-linux-apps-alist nil) 105 | (let ((files 106 | (delete ".." 107 | (delete "." 108 | (append 109 | (file-expand-wildcards "/var/lib/flatpak/exports/share/applications/*.desktop") 110 | (file-expand-wildcards "/usr/share/applications/*.desktop") 111 | (file-expand-wildcards "~/.local/share/applications/*.desktop")))))) 112 | (dolist (file (cl-set-difference files (append (mapcar 'car counsel-linux-apps-alist) 113 | counsel-linux-apps-faulty) 114 | :test 'equal)) 115 | (add-to-list 'counsel-linux-apps-alist file))) 116 | counsel-linux-apps-alist) 117 | 118 | (defun counsel-linux-app-action (desktop-shortcut) 119 | "Launch DESKTOP-SHORTCUT." 120 | (call-process-shell-command 121 | (format "gtk-launch %s" (file-name-nondirectory desktop-shortcut)))) 122 | 123 | (defun counsel-linux-app () 124 | "Launch a Linux desktop application, similar to Alt-." 125 | (interactive) 126 | (let ((selected-app (completing-read "Run a command: " (counsel-linux-apps-list)))) 127 | (counsel-linux-app-action selected-app))) 128 | 129 | ;; EXWM 130 | (use-package exwm 131 | :straight t 132 | :diminish exwm 133 | :config 134 | ;; Set the default number of workspaces 135 | (setq exwm-workspace-number 10) 136 | 137 | ;; When window "class" updates, use it to set the buffer name 138 | (add-hook 'exwm-update-class-hook #'efs/exwm-update-class) 139 | 140 | ;; When window title updates, use it to set the buffer name 141 | (add-hook 'exwm-update-title-hook #'efs/exwm-update-title) 142 | 143 | ;; Configure windows as they're created 144 | (add-hook 'exwm-manage-finish-hook #'efs/configure-window-by-class) 145 | 146 | ;; When EXWM starts up, do some extra confifuration 147 | (add-hook 'exwm-init-hook #'efs/exwm-init-hook) 148 | 149 | ;; Rebind CapsLock to Ctrl 150 | (start-process-shell-command "xmodmap" nil "xmodmap ~/.emacs.d/exwm/Xmodmap") 151 | 152 | ;; NOTE: Uncomment the following two options if you want window buffers 153 | ;; to be available on all workspaces! 154 | 155 | ;; Automatically move EXWM buffer to current workspace when selected 156 | (setq exwm-layout-show-all-buffers t) 157 | 158 | ;; Display all EXWM buffers in every workspace buffer list 159 | (setq exwm-workspace-show-all-buffers t) 160 | 161 | ;; Detach the minibuffer (show it with exwm-workspace-toggle-minibuffer) 162 | ;;(setq exwm-workspace-minibuffer-position 'top) 163 | 164 | ;; Set the screen resolution (update this to be the correct resolution for your screen!) 165 | (require 'exwm-randr) 166 | (exwm-randr-enable) 167 | (when (string= (system-name) "matebook") 168 | (progn 169 | (start-process-shell-command "xrandr" nil "xrandr --output eDP-1 --primary --mode 2160x1440 --pos 0x0 --rotate normal") 170 | (start-process-shell-command "bash" nil "bash -ic ~/.emacs.d/exwm/disable-touchscreen.sh"))) 171 | (when (string= (system-name) "nitro") 172 | (progn 173 | (start-process-shell-command "xrandr" nil "xrandr --output HDMI-0 --primary --mode 2560x1440 --pos 0x0 --rotate normal --output eDP-1-1 --off --output DP-1-1 --off"))) 174 | 175 | ;; Disable mouse accel 176 | (when (string= (system-name) "nitro") 177 | (progn 178 | (start-process-shell-command "bash" nil "bash -ic ~/bin/kmaccel"))) 179 | 180 | ;; Load the system tray before exwm-init 181 | (require 'exwm-systemtray) 182 | (setq exwm-systemtray-height 18) 183 | (exwm-systemtray-enable) 184 | 185 | ;; Automatically send the mouse cursor to the selected workspace's display 186 | (setq exwm-workspace-warp-cursor t) 187 | 188 | ;; Window focus should follow the mouse pointer 189 | ;; (setq mouse-autoselect-window t 190 | ;; focus-follows-mouse t) 191 | 192 | ;; These keys should always pass through to Emacs 193 | (setq exwm-input-prefix-keys 194 | '(?\C-x 195 | ?\C-u 196 | ?\C-h 197 | ?\C-1 198 | ?\s-h 199 | ?\s-j 200 | ?\s-k 201 | ?\s-l 202 | ?\s-H 203 | ?\s-J 204 | ?\s-K 205 | ?\s-L 206 | ?\M-x 207 | ?\M-` 208 | ?\M-& 209 | ?\M-: 210 | ?\C-\M-j ;; Buffer list 211 | ?\C-\ )) ;; Ctrl+Space 212 | 213 | ;; Ctrl+Q will enable the next key to be sent directly 214 | (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key) 215 | 216 | ;; Set up global key bindings. These always work, no matter the input state! 217 | ;; Keep in mind that changing this list after EXWM initializes has no effect. 218 | (setq exwm-input-global-keys 219 | `( 220 | ;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard) 221 | ([?\s-r] . exwm-reset) 222 | 223 | ;; Toggle exwm-mode 224 | ([?\s-z] . exwm-input-toggle-keyboard) 225 | 226 | ;; Move between windows 227 | ([s-left] . windmove-left) 228 | ([s-right] . windmove-right) 229 | ([s-up] . windmove-up) 230 | ([s-down] . windmove-down) 231 | 232 | ;; Launch applications via shell command 233 | ([?\s-&] . (lambda (command) 234 | (interactive (list (read-shell-command "$ "))) 235 | (start-process-shell-command command nil command))) 236 | 237 | ;; Switch workspace 238 | ([?\s-w] . exwm-workspace-switch) 239 | ([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0))) 240 | 241 | ;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9) 242 | ,@(mapcar (lambda (i) 243 | `(,(kbd (format "s-%d" i)) . 244 | (lambda () 245 | (interactive) 246 | (exwm-workspace-switch-create ,i)))) 247 | (number-sequence 0 9)))) 248 | 249 | ;; App Search 250 | (exwm-input-set-key (kbd "s-x") 'counsel-linux-app) 251 | (exwm-input-set-key (kbd "s-SPC") 'counsel-linux-app) 252 | 253 | ;; App Hotkeys 254 | (exwm-input-set-key (kbd "s-") 'app/xterm) 255 | (exwm-input-set-key (kbd "s-W") 'app/firefox) 256 | (exwm-input-set-key (kbd "s-E") 'app/files) 257 | (exwm-input-set-key (kbd "s-P") 'app/pavucontrol) 258 | 259 | ;; Functions 260 | (exwm-input-set-key (kbd "s-f") 'statf) 261 | (exwm-input-set-key (kbd "s-X") 'app-launcher) 262 | ;; (exwm-input-set-key (kbd "s-X") 'x11-fav-launcher) 263 | (exwm-input-set-key (kbd "s-g") 'app/calculator) 264 | (exwm-input-set-key (kbd "s-") 'exwm-workspace-switch-to-previous) 265 | ;; (exwm-input-set-key (kbd "M-") 'exwm-workspace-switch-to-previous) 266 | (exwm-input-set-key (kbd "C-s-SPC") 'efs/read-desktop-notification) 267 | (exwm-input-set-key (kbd "M-`") 'exwm-floating-hide) 268 | 269 | ;; Start EXWM 270 | (exwm-enable)) 271 | 272 | ;; DE 273 | (use-package desktop-environment 274 | :straight t 275 | :after exwm 276 | :init 277 | (defvar desktop-environment-mode-map 278 | (let ((desktop-environment--keybindings 279 | `(;; Brightness 280 | (,(kbd "") . ,(function desktop-environment-brightness-increment)) 281 | (,(kbd "") . ,(function desktop-environment-brightness-decrement)) 282 | (,(kbd "S-") . ,(function desktop-environment-brightness-increment-slowly)) 283 | (,(kbd "S-") . ,(function desktop-environment-brightness-decrement-slowly)) 284 | ;; Volume 285 | (,(kbd "") . ,(function desktop-environment-volume-increment)) 286 | (,(kbd "") . ,(function desktop-environment-volume-decrement)) 287 | (,(kbd "S-") . ,(function desktop-environment-volume-increment-slowly)) 288 | (,(kbd "S-") . ,(function desktop-environment-volume-decrement-slowly)) 289 | (,(kbd "") . ,(function desktop-environment-toggle-mute)) 290 | (,(kbd "") . ,(function desktop-environment-toggle-microphone-mute)) 291 | ;; Screenshot 292 | (,(kbd "S-") . ,(function desktop-environment-screenshot-part)) 293 | (,(kbd "") . ,(function desktop-environment-screenshot)) 294 | ;; Replace s-l (default: screen-lock) with windmove-right 295 | (,(kbd "s-l") . ,(function windmove-right)) 296 | ;; Screen locking 297 | (,(kbd "s-") . ,(function desktop-environment-lock-screen)) 298 | (,(kbd "") . ,(function desktop-environment-lock-screen)) 299 | ;; Wifi controls 300 | (,(kbd "") . ,(function desktop-environment-toggle-wifi)) 301 | ;; Bluetooth controls 302 | (,(kbd "") . ,(function desktop-environment-toggle-bluetooth)) 303 | ;; Music controls 304 | (,(kbd "") . ,(function desktop-environment-toggle-music)) 305 | (,(kbd "") . ,(function desktop-environment-music-previous)) 306 | (,(kbd "") . ,(function desktop-environment-music-next)) 307 | (,(kbd "") . ,(function desktop-environment-music-stop)))) 308 | (map (make-sparse-keymap))) 309 | (dolist (keybinding desktop-environment--keybindings) 310 | (define-key map (car keybinding) (cdr keybinding))) 311 | map) 312 | "Keymap for `desktop-environment-mode'.") 313 | :config 314 | (desktop-environment-mode) 315 | :custom 316 | (desktop-environment-brightness-small-increment "2%+") 317 | (desktop-environment-brightness-small-decrement "2%-") 318 | (desktop-environment-brightness-normal-increment "5%+") 319 | (desktop-environment-brightness-normal-decrement "5%-")) 320 | 321 | ;; Notifications 322 | (defun efs/read-desktop-notification () 323 | "Dismiss desktop notification." 324 | (interactive) 325 | (start-process-shell-command "bash" nil "bash -ic ~/bin/dunst_dismiss")) 326 | 327 | (defun efs/disable-desktop-notifications () 328 | "Enable desktop notifications." 329 | (interactive) 330 | (start-process-shell-command "notify-send" nil "notify-send \"DUNST_COMMAND_PAUSE\"")) 331 | 332 | (defun efs/enable-desktop-notifications () 333 | "Disable desktop notifications." 334 | (interactive) 335 | (start-process-shell-command "notify-send" nil "notify-send \"DUNST_COMMAND_RESUME\"")) 336 | 337 | (defun efs/toggle-desktop-notifications () 338 | "Toggle desktop notifications." 339 | (interactive) 340 | (start-process-shell-command "notify-send" nil "notify-send \"DUNST_COMMAND_TOGGLE\"")) 341 | 342 | ;; Load apps & launcher 343 | (load-file "~/.emacs.d/exwm/exwm-apps.el") 344 | 345 | (provide 'desktop) 346 | ;;; desktop.el ends here 347 | -------------------------------------------------------------------------------- /exwm/dunstrc: -------------------------------------------------------------------------------- 1 | [global] 2 | width = 300 3 | height = 300 4 | origin = top-right 5 | offset = 5x5 6 | monitor = 0 7 | follow = mouse 8 | indicate_hidden = yes 9 | shrink = yes 10 | separator_height = 0 11 | padding = 5 12 | horizontal_padding = 10 13 | frame_width = 1 14 | frame_color = "#2a2a2a" 15 | sort = no 16 | idle_threshold = 120 17 | font = Menlo 11 18 | line_height = 2 19 | markup = full 20 | format = %s\n%b 21 | #format = "%s\n%b" 22 | alignment = center 23 | show_age_threshold = 60 24 | word_wrap = no 25 | ignore_newline = no 26 | stack_duplicates = false 27 | hide_duplicate_count = yes 28 | show_indicators = no 29 | icon_position = off 30 | sticky_history = yes 31 | history_length = 20 32 | browser = firefox 33 | always_run_script = true 34 | title = Dunst 35 | class = Dunst 36 | 37 | [urgency_low] 38 | timeout = 3 39 | background = "#181818" 40 | foreground = "#ffffff" 41 | 42 | [urgency_normal] 43 | timeout = 6 44 | background = "#181818" 45 | foreground = "#ffffff" 46 | 47 | [urgency_critical] 48 | timeout = 0 49 | background = "#181818" 50 | foreground = "#ffffff" 51 | -------------------------------------------------------------------------------- /exwm/exwm-apps.el: -------------------------------------------------------------------------------- 1 | ;; Apps 2 | (defun app/files () 3 | "Nautilus" 4 | (interactive) 5 | (start-process-shell-command "nautilus" nil "nautilus")) 6 | 7 | (defun app/terminal () 8 | "Gnome Terminal" 9 | (interactive) 10 | (start-process-shell-command "gnome-terminal" nil "gnome-terminal")) 11 | 12 | (defun app/code () 13 | "Visual Studio Code" 14 | (interactive) 15 | (start-process-shell-command "code" nil "code")) 16 | 17 | (defun app/gsm () 18 | "Gnome System Monitor" 19 | (interactive) 20 | (start-process-shell-command "gnome-system-monitor" nil "gnome-system-monitor")) 21 | 22 | (defun app/xterm () 23 | "XTerm" 24 | (interactive) 25 | (start-process-shell-command "xterm" nil "xterm")) 26 | 27 | (defun app/calculator () 28 | "Gnome Calculator" 29 | (interactive) 30 | (start-process-shell-command "gnome-calculator" nil "gnome-calculator")) 31 | 32 | (defun app/calendar () 33 | "Gnome Calendar" 34 | (interactive) 35 | (start-process-shell-command "gnome-calendar" nil "gnome-calendar")) 36 | 37 | (defun app/pavucontrol () 38 | "Pavucontrol" 39 | (interactive) 40 | (start-process-shell-command "pauvcontrol" nil "pavucontrol")) 41 | 42 | (defun app/arandr () 43 | "Arandr" 44 | (interactive) 45 | (start-process-shell-command "arandr" nil "arandr")) 46 | 47 | (defun app/firefox () 48 | "Firefox" 49 | (interactive) 50 | (start-process-shell-command "firefox" nil "firefox")) 51 | 52 | (defun app/thunderbird () 53 | "Thunderbird" 54 | (interactive) 55 | (start-process-shell-command "thunderbird" nil "thunderbird")) 56 | 57 | (defun app/chromium () 58 | "Chromium" 59 | (interactive) 60 | (start-process-shell-command "flatpak run" nil "flatpak run com.github.Eloston.UngoogledChromium")) 61 | 62 | (defun app/telegram () 63 | "Telegram" 64 | (interactive) 65 | (start-process-shell-command "flatpak run" nil "flatpak run org.telegram.desktop")) 66 | 67 | (defun app/discord () 68 | "Discord" 69 | (interactive) 70 | (start-process-shell-command "flatpak run" nil "flatpak run com.discordapp.Discord")) 71 | 72 | ;; Launcher 73 | (defun app-launcher () 74 | "Select and run an app function using `'completing-read`'." 75 | (interactive) 76 | (let ((app-functions '(app/files 77 | app/terminal 78 | app/code 79 | app/gsm 80 | app/xterm 81 | app/calculator 82 | app/calendar 83 | app/pavucontrol 84 | app/arandr 85 | app/firefox 86 | app/thunderbird 87 | app/chromium 88 | app/telegram 89 | app/discord))) 90 | (funcall (intern (completing-read "Select an app: " app-functions nil t))))) 91 | 92 | (provide 'exwm-apps) 93 | ;;; exwm-apps.el ends here 94 | -------------------------------------------------------------------------------- /exwm/exwm-debug.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=EXWM (Debug) 3 | Comment=Emacs Window Manager (Debug Init) 4 | Exec=sh /home/diamond/.emacs.d/exwm/start-exwm-debug.sh 5 | TryExec=sh 6 | Type=Application 7 | X-LightDM-DesktopName=exwm 8 | DesktopNames=exwm -------------------------------------------------------------------------------- /exwm/exwm.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=EXWM 3 | Comment=Emacs Window Manager 4 | Exec=sh /home/diamond/.emacs.d/exwm/start-exwm.sh 5 | TryExec=sh 6 | Type=Application 7 | X-LightDM-DesktopName=exwm 8 | DesktopNames=exwm -------------------------------------------------------------------------------- /exwm/picom.conf: -------------------------------------------------------------------------------- 1 | ################################# 2 | # Shadows # 3 | ################################# 4 | shadow = false; 5 | shadow-radius = 7; 6 | shadow-offset-x = -7; 7 | shadow-offset-y = -7; 8 | shadow-opacity = 0.75; 9 | shadow-ignore-shaped = false; 10 | shadow-exclude = [ 11 | "window_type = 'menu'", 12 | "window_type = 'dropdown_menu'", 13 | "window_type = 'popup_menu'", 14 | "window_type = 'utility'", 15 | "class_g = 'Polybar'", 16 | "class_g = 'Rofi'", 17 | "class_g = 'Dunst'", 18 | "class_g = 'Conky'", 19 | "class_g = 'Polybar'", 20 | #"class_g = 'Xfce4-panel'", 21 | # "!_COMPTON_SHADOW@:32c = 1" 22 | ]; 23 | 24 | ################################# 25 | # Fading # 26 | ################################# 27 | fading = false 28 | 29 | ################################# 30 | # Transparency / Opacity # 31 | ################################# 32 | inactive-opacity = 1; 33 | frame-opacity = 1; 34 | #menu-opacity = 1; 35 | inactive-opacity-override = false; 36 | active-opacity = 1; 37 | 38 | ################################# 39 | # General Settings # 40 | ################################# 41 | 42 | # Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers. 43 | # daemon = false 44 | 45 | # Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`. 46 | # `xrender` is the default one. 47 | # 48 | # backend = "glx" 49 | # backend = "xr_glx_hybrid" 50 | backend = "glx"; 51 | #glx-use-copysubbuffer-mesa = true; 52 | #experimental-backends = true; 53 | 54 | # Enable/disable VSync. 55 | #vsync = false 56 | vsync = true 57 | 58 | # Enable remote control via D-Bus. See the *D-BUS API* section below for more details. 59 | # dbus = false 60 | 61 | # Try to detect WM windows (a non-override-redirect window with no 62 | # child that has 'WM_STATE') and mark them as active. 63 | # 64 | # mark-wmwin-focused = false 65 | mark-wmwin-focused = true; 66 | 67 | # Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused. 68 | # mark-ovredir-focused = false 69 | mark-ovredir-focused = true; 70 | 71 | # Try to detect windows with rounded corners and don't consider them 72 | # shaped windows. The accuracy is not very high, unfortunately. 73 | # 74 | detect-rounded-corners = false 75 | #detect-rounded-corners = true; 76 | 77 | #corner-radius = 8; 78 | corner-radius = 0; 79 | 80 | # Rounded Corners Exclude 81 | rounded-corners-exclude = [ 82 | "window_type = 'menu'", 83 | "window_type = 'dropdown_menu'", 84 | "window_type = 'popup_menu'", 85 | "window_type = 'utility'", 86 | "class_g = 'Polybar'", 87 | "class_g = 'Rofi'", 88 | "class_g = 'Dunst'", 89 | "class_g = 'Xfce4-panel'", 90 | ]; 91 | 92 | # Detect '_NET_WM_OPACITY' on client windows, useful for window managers 93 | # not passing '_NET_WM_OPACITY' of client windows to frame windows. 94 | # 95 | #detect-client-opacity = false 96 | detect-client-opacity = true; 97 | 98 | # Specify refresh rate of the screen. If not specified or 0, picom will 99 | # try detecting this with X RandR extension. 100 | # 101 | # refresh-rate = 60 102 | #refresh-rate = 0 103 | 104 | # Limit picom to repaint at most once every 1 / 'refresh_rate' second to 105 | # boost performance. This should not be used with 106 | #vsync drm/opengl/opengl-oml 107 | # as they essentially does sw-opti's job already, 108 | # unless you wish to specify a lower refresh rate than the actual value. 109 | # 110 | # sw-opti = 111 | 112 | # Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window, 113 | # rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy, 114 | # provided that the WM supports it. 115 | # 116 | # use-ewmh-active-win = false 117 | 118 | # Painting on X Composite overlay window. Recommended. 119 | #paint-on-overlay = true 120 | 121 | # Unredirect all windows if a full-screen opaque window is detected, 122 | # to maximize performance for full-screen windows. Known to cause flickering 123 | # when redirecting/unredirecting windows. 124 | # 125 | # unredir-if-possible = false 126 | 127 | # Delay before unredirecting the window, in milliseconds. Defaults to 0. 128 | # unredir-if-possible-delay = 0 129 | 130 | # Conditions of windows that shouldn't be considered full-screen for unredirecting screen. 131 | # unredir-if-possible-exclude = [] 132 | 133 | # Use 'WM_TRANSIENT_FOR' to group windows, and consider windows 134 | # in the same group focused at the same time. 135 | # 136 | # detect-transient = false 137 | detect-transient = true 138 | 139 | # Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same 140 | # group focused at the same time. 'WM_TRANSIENT_FOR' has higher priority if 141 | # detect-transient is enabled, too. 142 | # 143 | # detect-client-leader = false 144 | detect-client-leader = true 145 | 146 | # Resize damaged region by a specific number of pixels. 147 | # A positive value enlarges it while a negative one shrinks it. 148 | # If the value is positive, those additional pixels will not be actually painted 149 | # to screen, only used in blur calculation, and such. (Due to technical limitations, 150 | # with use-damage, those pixels will still be incorrectly painted to screen.) 151 | # Primarily used to fix the line corruption issues of blur, 152 | # in which case you should use the blur radius value here 153 | # (e.g. with a 3x3 kernel, you should use `--resize-damage 1`, 154 | # with a 5x5 one you use `--resize-damage 2`, and so on). 155 | # May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly. 156 | # 157 | # resize-damage = 1 158 | 159 | # Specify a list of conditions of windows that should be painted with inverted color. 160 | # Resource-hogging, and is not well tested. 161 | # 162 | # invert-color-include = [] 163 | 164 | # GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer. 165 | # Might cause incorrect opacity when rendering transparent content (but never 166 | # practically happened) and may not work with blur-background. 167 | # My tests show a 15% performance boost. Recommended. 168 | # 169 | glx-no-stencil = true 170 | 171 | # GLX backend: Avoid rebinding pixmap on window damage. 172 | # Probably could improve performance on rapid window content changes, 173 | # but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.). 174 | # Recommended if it works. 175 | # 176 | glx-no-rebind-pixmap = true 177 | 178 | # Disable the use of damage information. 179 | # This cause the whole screen to be redrawn everytime, instead of the part of the screen 180 | # has actually changed. Potentially degrades the performance, but might fix some artifacts. 181 | # The opposing option is use-damage 182 | # 183 | # no-use-damage = false 184 | use-damage = true 185 | #use-damage = false # this fixes the flickering on intel modesetting 186 | 187 | # Use X Sync fence to sync clients' draw calls, to make sure all draw 188 | # calls are finished before picom starts drawing. Needed on nvidia-drivers 189 | # with GLX backend for some users. 190 | # 191 | xrender-sync-fence = false 192 | 193 | # GLX backend: Use specified GLSL fragment shader for rendering window contents. 194 | # See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl` 195 | # in the source tree for examples. 196 | # 197 | # glx-fshader-win = '' 198 | 199 | # Force all windows to be painted with blending. Useful if you 200 | # have a glx-fshader-win that could turn opaque pixels transparent. 201 | # 202 | # force-win-blend = false 203 | 204 | # Do not use EWMH to detect fullscreen windows. 205 | # Reverts to checking if a window is fullscreen based only on its size and coordinates. 206 | # 207 | # no-ewmh-fullscreen = false 208 | 209 | # Dimming bright windows so their brightness doesn't exceed this set value. 210 | # Brightness of a window is estimated by averaging all pixels in the window, 211 | # so this could comes with a performance hit. 212 | # Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0) 213 | # 214 | # max-brightness = 1.0 215 | 216 | # Make transparent windows clip other windows like non-transparent windows do, 217 | # instead of blending on top of them. 218 | # 219 | #transparent-clipping = false 220 | 221 | # Set the log level. Possible values are: 222 | # "trace", "debug", "info", "warn", "error" 223 | # in increasing level of importance. Case doesn't matter. 224 | # If using the "TRACE" log level, it's better to log into a file 225 | # using *--log-file*, since it can generate a huge stream of logs. 226 | # 227 | # log-level = "debug" 228 | log-level = "warn"; 229 | 230 | # Set the log file. 231 | # If *--log-file* is never specified, logs will be written to stderr. 232 | # Otherwise, logs will to written to the given file, though some of the early 233 | # logs might still be written to the stderr. 234 | # When setting this option from the config file, it is recommended to use an absolute path. 235 | # 236 | # log-file = '~/.config/compton.log' 237 | 238 | # Show all X errors (for debugging) 239 | # show-all-xerrors = false 240 | 241 | # Write process ID to a file. 242 | # write-pid-path = '/path/to/your/log/file' 243 | 244 | opacity-rule = [ 245 | "100:class_g = 'firefox'", 246 | "100:class_g = 'Thunderbird'", 247 | "100:class_g = '*'" 248 | ]; 249 | focus-exclude = [ "class_g = 'firefox'", "class_g = 'Google-chrome'" ]; 250 | 251 | 252 | transparent-clipping = false; 253 | -------------------------------------------------------------------------------- /exwm/start-exwm-debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # X11 4 | xset b off & # Disables bell 5 | xset -dpms & # Disables Energy Star features 6 | xset s off & # Disables screen saver 7 | 8 | # Xresources 9 | [[ -f ~/.Xresources ]] && xrdb ~/.Xresources & # Merge Xresources 10 | 11 | # Disable touchscreen 12 | xinput | grep 'ELAN224A' | grep 'pointer' | grep -Po 'id=\d+' | cut -d= -f2 | xargs xinput disable & 13 | 14 | # Run the screen compositor 15 | picom & 16 | 17 | # Enable screen locking on suspend 18 | xss-lock -- slock & 19 | 20 | # Fire it up 21 | exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.emacs.d/exwm/desktop.el 22 | -------------------------------------------------------------------------------- /exwm/start-exwm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # X11 4 | xset b off & # Disables bell 5 | xset -dpms & # Disables Energy Star features 6 | xset s off & # Disables screen saver 7 | 8 | # Xresources 9 | [[ -f ~/.Xresources ]] && xrdb ~/.Xresources & # Merge Xresources 10 | 11 | # Run the screen compositor 12 | picom & 13 | 14 | # Enable screen locking on suspend 15 | xss-lock -- slock & 16 | 17 | # Fire it up 18 | exec dbus-launch --exit-with-session emacs -mm -l ~/.emacs.d/exwm/desktop.el 19 | -------------------------------------------------------------------------------- /img/gnu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiamondBond/emacs/f9747d9e595518b26d605278144328d73d5d64bf/img/gnu.png -------------------------------------------------------------------------------- /img/gnusstorm-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiamondBond/emacs/f9747d9e595518b26d605278144328d73d5d64bf/img/gnusstorm-2.gif -------------------------------------------------------------------------------- /img/spacemacs-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiamondBond/emacs/f9747d9e595518b26d605278144328d73d5d64bf/img/spacemacs-logo.png -------------------------------------------------------------------------------- /init.el: -------------------------------------------------------------------------------- 1 | ;;; init.el --- Initialization. -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2023 Diamond Bond 4 | ;; This file is NOT part of GNU Emacs. 5 | ;; This file is free software. 6 | 7 | ;; Author: Diamond Bond 8 | ;; URL: https://github.com/diamondbond/emacs 9 | ;; Package-Requires: ((emacs "29")) 10 | 11 | ;;; Code: 12 | 13 | ;;--------------------------------------------------------------------- 14 | ;; CORE 15 | ;;--------------------------------------------------------------------- 16 | 17 | ;; Make emacs startup faster 18 | (defvar startup/file-name-handler-alist file-name-handler-alist) 19 | (setq file-name-handler-alist nil) 20 | (defun startup/revert-file-name-handler-alist () 21 | "Revert file name handler alist." 22 | (setq file-name-handler-alist startup/file-name-handler-alist)) 23 | (add-hook 'emacs-startup-hook 'startup/revert-file-name-handler-alist) 24 | 25 | ;; For performance 26 | (setq read-process-output-max (* 1024 1024)) ;; 1mb 27 | (setq process-adaptive-read-buffering nil) 28 | 29 | ;; Fix for font-based performance issues 30 | (setq inhibit-compacting-font-caches t) 31 | 32 | ;; Load newer .elc or .el 33 | (setq load-prefer-newer t) 34 | 35 | ;; Initialize melpa repo 36 | (require 'package) 37 | (add-to-list 'package-archives 38 | '("melpa" . "https://melpa.org/packages/")) 39 | (package-initialize) 40 | 41 | ;; Define when to check for package modifications, 42 | ;; for improved straight.el startup time. 43 | (setq straight-check-for-modifications '(check-on-save)) 44 | 45 | ;; Bootstrap straight.el 46 | (defvar bootstrap-version) 47 | (let ((bootstrap-file 48 | (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) 49 | (bootstrap-version 5)) 50 | (unless (file-exists-p bootstrap-file) 51 | (with-current-buffer 52 | (url-retrieve-synchronously 53 | "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" 54 | 'silent 'inhibit-cookies) 55 | (goto-char (point-max)) 56 | (eval-print-last-sexp))) 57 | (load bootstrap-file nil 'nomessage)) 58 | 59 | ;; Install use-package with straight.el 60 | (straight-use-package 'use-package) 61 | 62 | ;; Configure straight.el 63 | (use-package straight 64 | :custom 65 | (straight-use-package-by-default t) 66 | (straight-vc-git-default-clone-depth 1) 67 | (straight-recipes-gnu-elpa-use-mirror t) 68 | (straight-check-for-modifications '(check-on-save))) 69 | ;;(straight-check-for-modifications nil)) 70 | 71 | ;;--------------------------------------------------------------------- 72 | ;; GLOBALS 73 | ;;--------------------------------------------------------------------- 74 | 75 | (setq 76 | globals--font "Menlo 10" ; Font 77 | globals--name "Diamond Bond" ; Name 78 | globals--email "diamondbond1@gmail.com" ; Email 79 | globals--irc "diamondbond" ; IRC 80 | globals--erc '("diamondbond" "diamondbond_") ; ERC 81 | globals--auth-info "~/.authinfo.gpg" ; Auth Info 82 | globals--auth-sources '("~/.authinfo.gpg") ; Auth Src 83 | globals--browser 'browse-url-firefox ; Browser 84 | globals--banner-path "img/gnu.png" ; Banner 85 | ) 86 | 87 | ;;--------------------------------------------------------------------- 88 | ;; BASE 89 | ;;--------------------------------------------------------------------- 90 | 91 | (when (file-readable-p "~/.emacs.d/lisp/base.el") 92 | (load-file "~/.emacs.d/lisp/base.el")) 93 | 94 | ;;--------------------------------------------------------------------- 95 | ;; KEYBINDS 96 | ;;--------------------------------------------------------------------- 97 | 98 | (when (file-readable-p "~/.emacs.d/lisp/keybinds.el") 99 | (load-file "~/.emacs.d/lisp/keybinds.el")) 100 | 101 | ;;--------------------------------------------------------------------- 102 | ;; PACKAGES 103 | ;;--------------------------------------------------------------------- 104 | 105 | (when (file-readable-p "~/.emacs.d/lisp/packages.el") 106 | (load-file "~/.emacs.d/lisp/packages.el")) 107 | 108 | ;;--------------------------------------------------------------------- 109 | ;; LANGUAGES 110 | ;;--------------------------------------------------------------------- 111 | 112 | (when (file-readable-p "~/.emacs.d/lisp/languages.el") 113 | (load-file "~/.emacs.d/lisp/languages.el")) 114 | 115 | ;;--------------------------------------------------------------------- 116 | ;; FUNCTIONS 117 | ;;--------------------------------------------------------------------- 118 | 119 | (when (file-readable-p "~/.emacs.d/lisp/functions.el") 120 | (load-file "~/.emacs.d/lisp/functions.el")) 121 | 122 | ;;===================================================================== 123 | ;;============================== MODULES ============================== 124 | ;;===================================================================== 125 | 126 | ;;--------------------------------------------------------------------- 127 | ;; THEME 128 | ;;--------------------------------------------------------------------- 129 | 130 | ;; (load-theme-based-on-system-theme) 131 | 132 | ;; Reverse video mode 133 | ;; (reverse-video-mode) 134 | 135 | ;;--------------------------------------------------------------------- 136 | ;; MAIL 137 | ;;--------------------------------------------------------------------- 138 | 139 | ;; (when (file-readable-p "~/.emacs.d/lisp/mail.el") 140 | ;; (load-file "~/.emacs.d/lisp/mail.el")) 141 | 142 | ;;--------------------------------------------------------------------- 143 | ;; JIRA 144 | ;;--------------------------------------------------------------------- 145 | 146 | ;; (when (file-readable-p "~/.emacs.d/lisp/jira.el") 147 | ;; (load-file "~/.emacs.d/lisp/jira.el")) 148 | 149 | ;;--------------------------------------------------------------------- 150 | ;; GPT 151 | ;;--------------------------------------------------------------------- 152 | 153 | ;; (when (file-readable-p "~/.emacs.d/lisp/gpt.el") 154 | ;; (load-file "~/.emacs.d/lisp/gpt.el")) 155 | 156 | ;;--------------------------------------------------------------------- 157 | ;; END 158 | ;;--------------------------------------------------------------------- 159 | 160 | ;; Restore desired GC values 161 | (add-hook 'emacs-startup-hook 162 | (lambda () 163 | (setq gc-cons-threshold lsp-cons-threshold) 164 | (setq gc-cons-percentage gc-cons-percentage-original))) 165 | 166 | ;;; init.el ends here 167 | -------------------------------------------------------------------------------- /lisp/base.el: -------------------------------------------------------------------------------- 1 | ;; Apply globals 2 | (setq user-full-name globals--name 3 | user-mail-address globals--email 4 | erc-nick globals--erc 5 | erc-nick-short globals--irc 6 | rcirc-default-user-name globals--irc 7 | rcirc-default-nick globals--irc 8 | rcirc-default-full-name globals--name) 9 | 10 | ;; Load authinfo 11 | (if (file-exists-p globals--auth-info) 12 | (use-package auth-source 13 | :no-require t 14 | :config (setq auth-sources globals--auth-sources)) 15 | (setq auth-source-cache-expiry nil)) 16 | 17 | ;; Ask for encryption password once 18 | (setq epa-file-cache-passphrase-for-symmetric-encryption t) 19 | 20 | ;; Email to encrypt to 21 | (setq epa-file-encrypt-to '(globals--email)) 22 | 23 | ;; Set GC threshold 24 | (setq lsp-cons-threshold 100000000) 25 | 26 | ;; Do not GC during startup 27 | (setq gc-cons-threshold most-positive-fixnum) 28 | 29 | ;; Garbage collection minibuffer hack 30 | (defun my-minibuffer-setup-hook () 31 | "Garbage collection will never occur." 32 | (setq gc-cons-threshold most-positive-fixnum)) 33 | 34 | (defun my-minibuffer-exit-hook () 35 | "Garbage collection will kick off immediately." 36 | (setq gc-cons-threshold lsp-cons-threshold)) ;; or gc-cons-threshold-original 37 | 38 | ;;(add-hook 'minibuffer-setup-hook #'my-minibuffer-setup-hook) 39 | ;;(add-hook 'minibuffer-exit-hook #'my-minibuffer-exit-hook) 40 | 41 | ;; Disable warnings 42 | (setq warning-suppress-types '((comp))) 43 | (setq ad-redefinition-action 'accept) 44 | 45 | ;; Disable auto-window-vscroll 46 | (setq auto-window-vscroll nil) 47 | 48 | ;; Set initial major modes 49 | (setq-default initial-major-mode 'fundamental-mode 50 | default-major-mode 'text-mode) 51 | 52 | ;; Disable confirmation on visiting a new file 53 | (setq confirm-nonexistent-file-or-buffer nil) 54 | 55 | ;; Set default custom file 56 | (setq-default custom-file (expand-file-name "custom.el" user-emacs-directory)) 57 | 58 | ;; Write to it if it does not exist 59 | (unless (file-exists-p custom-file) 60 | (write-region "" nil custom-file)) 61 | 62 | ;; Load custom file. Don't hide errors. Hide success message 63 | (load custom-file nil t) 64 | 65 | ;; Bookmark settings 66 | (when (file-directory-p "~/org") 67 | (if (file-exists-p "~/org/bookmarks") 68 | (setq bookmark-default-file "~/org/bookmarks"))) 69 | ;; Hide bookmark marker in fringe 70 | (setq bookmark-set-fringe-mark nil) 71 | ;; Save bookmarks everytime they are modified 72 | (setq bookmark-save-flag 1) 73 | 74 | ;; Load any custom themes 75 | (when (file-exists-p (expand-file-name "themes/" user-emacs-directory)) 76 | (setq custom-safe-themes t) 77 | (add-to-list 'custom-theme-load-path (expand-file-name "themes/" user-emacs-directory))) 78 | 79 | ;; Enable vc symlinks 80 | (setq vc-follow-symlinks t) 81 | 82 | ;; Kill buffer settings 83 | (setq confirm-kill-emacs nil) 84 | (setq confirm-kill-processes nil) 85 | ;; Prevent 'Buffer modified; kill anyway?' 86 | ;; (add-hook 'kill-buffer-query-functions 87 | ;; (lambda () (not-modified) t)) 88 | ;; Not recommended - potentially causes slowdowns. 89 | 90 | ;; Disable backups 91 | (setq-default backup-inhibited t) 92 | (setq make-backup-files nil) 93 | (setq auto-save-default nil) 94 | (setq create-lockfiles nil) 95 | (setq vc-make-backup-files nil) 96 | 97 | ;; Delete whitespace on save 98 | (add-hook 'before-save-hook 99 | 'delete-trailing-whitespace) 100 | 101 | ;; UTF-8 rules 102 | (set-language-environment "UTF-8") 103 | (set-default-coding-systems 'utf-8) 104 | (setq locale-coding-system 'utf-8) 105 | (set-terminal-coding-system 'utf-8) 106 | (set-keyboard-coding-system 'utf-8) 107 | (set-selection-coding-system 'utf-8) 108 | (prefer-coding-system 'utf-8) 109 | 110 | ;; Set default dirs 111 | (setq default-directory "~/") 112 | (setq command-line-default-directory "~/") 113 | 114 | ;; Environment settings 115 | (setenv "PAGER" "cat") 116 | (setenv "GPG_AGENT_INFO" nil) 117 | 118 | ;; Disable bell 119 | (setq ring-bell-function 'ignore) 120 | 121 | ;; Disable motion events from mouse 122 | (setq-default track-mouse nil) 123 | ;; (mouse-avoidance-mode 'jump) 124 | 125 | ;; Configure scrolling 126 | ;; If the frame contains multiple windows, scroll the one under the cursor 127 | ;; instead of the one that currently has keyboard focus. 128 | (setq mouse-wheel-follow-mouse 't 129 | ;; Completely disable mouse wheel acceleration to avoid speeding away. 130 | mouse-wheel-progressive-speed nil) 131 | 132 | ;; Scroll wheel amount 133 | ;; mouse-wheel-scroll-amount '(2 ((shift) . 8) ((control) . 6))) 134 | 135 | ;; Scroll margin 136 | (setq scroll-margin 0) 137 | ;; (setq scroll-conservatively 100000) 138 | 139 | ;; Fast but imprecise scrolling 140 | (setq scroll-preserve-screen-position t) 141 | (setq fast-but-imprecise-scrolling t) 142 | 143 | ;; Enable pixel-scroll-precision-mode (emacs29+) 144 | (pixel-scroll-precision-mode) 145 | 146 | ;; Clipboard settings 147 | (setq select-enable-clipboard t) 148 | (setq save-interprogram-paste-before-kill t) 149 | 150 | ;; Auto-select window on hover (Focus follows mouse) 151 | ;; (setq mouse-autoselect-window t) 152 | 153 | ;; Enable & configure show-paren-mode 154 | (setq show-paren-delay 0.1 155 | show-paren-style 'parenthesis 156 | show-paren-highlight-openparen t 157 | show-paren-when-point-inside-paren t 158 | show-paren-when-point-in-periphery t) 159 | (show-paren-mode 1) 160 | 161 | ;; Tabs & indents settings (highly controversial) 162 | (setq-default indent-tabs-mode t) 163 | (setq-default tab-width 4) 164 | (setq-default standard-indent 4) 165 | (setq-default indent-line-function 4) 166 | (setq-default lisp-indent-offset nil) 167 | (setq-default sgml-basic-offset 4) 168 | (setq-default electric-indent-inhibit nil) 169 | (setq backward-delete-char-untabify-method 'nil) 170 | (electric-indent-mode -1) ;; Disable electric indentation 171 | 172 | ;; C mode tabs/indents settings 173 | (setq c-default-style "linux") 174 | (setq c-basic-offset tab-width) 175 | 176 | ;; Enable subword mode in C mode 177 | ;; (global-subword-mode t) 178 | (add-hook 'c-mode-common-hook 179 | (lambda () (subword-mode 1))) 180 | 181 | ;; Disable double space sentence end 182 | (setq sentence-end-double-space nil) 183 | 184 | ;; Set font 185 | ;; (when (string= (system-name) "matebook") 186 | ;; (setq globals--font "Menlo 14")) 187 | (add-to-list 'default-frame-alist `(font . ,globals--font)) 188 | 189 | ;; Set time format 190 | (setq-default display-time-format "%I:%M %p") 191 | 192 | ;; Set fill column width 193 | (setq-default fill-column 80) 194 | 195 | ;; Show trailing whitespace in prog-modes 196 | (add-hook 'prog-mode-hook 197 | (lambda () 198 | (setq show-trailing-whitespace t))) 199 | 200 | ;; Set frame title format 201 | (setq-default frame-title-format '("%b")) 202 | 203 | ;; Make buffer names unique and easy to read 204 | (setq-default uniquify-buffer-name-style 'forward) 205 | 206 | ;; Set internal border width to 0 207 | (add-to-list 'default-frame-alist '(internal-border-width . 0)) 208 | 209 | ;; Enable pixelwise resizing 210 | (setq window-resize-pixelwise t) 211 | (setq frame-resize-pixelwise t) 212 | 213 | ;; Inhibit startup screen 214 | (setq inhibit-startup-message t) 215 | (setq initial-scratch-message "") 216 | 217 | ;; Disable blinking cursor 218 | (blink-cursor-mode -1) 219 | 220 | ;; Stretch cursor 221 | ;; (setq x-stretch-cursor t) 222 | 223 | ;; Menu-bar 224 | (if (fboundp 'menu-bar-mode) 225 | (menu-bar-mode 1)) 226 | 227 | ;; Tool-bar 228 | (if (fboundp 'tool-bar-mode) 229 | (tool-bar-mode 0)) 230 | ;; (setq tool-bar-style 'image) 231 | 232 | ;; Scroll-bar 233 | (if (fboundp 'scroll-bar-mode) 234 | (scroll-bar-mode 1)) 235 | 236 | ;; for athena 237 | ;; (set-scroll-bar-mode 'right) 238 | 239 | ;; disable minibuffer scroll-bar 240 | ;; (set-window-scroll-bars (minibuffer-window) nil nil) 241 | 242 | ;; Tab-bar 243 | ;; (tab-bar-mode 1) 244 | ;; (setq tab-bar-show t) 245 | ;; (tab-bar-history-mode 1) 246 | (setq tab-bar-history-limit 25) 247 | (setq tab-bar-new-button-show nil) 248 | (setq tab-bar-close-button-show nil) 249 | ;; (setq tab-bar-new-tab-choice "*GNU Emacs*") 250 | ;; (setq tab-bar-close-button-show nil) 251 | ;; (setq tab-bar-new-button-show nil) 252 | 253 | ;; Enable tab-bar & local scroll-bar when using emacsclient 254 | ;; (use-package emacs 255 | ;; :hook (server-after-make-frame . tab-bar-enable) 256 | ;; :hook (server-after-make-frame . enable-local-scroll-bar)) 257 | 258 | ;; Time in tab-bar 259 | ;; (display-time-mode 1) 260 | ;; (add-to-list 'tab-bar-format 'tab-bar-format-align-right 'append) 261 | ;; (add-to-list 'tab-bar-format 'tab-bar-format-global 'append) 262 | ;; (setq tab-bar-format '(tab-bar-format-global) 263 | ;; tab-bar-mode t) 264 | 265 | ;; Configure fringe 266 | ;; (fringe-mode '(8 . 0)) 267 | (setq-default fringes-outside-margins nil) 268 | (setq-default indicate-buffer-boundaries nil) 269 | (setq-default indicate-empty-lines nil) 270 | (setq-default overflow-newline-into-fringe t) 271 | ;; Set fringe color 272 | ;; (set-face-attribute 'fringe nil :background "#ffffff" :foreground "#ffffff") 273 | 274 | ;; Set default frame-size 275 | (add-to-list 'default-frame-alist '(width . 80)) 276 | (add-to-list 'default-frame-alist '(height . 46)) 277 | 278 | ;; Set default frame background 279 | ;; (add-to-list 'default-frame-alist '(background-color . "honeydew")) 280 | 281 | ;; Disable vsync 282 | (add-to-list 'default-frame-alist '(inhibit-double-buffering . t)) 283 | 284 | ;; Reverse video mode 285 | ;; (reverse-video-mode) 286 | 287 | ;; Configure some modes 288 | (column-number-mode 1) 289 | (global-hl-line-mode 0) 290 | (global-prettify-symbols-mode t) 291 | 292 | ;; Line number modes 293 | (add-hook 'prog-mode-hook 'display-line-numbers-mode) 294 | (add-hook 'text-mode-hook 'display-line-numbers-mode) 295 | 296 | ;; Visual line mode 297 | (add-hook 'text-mode-hook 'visual-line-mode) 298 | (add-hook 'org-mode-hook 'visual-line-mode) 299 | 300 | ;; Aliases 301 | (defalias 'first 'car) 302 | (defalias 'second 'cadr) 303 | (defalias 'third 'caddr) 304 | (defalias 'when-not 'unless) 305 | (defalias 'word-count 'count-words) 306 | (defalias 'yes-or-no-p 'y-or-n-p) 307 | 308 | (defalias 'shrink-wrap 'fit-frame-to-buffer) 309 | 310 | ;;(defalias 'recentf-delete-list 'recentf-edit-list) 311 | (defalias 'bookmark-delete-all 'bookmark-delete) 312 | 313 | (defalias 'sync/news 'elfeed-update) 314 | (defalias 'sync/work 'ejira-update-my-projects) 315 | 316 | ;; Set browser depending on system 317 | (if (eq system-type 'gnu/linux) 318 | (setq browse-url-browser-function globals--browser)) 319 | (if (eq system-type 'darwin) 320 | (setq browse-url-browser-function globals--browser)) 321 | 322 | ;; Proced settings 323 | (setq proced-auto-update-flag t) 324 | (setq proced-auto-update-interval 5) 325 | (setq proced-descend t) 326 | (setq proced-filter 'user) 327 | 328 | ;; Set eshell prompt 329 | (setq eshell-prompt-function 330 | (lambda nil 331 | (concat 332 | (if (string= (eshell/pwd) (getenv "HOME")) 333 | (propertize "~" 'face `(:foreground "#2255bb")) 334 | (replace-regexp-in-string 335 | (getenv "HOME") 336 | (propertize "~" 'face `(:foreground "#2255bb")) 337 | (propertize (eshell/pwd) 'face `(:foreground "#2255bf")))) 338 | (if (= (user-uid) 0) 339 | (propertize " α " 'face `(:foreground "#aa0000")) 340 | (propertize " λ " 'face `(:foreground "#68228b")))))) 341 | (setq eshell-prompt-regexp "^[^αλ\n]*[αλ] ") 342 | 343 | ;; Do not highlight prompt 344 | (setq eshell-highlight-prompt nil) 345 | 346 | ;; Kill eshell zombie processes 347 | (setq eshell-kill-processes-on-exit t) 348 | 349 | ;; Disable global highlight 350 | (add-hook 'eshell-mode-hook 351 | (lambda () (hl-line-mode 0))) 352 | 353 | ;; Eshell aliases 354 | (defalias 'open 'find-file-other-window) 355 | (defalias 'clean 'eshell/clear-scrollback) 356 | 357 | (provide 'base) 358 | ;;; base.el ends here 359 | -------------------------------------------------------------------------------- /lisp/cgpt.el: -------------------------------------------------------------------------------- 1 | (use-package chatgpt 2 | :straight (:host github :repo "joshcho/ChatGPT.el" :files ("dist" "*.el")) 3 | :init 4 | (require 'python) 5 | (setq chatgpt-repo-path "~/.emacs.d/straight/repos/ChatGPT.el/") 6 | :preface 7 | (defun chatgpt-session-expired () 8 | "Fix expired login." 9 | (interactive) 10 | (async-shell-command "pkill ms-playwright/firefox") 11 | (run-in-vterm "chatgpt install")) 12 | :config 13 | (setq chatgpt-query-format-string-map '( 14 | ;; ChatGPT.el defaults 15 | ("nil" . "%s") 16 | ("doc" . "Please write the documentation for the following function.\n\n%s") 17 | ("bug" . "There is a bug in the following function, please help me fix it.\n\n%s") 18 | ("understand" . "What does the following function do?\n\n%s") 19 | ("improve" . "Please improve the following code.\n\n%s"))) 20 | :bind ("C-c q" . chatgpt-query)) 21 | 22 | (provide 'cgpt) 23 | ;;; cgpt.el ends here 24 | -------------------------------------------------------------------------------- /lisp/copilot.el: -------------------------------------------------------------------------------- 1 | (use-package copilot 2 | :straight (:host github :repo "zerolfx/copilot.el" :files ("dist" "*.el")) 3 | :ensure t 4 | :config 5 | ;; (add-hook 'prog-mode-hook 'copilot-mode) 6 | ;; (add-hook 'tree-sitter-mode-hook 'copilot-mode) 7 | (add-hook 'typescript-mode-hook 'copilot-mode) 8 | (add-hook 'typescriptreact-mode-hook 'copilot-mode) 9 | (add-hook 'c-mode-common-hook 'copilot-mode) 10 | (add-hook 'go-mode-hook 'copilot-mode) 11 | (add-hook 'python-mode-hook 'copilot-mode) 12 | (add-hook 'js-mode-hook 'copilot-mode) 13 | (add-hook 'js2-mode-hook 'copilot-mode) 14 | 15 | (define-key copilot-completion-map (kbd "") 'copilot-accept-completion) 16 | (define-key copilot-completion-map (kbd "TAB") 'copilot-accept-completion) 17 | (defun my/copilot-tab () 18 | (interactive) 19 | (or (copilot-accept-completion) 20 | (indent-for-tab-command))) 21 | (with-eval-after-load 'copilot 22 | (evil-define-key 'insert copilot-mode-map 23 | (kbd "") #'my/copilot-tab)) 24 | ) 25 | 26 | (provide 'copilot) 27 | ;;; copilot.el ends here 28 | -------------------------------------------------------------------------------- /lisp/functions.el: -------------------------------------------------------------------------------- 1 | (defun join-path (path filename) 2 | "Concat path and file. Add '/' to the end of the path if necessary." 3 | (concat path (if (string-match-p "/$" path) "" "/") filename)) 4 | 5 | (defun load-if-exists (f) 6 | "Load file F if it exists." 7 | (if (file-exists-p (expand-file-name f)) 8 | (load-file (expand-file-name f)))) 9 | 10 | (defun enable-minor-mode (my-pair) 11 | "Enable minor mode if filename match the regexp. MY-PAIR is a cons cell (regexp . minor-mode)." 12 | (if (buffer-file-name) 13 | (if (string-match (car my-pair) buffer-file-name) 14 | (funcall (cdr my-pair))))) 15 | 16 | (defun tab-bar-enable () 17 | "Enable tab-bar with history." 18 | (interactive) 19 | (tab-bar-mode 1) 20 | ;;(tab-bar-history-mode 1) 21 | (put 'tab-bar-toggle 'state t)) 22 | 23 | (defun tab-bar-disable () 24 | "Disable tab-bar." 25 | (interactive) 26 | (tab-bar-mode -1) 27 | (put 'tab-bar-toggle 'state nil)) 28 | 29 | (defun tab-bar-toggle () 30 | "Toggle tab-bar." 31 | (interactive) 32 | (if (get 'tab-bar-toggle 'state) 33 | (tab-bar-disable) 34 | (tab-bar-enable))) 35 | 36 | (defun erc-start () 37 | "Start ERC and connect to Rizon." 38 | (interactive) 39 | (save-current-buffer 40 | (erc-services-mode 1) 41 | (erc-update-modules) 42 | (erc :server "irc.rizon.net" :port "6667" :nick erc-nick-short))) 43 | 44 | (defun erc-quit () 45 | "Quit ERC." 46 | (interactive) 47 | (erc-services-mode 0) 48 | (erc-quit-server nil)) 49 | 50 | (defun kill-async-buffers () 51 | "Kill all buffers matching '*Async Shell Command' regex." 52 | (interactive) 53 | (kill-matching-buffers "*Async Shell Command*" nil t)) 54 | 55 | (defun disable-all-themes () 56 | "Disable all active themes." 57 | (interactive) 58 | (dolist (i custom-enabled-themes) 59 | (disable-theme i))) 60 | 61 | (defun split-and-follow-horizontally () 62 | "Split and follow horizontally." 63 | (interactive) 64 | (split-window-below) 65 | ;; (balance-windows) 66 | (other-window 1)) 67 | (global-set-key (kbd "C-x 2") 'split-and-follow-horizontally) 68 | 69 | (defun split-and-follow-vertically () 70 | "Split and follow vertically." 71 | (interactive) 72 | (split-window-right) 73 | ;; (balance-windows) 74 | (other-window 1)) 75 | (global-set-key (kbd "C-x 3") 'split-and-follow-vertically) 76 | 77 | (defun run-in-vterm-kill (process event) 78 | "A process sentinel. Kill PROCESS's buffer if it is live with arg EVENT." 79 | (let ((b (process-buffer process))) 80 | (and (buffer-live-p b) 81 | (kill-buffer b)))) 82 | 83 | (defun run-in-vterm (command) 84 | "Execute string COMMAND in a new vterm. 85 | 86 | Interactively, prompt for COMMAND with the current buffer's file 87 | name supplied. When called from Dired, supply the name of the 88 | file at point. 89 | 90 | Like `async-shell-command`, but run in a vterm for full terminal features. 91 | 92 | The new vterm buffer is named in the form `*foo bar.baz*`, the 93 | command and its arguments in earmuffs. 94 | 95 | When the command terminates, the shell remains open, but when the 96 | shell exits, the buffer is killed." 97 | (interactive 98 | (list 99 | (let* ((f (cond (buffer-file-name) 100 | ((eq major-mode 'dired-mode) 101 | (dired-get-filename nil t)))) 102 | (filename (concat " " (shell-quote-argument (and f (file-relative-name f)))))) 103 | (read-shell-command "Command: ")))) 104 | (with-current-buffer (vterm (concat "*" command "*")) 105 | (set-process-sentinel vterm--process #'run-in-vterm-kill) 106 | (vterm-send-string command) 107 | (vterm-send-return))) 108 | 109 | (defun ncmpcpp () 110 | (interactive) 111 | (run-in-vterm "ncmpcpp")) 112 | 113 | (defun yank-whole-buffer () 114 | "Yank whole buffer." 115 | (interactive) 116 | (save-excursion 117 | (mark-whole-buffer) 118 | (call-interactively 'evil-yank))) 119 | 120 | (defun open-in-external-app () 121 | "Open the file(s) at point with an external application." 122 | (interactive) 123 | (let ((file-list (dired-get-marked-files))) 124 | (mapc 125 | (lambda (file-path) 126 | (let ((process-connection-type nil)) 127 | (start-process "" nil "xdg-open" file-path))) 128 | file-list))) 129 | 130 | (defun consult-file-externally (file) 131 | "Open FILE externally using the default application of the system." 132 | (interactive "fOpen externally: ") 133 | (if (and (eq system-type 'windows-nt) 134 | (fboundp 'w32-shell-execute)) 135 | (w32-shell-execute "open" file) 136 | (call-process (pcase system-type 137 | ('darwin "open") 138 | ('cygwin "cygstart") 139 | (_ "xdg-open")) 140 | nil 0 nil 141 | (expand-file-name file)))) 142 | 143 | (defun dired-open-externally (&optional arg) 144 | "Open marked or current file (ARG) in operating system's default application." 145 | (interactive "P") 146 | (dired-map-over-marks 147 | (consult-file-externally (dired-get-filename)) 148 | arg)) 149 | 150 | (defun open-treemacs () 151 | "Open treemacs." 152 | (interactive) 153 | (treemacs) 154 | (other-window 1)) 155 | 156 | (if (eq system-type 'gnu/linux) 157 | (defun config/reload () 158 | "Reload this Emacs configuration." 159 | (interactive) 160 | (load-file (concat user-emacs-directory "init.el")))) 161 | 162 | (defun config/github () 163 | "Opens this configurations GitHub website." 164 | (interactive) 165 | (browse-url "https://github.com/diamondbond/emacs")) 166 | 167 | (when (file-readable-p "~/bin/auth-backup.sh") 168 | (defun auth/backup () 169 | "Backup auth." 170 | (interactive) 171 | (async-shell-command "~/bin/auth-backup.sh"))) 172 | 173 | (when (file-readable-p "~/bin/auth-restore.sh") 174 | (defun auth/restore () 175 | "Restore auth." 176 | (interactive) 177 | (async-shell-command "~/bin/auth-restore.sh"))) 178 | 179 | (defun sync/irc () 180 | "Connect to IRC." 181 | (interactive) 182 | (erc-start) 183 | (rcirc 1)) 184 | 185 | (defun get-date () 186 | "Get date." 187 | (format-time-string "%b %d, %Y")) 188 | 189 | (defun insert-date () 190 | "Insert date." 191 | (interactive) 192 | (insert (get-date))) 193 | 194 | (defun insert-org-link-template () 195 | "Insert org link template at point." 196 | (interactive) 197 | (setq last-command-event 91) 198 | (org-self-insert-command 1) 199 | (setq last-command-event 91) 200 | (org-self-insert-command 1) 201 | (setq last-command-event 'right) 202 | (right-char 1) 203 | (setq last-command-event 91) 204 | (org-self-insert-command 1)) 205 | 206 | (defun insert-wild-notifier-template () 207 | "Insert WILD_NOTIFIER_NOTIFY_BEFORE template at point." 208 | (interactive) 209 | (insert ":PROPERTIES: 210 | :WILD_NOTIFIER_NOTIFY_BEFORE: 60 30 15 10 5 211 | :END:")) 212 | 213 | (defun insert-current-file-name-at-point (&optional full-path) 214 | "Insert the current filename at point. 215 | With prefix argument, use FULL-PATH." 216 | (interactive "P") 217 | (let* ((buffer 218 | (if (minibufferp) 219 | (window-buffer 220 | (minibuffer-selected-window)) 221 | (current-buffer))) 222 | (filename (buffer-file-name buffer))) 223 | (if filename 224 | (insert (if full-path filename (file-name-nondirectory filename))) 225 | (error (format "Buffer %s is not visiting a file" (buffer-name buffer)))))) 226 | 227 | (defun latex-spacer () 228 | "Inserts a LaTeX spacer org-export block at point." 229 | (interactive) 230 | (setq last-command-event 67108908) 231 | (org-insert-structure-template "export") 232 | (setq last-command-event 108) 233 | (org-self-insert-command 1) 234 | (setq last-command-event 97) 235 | (org-self-insert-command 1) 236 | (setq last-command-event 116) 237 | (org-self-insert-command 1) 238 | (setq last-command-event 101) 239 | (org-self-insert-command 1) 240 | (setq last-command-event 120) 241 | (org-self-insert-command 1) 242 | (setq last-command-event 13) 243 | (org-return nil nil 1) 244 | (setq last-command-event 92) 245 | (org-self-insert-command 1) 246 | (setq last-command-event 92) 247 | (org-self-insert-command 1) 248 | (setq last-command-event 126) 249 | (org-self-insert-command 1) 250 | (setq last-command-event 92) 251 | (org-self-insert-command 1)) 252 | 253 | (defun emacs-devel () 254 | "Read the Emacs-devel mailing list." 255 | (interactive) 256 | (setq last-command-event 121) 257 | (gnus nil) 258 | (setq last-command-event 121) 259 | (execute-extended-command nil "gnus" "gnus") 260 | (setq last-command-event 13) 261 | (gnus-group-browse-foreign-server 262 | `(nntp "news.gmane.io")) 263 | (setq last-command-event 13) 264 | (consult-line) 265 | (setq last-command-event 13) 266 | (gnus-browse-select-group nil)) 267 | 268 | ;; https://stackoverflow.com/questions/12014036/emacs-make-frame-switch-buffer 269 | (defun get-buffer-menu-in-new-frame () 270 | "Switch-to-buffer in new frame." 271 | (interactive) 272 | (switch-to-buffer (list-buffers-noselect))) 273 | 274 | (defun shrink-wrapped-buffer-list () 275 | "Launch frame-fitted *Buffer List*." 276 | (interactive) 277 | (switch-to-buffer (list-buffers-noselect)) 278 | (shrink-wrap)) 279 | 280 | (defun unfill-paragraph () 281 | "Unfill current paragraph." 282 | (interactive) 283 | (let ((fill-column (point-max))) 284 | (fill-paragraph nil))) 285 | 286 | (defun unfill-region () 287 | "Unfill current region." 288 | (interactive) 289 | (let ((fill-column (point-max))) 290 | (fill-region (region-beginning) (region-end) nil))) 291 | 292 | (defun next-15-lines () 293 | "Move to the next 15 lines." 294 | (interactive) 295 | (forward-line 15)) 296 | 297 | (defun previous-15-lines () 298 | "Move to the previous 15 lines." 299 | (interactive) 300 | (forward-line -15)) 301 | 302 | (defun upcase-last-word () 303 | "Convert last word to uppercase." 304 | (interactive) 305 | (move-end-of-line 1) 306 | (backward-word 1) 307 | (upcase-word 1) 308 | (move-beginning-of-line 1) 309 | (next-line 1 1)) 310 | 311 | (defun open-line-below () 312 | "Open a new line below point." 313 | (interactive) 314 | (end-of-line) 315 | (newline) 316 | (indent-for-tab-command)) 317 | 318 | (defun open-line-above () 319 | "Open a new line above point." 320 | (interactive) 321 | (beginning-of-line) 322 | (newline) 323 | (forward-line -1) 324 | (indent-for-tab-command)) 325 | 326 | (defun db/delete-current-line () 327 | "Kill the whole line on which point is." 328 | (interactive) 329 | (beginning-of-line) 330 | (kill-line 1)) 331 | 332 | (defun db/duplicate-line() 333 | "Duplicate line at point." 334 | (interactive) 335 | (save-excursion 336 | (move-beginning-of-line 1) 337 | (kill-line) 338 | (yank) 339 | (open-line 1) 340 | (forward-line 1) 341 | (yank))) 342 | 343 | ;; BIONIC reading mode by xahlee 344 | (defvar infu-bionic-reading-face nil "a face for `infu-bionic-reading-region'.") 345 | (setq infu-bionic-reading-face 'error) 346 | ;; try 347 | ;; 'bold 348 | ;; 'error 349 | ;; 'warning 350 | ;; 'highlight 351 | ;; or any value of M-x list-faces-display 352 | 353 | (defun infu-bionic-reading-buffer () 354 | "Bold the first few chars of every word in current buffer. 355 | Version 2022-05-21" 356 | (interactive) 357 | (infu-bionic-reading-region (point-min) (point-max))) 358 | 359 | (defun infu-bionic-reading-region (Begin End) 360 | "Bold the first few chars of every word in region. 361 | Version 2022-05-21" 362 | (interactive "r") 363 | (let (xBounds xWordBegin xWordEnd ) 364 | (save-restriction 365 | (narrow-to-region Begin End) 366 | (goto-char (point-min)) 367 | (while (forward-word) 368 | ;; bold the first half of the word to the left of cursor 369 | (setq xBounds (bounds-of-thing-at-point 'word)) 370 | (setq xWordBegin (car xBounds)) 371 | (setq xWordEnd (cdr xBounds)) 372 | (setq xBoldEndPos (+ xWordBegin (1+ (/ (- xWordEnd xWordBegin) 2)))) 373 | (put-text-property xWordBegin xBoldEndPos 374 | 'font-lock-face infu-bionic-reading-face))))) 375 | 376 | ;; Original idea from 377 | ;; http://www.opensubscriber.com/message/emacs-devel@gnu.org/10971693.html 378 | (defun comment-dwim-line (&optional arg) 379 | "Replacement for the comment-dwim command. 380 | If no region is selected and current line is not blank and we are not at the end of the line, 381 | then comment current line. 382 | Replaces default behaviour of comment-dwim, when it inserts comment at the end of the line." 383 | (interactive "*P") 384 | (comment-normalize-vars) 385 | (if (and (not (region-active-p)) (not (looking-at "[ \t]*$"))) 386 | (comment-or-uncomment-region (line-beginning-position) (line-end-position)) 387 | (comment-dwim arg))) 388 | 389 | ;; Convert camel to snake_case 390 | (defun camel-to-snake-case (arg) 391 | "Convert a camelCase word to snake_case. 392 | 393 | If the prefix argument ARG is non-nil, convert the text to uppercase." 394 | (interactive "p") 395 | (progn 396 | (let ((start (region-beginning)) 397 | (end (region-end)) 398 | (case-fold-search nil) 399 | (had-initial-underscore nil)) 400 | (goto-char start) 401 | (when (looking-at "_") (setq had-initial-underscore t)) 402 | (while (re-search-forward "\\([A-Z]\\)" end t) 403 | (replace-match "_\\1") 404 | (setq end (1+ end))) 405 | (if arg 406 | (upcase-region start end) 407 | (downcase-region start end)) 408 | (goto-char start) 409 | (unless had-initial-underscore (delete-char 1))))) 410 | 411 | (defun sanemacs/backward-kill-word () 412 | "Kill word backwards without littering 'kill-ring'." 413 | (interactive ) 414 | (push-mark) 415 | (backward-word) 416 | (delete-region (point) (mark))) 417 | 418 | (when (file-readable-p "~/bin/org-pdf-export") 419 | (defun org-export-pdf () 420 | "Export as pdf using eisvogel LaTeX template." 421 | (lambda) 422 | (interactive) 423 | (org-latex-export-to-latex) 424 | (async-shell-command (concat "~/bin/org-pdf-export " buffer-file-name)) 425 | (find-file (expand-file-name (concat (file-name-sans-extension buffer-file-name) ".pdf"))))) 426 | 427 | ;; Reverse video mode 428 | (defun reverse-video-mode () 429 | "Reverse video mode." 430 | (interactive) 431 | (add-to-list 'default-frame-alist '(reverse . t))) 432 | 433 | (defun remove-reverse-video-mode () 434 | "Remove 'reverse . t' from `default-frame-alist`." 435 | (interactive) 436 | (when (assq 'reverse default-frame-alist) 437 | (setq default-frame-alist (assq-delete-all 'reverse default-frame-alist)))) 438 | 439 | ;; Eshell functions 440 | (defun eshell/clear-scrollback () 441 | "Clear the scrollback content of the eshell window." 442 | (let ((inhibit-read-only t)) 443 | (erase-buffer))) 444 | 445 | (defun eshell-other-window () 446 | "Create or visit an eshell buffer." 447 | (interactive) 448 | (if (not (get-buffer "*eshell*")) 449 | (progn 450 | (split-window-sensibly (selected-window)) 451 | (other-window 1) 452 | (eshell)) 453 | (switch-to-buffer-other-window "*eshell*"))) 454 | 455 | (defun dm-wrap-region () 456 | "Wrap text region to 80 columns." 457 | (interactive) 458 | (if (use-region-p) 459 | (let ((start (region-beginning)) 460 | (end (region-end))) 461 | (save-excursion 462 | (goto-char start) 463 | (while (< (point) end) 464 | (let ((line-end (save-excursion (end-of-line) (point)))) 465 | (fill-region (point) line-end 80) 466 | (goto-char line-end)))) 467 | (message "Text wrapped to 80 columns in the selected region.")) 468 | (message "No active region. Please select a region to wrap."))) 469 | 470 | (defun vscode-mode-on () 471 | "Emulate VSCode." 472 | (interactive) 473 | (scroll-bar-mode -1) 474 | (open-treemacs) 475 | (minimap/enable)) 476 | 477 | (defun vscode-mode-off () 478 | "Become Emacs." 479 | (interactive) 480 | (scroll-bar-mode 1) 481 | (treemacs) 482 | (minimap/disable)) 483 | 484 | (defun load-theme-based-on-system-theme () 485 | "Load a theme based on GNOME dark mode preference." 486 | (interactive) 487 | (let* ((color-scheme (string-trim (shell-command-to-string "gsettings get org.gnome.desktop.interface color-scheme"))) 488 | (dark-mode (string-equal color-scheme "'prefer-dark'"))) 489 | (if dark-mode 490 | (modus-themes-select 'modus-vivendi) 491 | (modus-themes-select 'modus-operandi)))) 492 | 493 | (provide 'functions) 494 | ;;; functions.el ends here 495 | -------------------------------------------------------------------------------- /lisp/gpt.el: -------------------------------------------------------------------------------- 1 | (use-package gptel 2 | :straight (:host github :repo "karthink/gptel") 3 | :config 4 | ;; Define backends for Llama and Dolphin models 5 | (setq-default 6 | gptel-backend-llama (gptel-make-ollama 7 | "Ollama" 8 | :host "localhost:11434" 9 | :models '("llama3.1:latest") 10 | :stream t) 11 | gptel-backend-llama32 (gptel-make-ollama 12 | "Ollama 32" 13 | :host "localhost:11434" 14 | :models '("llama3.2:latest") 15 | :stream t) 16 | gptel-backend-mistral-nemo (gptel-make-ollama 17 | "Mistral Nemo" 18 | :host "localhost:11434" 19 | :models '("mistral-nemo:latest") 20 | :stream t) 21 | gptel-backend-codeqwen (gptel-make-ollama 22 | "Codeqwen" 23 | :host "localhost:11434" 24 | :models '("codeqwen:latest") 25 | :stream t) 26 | gptel-backend-deepseek-coder-v2 (gptel-make-ollama 27 | "Deepseek Coder v2" 28 | :host "localhost:11434" 29 | :models '("deepseek-coder-v2:latest") 30 | :stream t) 31 | gptel-backend-dolphin (gptel-make-ollama 32 | "Dolphin" 33 | :host "localhost:11434" 34 | :models '("dolphin-llama3:8b") 35 | :stream t)) 36 | 37 | ;; Set Directives 38 | (setq gptel-directives 39 | '((default . "You are a large language model and a helpful assistant. Respond concisely.") 40 | (reflect . "You are a world-class AI system, capable of complex reasoning and reflection. Reason through the query inside tags, and then provide your final response inside tags. If you detect that you made a mistake in your reasoning at any point, correct yourself inside tags.") 41 | (emacs . "You are a large language model living in Emacs and a helpful assistant. Respond concisely.") 42 | (programming . "You are a large language model and a careful programmer. Provide code and only code as output without any additional text, prompt or note.") 43 | (typescript . "You are an expert Typescript programmer. Provide code as output.") 44 | (writing . "You are a large language model and a writing assistant. Respond concisely.") 45 | (chat . "You are a large language model and a conversation partner. Respond concisely."))) 46 | 47 | ;; Function to switch between models interactively 48 | (defun gptel-set-model (model) 49 | "Set the gptel model to MODEL interactively." 50 | (interactive 51 | (list (completing-read "Choose model: " '("llama" "llama32" "mistral-nemo" "codeqwen" "deepseek-coder-v2" "dolphin")))) 52 | (setq gptel-backend 53 | (cond 54 | ((string= model "llama") gptel-backend-llama) 55 | ((string= model "llama32") gptel-backend-llama32) 56 | ((string= model "mistral-nemo") gptel-backend-mistral-nemo) 57 | ((string= model "codeqwen") gptel-backend-codeqwen) 58 | ((string= model "deepseek-coder-v2") gptel-backend-deepseek-coder-v2) 59 | ((string= model "dolphin") gptel-backend-dolphin) 60 | (t (error "Unknown model: %s" model)))) 61 | (setq gptel-model model) 62 | (message "GPTel model set to: %s" model)) 63 | 64 | ;; Default to Llama model 65 | (gptel-set-model "llama") 66 | 67 | ;; Add post-response hook 68 | (add-hook 'gptel-post-response-hook 'gptel-end-of-response) 69 | 70 | ;; Define a keybinding for quickly switching models 71 | (global-set-key (kbd "C-c g M") 'gptel-set-model) 72 | (global-set-key (kbd "C-c g m") 'gptel-menu) 73 | 74 | ;; Optionally, you can define keybindings for quick model switching 75 | (defun gptel-use-llama () 76 | "Quickly switch to Llama model." 77 | (interactive) 78 | (gptel-set-model "llama")) 79 | 80 | (defun gptel-use-llama32 () 81 | "Quickly switch to Llama 3.2 model." 82 | (interactive) 83 | (gptel-set-model "llama32")) 84 | 85 | (defun gptel-use-mistral () 86 | "Quickly switch to Mistral model." 87 | (interactive) 88 | (gptel-set-model "mistral-nemo")) 89 | 90 | (defun gptel-use-codeqwen () 91 | "Quickly switch to Codeqwen model." 92 | (interactive) 93 | (gptel-set-model "codeqwen")) 94 | 95 | (defun gptel-use-deepseek-coder () 96 | "Quickly switch to Deepseek Coder model." 97 | (interactive) 98 | (gptel-set-model "deepseek-coder-v2")) 99 | 100 | (defun gptel-use-dolphin () 101 | "Quickly switch to Dolphin model." 102 | (interactive) 103 | (gptel-set-model "dolphin")) 104 | 105 | (global-set-key (kbd "C-c g c") 'gptel) 106 | (global-set-key (kbd "C-c g l") 'gptel-use-llama) 107 | (global-set-key (kbd "C-c g L") 'gptel-use-llama32) 108 | (global-set-key (kbd "C-c g q") 'gptel-use-codeqwen) 109 | (global-set-key (kbd "C-c g d") 'gptel-use-deepseek-coder) 110 | (global-set-key (kbd "C-c g n") 'gptel-use-mistral) 111 | (global-set-key (kbd "C-c g D") 'gptel-use-dolphin) 112 | 113 | (setq gptel-prompt-prefix-alist '())) 114 | 115 | (provide 'gpt) 116 | ;;; gpt.el ends here 117 | -------------------------------------------------------------------------------- /lisp/jira.el: -------------------------------------------------------------------------------- 1 | (use-package ejira 2 | :straight (:type git :host github :repo "nyyManni/ejira" :branch "master") 3 | :defer 2 4 | :init 5 | (setq jiralib2-url "https://sallypos.atlassian.net" 6 | jiralib2-auth 'token 7 | jiralib2-user-login-name "diamondbond1@gmail.com" 8 | 9 | ;; NOTE, this directory needs to be in `org-agenda-files'` 10 | ejira-org-directory "~/org/jira" 11 | ejira-projects '("SP") 12 | 13 | ejira-priorities-alist '(("Highest" . ?A) 14 | ("High" . ?B) 15 | ("Medium" . ?C) 16 | ("Low" . ?D) 17 | ("Lowest" . ?E)) 18 | ejira-todo-states-alist '(("To Do" . 1) 19 | ("In Progress" . 2) 20 | ("CODE REVIEW" . 3) 21 | ("Done" . 4))) 22 | ;; Load jira token 23 | (when (file-readable-p "~/org/jira/jiralib2-token.el") 24 | (load-file "~/org/jira/jiralib2-token.el")) 25 | :config 26 | ;; Tries to auto-set custom fields by looking into /editmeta 27 | ;; of an issue and an epic. 28 | (add-hook 'jiralib2-post-login-hook #'ejira-guess-epic-sprint-fields) 29 | 30 | ;; They can also be set manually if autoconfigure is not used. 31 | ;; (setq ejira-sprint-field 'customfield_10001 32 | ;; ejira-epic-field 'customfield_10002 33 | ;; ejira-epic-summary-field 'customfield_10004) 34 | 35 | (require 'ejira-agenda) 36 | 37 | ;; Make the issues visisble in your agenda by adding `ejira-org-directory' 38 | ;; into your `org-agenda-files'. 39 | (add-to-list 'org-agenda-files ejira-org-directory) 40 | 41 | ;; Add an agenda view to browse the issues that 42 | (org-add-agenda-custom-command 43 | '("j" "My JIRA issues" 44 | ((ejira-jql "resolution = unresolved and assignee = currentUser()" 45 | ((org-agenda-overriding-header "Assigned to me"))))))) 46 | 47 | (use-package jira-markup-mode 48 | :straight t 49 | :defer 6) 50 | 51 | (provide 'jira) 52 | ;;; jira.el ends here 53 | -------------------------------------------------------------------------------- /lisp/keybinds.el: -------------------------------------------------------------------------------- 1 | (define-prefix-command 'z-map) 2 | (global-set-key (kbd "C-1") 'z-map) 3 | 4 | ;; 5 | ;; PRIVATE 6 | ;; 7 | 8 | ;; general 9 | (define-key z-map (kbd "a") 'org-agenda) 10 | (define-key z-map (kbd "f") 'find-file-other-frame) 11 | (define-key z-map (kbd "g") 'golden-ratio) 12 | (define-key z-map (kbd "o") 'olivetti-mode) 13 | (define-key z-map (kbd "r") 'recentf-edit-list) 14 | (define-key z-map (kbd "m") 'magit-status) 15 | (define-key z-map (kbd "w") 'eww) 16 | (define-key z-map (kbd "k") 'tab-bar-toggle) 17 | (define-key z-map (kbd "l") 'minimap/toggle) 18 | (define-key z-map (kbd "h") 'open-treemacs) 19 | (define-key z-map (kbd "2") 'make-frame-command) 20 | 21 | ;; os-specific 22 | (if (eq system-type 'gnu/linux) 23 | (define-key z-map (kbd "v") 'vterm)) 24 | (if (eq system-type 'windows-nt) 25 | (define-key z-map (kbd "v") 'eshell)) 26 | 27 | ;; modeline 28 | (define-key z-map (kbd "B") 'display-battery-mode) 29 | (define-key z-map (kbd "T") 'display-time-mode) 30 | 31 | ;; functions 32 | ;; (define-key z-map (kbd "M") 'mu4e) 33 | (define-key z-map (kbd "D") 'dashboard-refresh-buffer) 34 | ;; (define-key z-map (kbd "D") 'scratch-buffer) 35 | (define-key z-map (kbd "L") 'minimap/refresh) 36 | (define-key z-map (kbd "*") 'quick-calc) 37 | (define-key z-map (kbd "O") 'org-redisplay-inline-images) 38 | (define-key z-map (kbd "G") 'org-mark-ring-goto) 39 | (define-key z-map (kbd "H") 'global-hl-line-mode) 40 | (define-key z-map (kbd "s") 'ispell-word) 41 | (define-key z-map (kbd "W") 'elfeed) 42 | (define-key z-map (kbd "F") 'follow-mode) 43 | (define-key z-map (kbd "U") 'undo-redo) 44 | (define-key z-map (kbd "i") 'consult-imenu) 45 | (define-key z-map (kbd "p") 'prettier-js) 46 | 47 | ;; quick 48 | (define-key z-map (kbd "x") 'switch-to-buffer-other-frame) 49 | (define-key z-map (kbd "k") 'compile) 50 | (define-key z-map (kbd "e") 'eval-region) 51 | (define-key z-map (kbd "b") 'browse-url) 52 | 53 | ;; auxiliary 54 | (define-key z-map (kbd "S") 'speedbar-frame-mode) 55 | (define-key z-map (kbd "2") 'consult-buffer-other-frame) 56 | (define-key z-map (kbd "C-c") 'calendar) 57 | (define-key z-map (kbd "C-d") 'dired-other-frame) 58 | (define-key z-map (kbd "C-1") 'display-buffer-other-frame) 59 | (define-key z-map (kbd "1") 'vscode-mode-on) 60 | (define-key z-map (kbd "0") 'vscode-mode-off) 61 | 62 | ;; calendar 63 | (define-key z-map (kbd ".") 'org-date-from-calendar) 64 | 65 | ;; files 66 | (define-key z-map (kbd "n") 'notes-edit) 67 | (define-key z-map (kbd "c") 'init-edit) 68 | (define-key z-map (kbd "I") 'inbox-edit) 69 | (define-key z-map (kbd "t") 'tasks-edit) 70 | 71 | ;; 72 | ;; GLOBAL 73 | ;; 74 | 75 | ;; function 76 | (global-set-key (kbd "S-") 'load-theme-based-on-system-theme) 77 | (global-set-key (kbd "") 'revert-buffer) 78 | (global-set-key (kbd "") 'menu-bar-mode) 79 | (global-set-key (kbd "") 'scroll-bar-mode) 80 | (global-set-key (kbd "") 'tool-bar-mode) 81 | (global-set-key (kbd "") 'compile) 82 | ;; (global-set-key (kbd "S-") 'open-treemacs) 83 | (global-set-key (kbd "S-") 'other-frame) 84 | (global-set-key (kbd "") 'tab-bar-toggle) 85 | (global-set-key (kbd "S-") 'toggle-frame-tab-bar) 86 | (global-set-key (kbd "S-") 'display-line-numbers-mode) 87 | (global-set-key (kbd "s-b") 'switch-to-buffer) 88 | (global-set-key (kbd "C-`") 'vterm-toggle) 89 | (global-set-key (kbd "C-/") 'comment-or-uncomment-region) 90 | (global-set-key (kbd "C-S-b") 'open-treemacs) 91 | (global-set-key (kbd "C-S-m") 'minimap/toggle) 92 | (global-set-key (kbd "C-c t t") 'open-treemacs) 93 | (global-set-key (kbd "C-c t m") 'minimap/toggle) 94 | (global-set-key (kbd "C-S-SPC") 'pop-to-mark-command) 95 | (global-set-key (kbd "C-S-i") 'prettier-js) 96 | 97 | ;; windows 98 | (global-set-key (kbd "C-x w") 'elfeed) 99 | (global-set-key (kbd "C-x W") 'elfeed-update) 100 | (global-set-key (kbd "C-x x") 'window-swap-states) 101 | (global-set-key (kbd "") 'eshell-other-window) 102 | (global-set-key (kbd "C-x C-b") #'ibuffer-list-buffers) 103 | 104 | ;; window resizing 105 | (global-set-key (kbd "s-C-") 'enlarge-window) 106 | (global-set-key (kbd "s-C-") 'shrink-window) 107 | (global-set-key (kbd "s-C-") 'shrink-window-horizontally) 108 | (global-set-key (kbd "s-C-") 'enlarge-window-horizontally) 109 | 110 | ;; hjkl 111 | (global-set-key (kbd "s-C-k") 'enlarge-window) 112 | (global-set-key (kbd "s-C-j") 'shrink-window) 113 | (global-set-key (kbd "s-C-h") 'shrink-window-horizontally) 114 | (global-set-key (kbd "s-C-l") 'enlarge-window-horizontally) 115 | 116 | ;; windmove 117 | (global-set-key (kbd "s-k") 'windmove-up) 118 | (global-set-key (kbd "s-j") 'windmove-down) 119 | (global-set-key (kbd "s-h") 'windmove-left) 120 | (global-set-key (kbd "s-l") 'windmove-right) 121 | 122 | (global-set-key (kbd "s-K") 'windmove-swap-states-up) 123 | (global-set-key (kbd "s-J") 'windmove-swap-states-down) 124 | (global-set-key (kbd "s-H") 'windmove-swap-states-left) 125 | (global-set-key (kbd "s-L") 'windmove-swap-states-right) 126 | 127 | (global-set-key (kbd "M-s-") 'windmove-left) 128 | (global-set-key (kbd "M-s-") 'windmove-right) 129 | (global-set-key (kbd "M-s-") 'windmove-up) 130 | (global-set-key (kbd "M-s-") 'windmove-down) 131 | 132 | (global-set-key (kbd "M-S-s-") 'windmove-swap-states-left) 133 | (global-set-key (kbd "M-S-s-") 'windmove-swap-states-right) 134 | (global-set-key (kbd "M-S-s-") 'windmove-swap-states-up) 135 | (global-set-key (kbd "M-S-s-") 'windmove-swap-states-down) 136 | 137 | (global-set-key (kbd "M-o") #'other-window) 138 | (global-set-key (kbd "M-O") #'other-frame) 139 | 140 | ;; next/prev 141 | ;; (global-set-key (kbd "C-") 'next-buffer) 142 | ;; (global-set-key (kbd "C-") 'previous-buffer) 143 | ;;(global-set-key (kbd "C-") 'tab-next) 144 | (define-key global-map (kbd "C-S-n") #'next-15-lines) 145 | (define-key global-map (kbd "C-S-p") #'previous-15-lines) 146 | 147 | ;; mouse 148 | (global-set-key (kbd "") 'previous-buffer) 149 | (global-set-key (kbd "") 'next-buffer) 150 | 151 | ;; indent/de-indent selection by one tab length 152 | (global-set-key (kbd "C->") 'indent-rigidly-right-to-tab-stop) 153 | (global-set-key (kbd "C-<") 'indent-rigidly-left-to-tab-stop) 154 | 155 | ;; kill word without copying it to your clipboard 156 | (global-set-key (kbd "M-DEL") 'sanemacs/backward-kill-word) 157 | (global-set-key (kbd "C-DEL") 'sanemacs/backward-kill-word) 158 | 159 | (provide 'keybinds) 160 | ;;; keybinds.el ends here 161 | -------------------------------------------------------------------------------- /lisp/languages.el: -------------------------------------------------------------------------------- 1 | (use-package lsp-mode 2 | :straight t 3 | :custom 4 | (lsp-completion-provider :none) ;; we use Corfu! 5 | :init 6 | ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l") 7 | (setq lsp-keymap-prefix "C-c l") 8 | (defun my/lsp-mode-setup-completion () 9 | (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults)) 10 | '(orderless))) ;; Configure orderless 11 | :hook ((c-mode ; clangd 12 | c++-mode ; clangd 13 | c-or-c++-mode ; clangd 14 | js2-mode ; ts-ls (tsserver wrapper) 15 | js-mode ; ts-ls (tsserver wrapper) 16 | rjsx-mode ; ts-ls (tsserver wrapper) 17 | js-jsx-mode ; ts-ls (tsserver wrapper) 18 | typescript-mode ; ts-ls (tsserver wrapper) 19 | ;; python-mode ; pyright 20 | rust-mode ; rust-analyzer 21 | ruby-mode ; solargraph 22 | web-mode ; ts-ls/HTML/CSS 23 | clojure-mode ; clojure 24 | clojurescript-mode ; clojurescript 25 | clojurec-mode ; clojurec 26 | ) . lsp-deferred) 27 | ((lsp-completion-mode . my/lsp-mode-setup-completion)) 28 | ((lsp-mode . lsp-enable-which-key-integration)) 29 | :commands (lsp lsp-deferred) 30 | :config 31 | (setq lsp-auto-guess-root t) 32 | (setq lsp-log-io nil) 33 | (setq lsp-restart 'auto-restart) 34 | (setq lsp-ui-sideline-show-diagnostics nil) 35 | (setq lsp-ui-sideline-show-hover nil) 36 | (setq lsp-ui-sideline-show-code-actions nil) 37 | (setq lsp-enable-symbol-highlighting nil) 38 | (setq lsp-enable-indentation nil) 39 | (setq lsp-enable-on-type-formatting nil) 40 | (setq lsp-signature-auto-activate nil) 41 | (setq lsp-signature-render-documentation nil) 42 | (setq lsp-eldoc-hook nil) 43 | (setq lsp-modeline-code-actions-enable nil) 44 | (setq lsp-modeline-diagnostics-enable nil) 45 | (setq lsp-headerline-breadcrumb-enable nil) 46 | (setq lsp-semantic-tokens-enable nil) 47 | (setq lsp-enable-folding nil) 48 | (setq lsp-enable-imenu nil) 49 | (setq lsp-enable-snippet nil) 50 | (setq lsp-enable-completion-at-point t) 51 | ;;(setq read-process-output-max (* 1024 1024)) ;; 1MB 52 | ;; (setq completion-styles '(orderless) 53 | ;; completion-category-defaults nil) 54 | (setq lsp-idle-delay 0.5) 55 | (setq lsp-clients-typescript-server "typescript-language-server" 56 | lsp-clients-typescript-server-args '("--stdio")) 57 | (setq lsp-disabled-clients '(eslint))) 58 | 59 | (use-package lsp-ui 60 | :straight t 61 | :after lsp 62 | :commands lsp-ui-mode 63 | :config 64 | (setq lsp-ui-doc-enable nil) 65 | (setq lsp-ui-doc-header t) 66 | (setq lsp-ui-doc-include-signature t) 67 | (setq lsp-ui-doc-border (face-foreground 'default)) 68 | (setq lsp-ui-sideline-show-code-actions t) 69 | (setq lsp-ui-sideline-delay 0.05)) 70 | 71 | ;; (use-package lsp-pyright 72 | ;; :straight t 73 | ;; :after lsp 74 | ;; :hook (python-mode . (lambda () (require 'lsp-pyright) (lsp-deferred))) 75 | ;; :init (setq lsp-pyright-python-executable-cmd "python3")) 76 | 77 | ;; LSP Tailwind-CSS 78 | ;; (straight-use-package 79 | ;; '(lsp-tailwindcss :type git :host github :repo "merrickluo/lsp-tailwindcss")) 80 | 81 | ;; (use-package lsp-bridge 82 | ;; :straight (:type git :host github :repo "manateelazycat/lsp-bridge" :branch "master") 83 | ;; :files (:defaults ".py .tsx .js .cpp .c" "langserver" "acm") 84 | ;; :init 85 | ;; (global-lsp-bridge-mode)) 86 | 87 | ;; YaSnippet 88 | ;; (use-package yasnippet 89 | ;; :straight t 90 | ;; :diminish yas-minor-mode 91 | ;; :config 92 | ;; ;;(setq yas-snippet-dirs '("~/emacs.d/snippets/")) 93 | ;; (yas-reload-all)) 94 | 95 | ;; (use-package yasnippet-snippets 96 | ;; :defer 4 97 | ;; :straight t) 98 | 99 | ;; (use-package auto-yasnippet 100 | ;; :disabled t) 101 | 102 | ;; Eglot 103 | ;; (use-package eglot 104 | ;; :disabled t 105 | ;; :config 106 | ;; (setq read-process-output-max (* 1024 1024)) 107 | ;; (push :documentHighlightProvider eglot-ignored-server-capabilities) 108 | ;; ;; Enable LSP support by default in programming buffers 109 | ;; (add-hook 'prog-mode-hook #'eglot-ensure)) 110 | 111 | ;; C/C++ 112 | (use-package ccls 113 | :straight t 114 | :hook ((c-mode c++-mode objc-mode cuda-mode) . 115 | (lambda () (require 'ccls) (lsp)))) 116 | 117 | (use-package modern-cpp-font-lock 118 | :straight t 119 | :hook 120 | ((c++-mode) . #'modern-c++-font-lock-mode)) 121 | 122 | ;;; cmake-font-lock 123 | ;; Better syntax highlighting for CMake scripts. 124 | ;; https://github.com/Lindydancer/cmake-font-lock 125 | (use-package cmake-font-lock 126 | :defer t) 127 | 128 | ;; astyle formatter function 129 | (defun astyle-buffer (&optional justify) 130 | "Format buffer using astyle --style=kr." 131 | (interactive) 132 | (let ((saved-line-number (line-number-at-pos))) 133 | (shell-command-on-region 134 | (point-min) 135 | (point-max) 136 | "astyle --style=kr" 137 | nil 138 | t) 139 | (goto-line saved-line-number))) 140 | 141 | ;; C# 142 | (use-package csharp-mode 143 | :disabled t 144 | :defer 5) 145 | 146 | ;; Go 147 | (use-package go-mode 148 | :straight t 149 | :mode "\\.go\\'" 150 | :config 151 | (defun db/go-mode-hook() 152 | (setq tab-width 2) 153 | (add-hook 'before-save-hook 'gofmt-before-save) 154 | (set (make-local-variable 'compile-command) 155 | "go test")) 156 | :hook ((go-mode . lsp-deferred)) 157 | :hook ((go-mode . db/go-mode-hook)) 158 | :hook ((go-mode . subword-mode))) 159 | 160 | ;; Rust 161 | (use-package rust-mode 162 | :straight t 163 | :mode "\\.rs\\'" 164 | :init (setq rust-format-on-save t)) 165 | 166 | (use-package cargo 167 | :straight t 168 | :defer 3) 169 | 170 | (use-package rustic 171 | :disabled t 172 | :config 173 | (setq rustic-format-on-save nil)) 174 | 175 | ;; Elisp 176 | (use-package elisp-autofmt 177 | :straight t 178 | :commands (elisp-autofmt-mode elisp-autofmt-buffer)) 179 | 180 | ;; CL 181 | (use-package slime 182 | :straight t 183 | :config 184 | (setq inferior-lisp-program "/usr/bin/sbcl") 185 | (setq slime-contribs '(slime-fancy slime-quicklisp))) 186 | 187 | ;; Scheme 188 | (use-package geiser 189 | :straight t 190 | :config 191 | (setq geiser-active-implementations '(mit guile)) 192 | (setq geiser-mit-binary "/usr/bin/mit-scheme") 193 | (setq geiser-default-implementation 'mit) 194 | (add-hook 'scheme-mode-hook 'geiser-mode) 195 | (add-to-list 'auto-mode-alist 196 | '("\\.sls\\'" . scheme-mode) 197 | '("\\.sc\\'" . scheme-mode))) 198 | 199 | ;; MIT Scheme 200 | (use-package geiser-mit 201 | :straight t 202 | :after geiser) 203 | 204 | (defun geiser-save () 205 | "Save geiser repl contents to input ring." 206 | (interactive) 207 | (geiser-repl--write-input-ring)) 208 | 209 | ;; SICP 210 | (use-package sicp 211 | :straight t) 212 | 213 | ;; GOAL 214 | (define-derived-mode goal-mode lisp-mode 215 | "GOAL") 216 | ;; make gc files use our derived mode 217 | (add-to-list 'auto-mode-alist '("\\.gc?\\'" . goal-mode)) 218 | ;; run setup-goal when we enter lisp mode 219 | (add-hook 'goal-mode-hook 'setup-goal) 220 | (defun setup-goal () 221 | ;; if we are in a gc file, change indent settings for GOAL 222 | (when (and (stringp buffer-file-name) 223 | (string-match "\\.gc\\'" buffer-file-name)) 224 | (put 'with-pp 'common-lisp-indent-function 0) 225 | (put 'while 'common-lisp-indent-function 1) 226 | (put 'rlet 'common-lisp-indent-function 1) 227 | (put 'until 'common-lisp-indent-function 1) 228 | (put 'countdown 'common-lisp-indent-function 1) 229 | (put 'defun-debug 'common-lisp-indent-function 2) 230 | (put 'defenum 'common-lisp-indent-function 2) 231 | 232 | ;; disable slime 233 | (slime-mode -1) 234 | 235 | ;; indent for common lisp, this makes if's look nicer 236 | (custom-set-variables '(lisp-indent-function 'common-lisp-indent-function)) 237 | (autoload 'common-lisp-indent-function "cl-indent" "Common Lisp indent.") 238 | ;; use spaces, not tabs 239 | (setq-default indent-tabs-mode nil))) 240 | 241 | ;; JSON 242 | (use-package json-mode 243 | :straight t 244 | :mode ("\\.json\\'" . json-mode)) 245 | 246 | ;; CSV 247 | (use-package csv-mode 248 | :straight t 249 | :mode ("\\.csv\\'" . csv-mode)) 250 | 251 | ;; LUA 252 | (use-package lua-mode 253 | :straight t 254 | :config 255 | (setq lua-indent-level 2)) 256 | 257 | ;; Ruby 258 | (use-package ruby-mode 259 | :defer 4 260 | :straight t) 261 | 262 | ;; Python 263 | ;; (use-package python-mode 264 | ;; :straight t 265 | ;; :config 266 | ;; (setq python-indent-offset standard-indent) 267 | ;; (setq python-indent-guess-indent-offset t) 268 | ;; (setq python-indent-guess-indent-offset-verbose nil) 269 | ;; (setq python-shell-interpreter "/usr/bin/python3") 270 | ;; (setq exec-path (cons "~/.local/bin" exec-path))) 271 | 272 | ;; Python env management 273 | ;; (use-package pyvenv 274 | ;; :straight t 275 | ;; :config 276 | ;; (setq pyvenv-workon "emacs") ; Default venv 277 | ;; (pyvenv-tracking-mode 1)) ; Automatically use pyvenv-workon via dir-locals 278 | 279 | ;; Python formatter 280 | (use-package python-black 281 | :straight t 282 | :after python) 283 | 284 | ;; Wolfram Mathematica 285 | ;; (use-package xah-wolfram-mode 286 | ;; :straight (:type git :host github :repo "xahlee/xah-wolfram-mode" :branch "master")) 287 | 288 | ;; Markdown 289 | (use-package markdown-mode 290 | :straight t 291 | :mode "\\.md\\'" 292 | :hook ((markdown-mode . auto-fill-mode))) 293 | 294 | ;; FlyCheck 295 | (use-package flycheck 296 | :straight t 297 | :bind (:map flycheck-mode-map 298 | ("C-c n" . flycheck-next-error) 299 | ("C-c p" . flycheck-previous-error))) 300 | ;; JavaScript 301 | (use-package js-mode 302 | :straight (:type built-in) 303 | :init 304 | (with-eval-after-load 'subword 305 | (diminish 'subword-mode)) 306 | (add-hook 'js-mode-hook 'subword-mode) 307 | :mode (("\\.js\\'" . js-mode))) 308 | 309 | (use-package js2-mode 310 | :straight t 311 | :diminish (js2-mode js2-minor-mode) 312 | :custom 313 | (js-indent-level 2) 314 | (js2-basic-offset 2) 315 | :config 316 | (setq js2-strict-missing-semi-warning nil) 317 | (setq js2-mode-show-strict-warnings nil) 318 | ;; override js2-error 319 | (custom-set-faces 320 | '(js2-error ((t (:foreground unspecified :weight normal))))) 321 | ;; just for JS linting 322 | (add-hook 'js-mode-hook 'js2-minor-mode)) 323 | ;;:mode (("\\.js\\'" . js2-mode))) 324 | 325 | (defun setup-tide-mode () 326 | (interactive) 327 | (tide-setup) 328 | (subword-mode 1) 329 | (flycheck-mode +1) 330 | (setq flycheck-check-syntax-automatically '(save)) 331 | (eldoc-mode +1) 332 | (diminish 'subword-mode "") 333 | (tide-hl-identifier-mode +1)) 334 | 335 | ;; React JS 336 | (use-package rjsx-mode 337 | :disabled t) 338 | 339 | ;; Tree-sitter 340 | (use-package tree-sitter 341 | :straight t 342 | :diminish (tree-sitter-mode) 343 | :config 344 | ;; activate tree-sitter on any buffer containing code for which it has a parser available 345 | (global-tree-sitter-mode) 346 | ;; toggle tree-sitter-debug-mode with `C-c t d` 347 | (global-set-key (kbd "C-c t d") 'tree-sitter-debug-mode) 348 | ;; you can easily see the difference tree-sitter-hl-mode makes for python, ts or tsx 349 | ;; by switching on and off 350 | ;; deepen tree-sitter's reach 351 | (setq treesit-font-lock-level 4) 352 | (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)) 353 | 354 | (use-package tree-sitter-langs 355 | :straight t 356 | :after tree-sitter) 357 | 358 | ;; great tree-sitter-based indentation for typescript/tsx, css, json 359 | (use-package tsi 360 | :after tree-sitter 361 | :straight (:type git :host github :repo "orzechowskid/tsi.el") 362 | ;; define autoload definitions which when actually invoked will cause package to be loaded 363 | :commands (tsi-typescript-mode tsi-json-mode tsi-css-mode) 364 | :init 365 | (add-hook 'typescript-mode-hook (lambda () (tsi-typescript-mode 1))) 366 | (add-hook 'json-mode-hook (lambda () (tsi-json-mode 1))) 367 | (add-hook 'css-mode-hook (lambda () (tsi-css-mode 1))) 368 | (add-hook 'scss-mode-hook (lambda () (tsi-scss-mode 1)))) 369 | 370 | ;; TypeScript 371 | (use-package typescript-mode 372 | :after tree-sitter 373 | :straight t 374 | :config 375 | (define-derived-mode typescriptreact-mode typescript-mode 376 | "TSX") 377 | 378 | ;; use our derived mode for tsx files 379 | (add-to-list 'auto-mode-alist '("\\.tsx?\\'" . typescriptreact-mode)) 380 | ;; by default, typescript-mode is mapped to the treesitter typescript parser 381 | ;; use our derived mode to map both .tsx AND .ts -> typescriptreact-mode -> treesitter tsx 382 | (add-to-list 'tree-sitter-major-mode-language-alist '(typescriptreact-mode . tsx)) 383 | (add-hook 'typescriptreact-mode-hook #'setup-tide-mode)) 384 | 385 | ;; load ts-repl with ts-mode 386 | ;;(with-eval-after-load "typescript-mode" 387 | ;;(require 'ts-repl))) 388 | ;;(flycheck-add-next-checker 'typescript-tide 'javascript-eslint) 389 | ;; :mode (("\\.ts\\'" . typescript-mode) 390 | ;; ("\\.tsx\\'" . typescript-mode))) 391 | 392 | ;; TypeScript IDE 393 | (use-package tide 394 | :straight t 395 | :config 396 | (add-hook 'typescript-mode-hook #'setup-tide-mode) 397 | (define-key evil-normal-state-map (kbd "M-.") 'tide-jump-to-definition)) 398 | 399 | ;; Add node_modules to PATH 400 | (use-package add-node-modules-path 401 | :straight t 402 | :hook ((typescript-mode . add-node-modules-path))) 403 | 404 | ;; Prettier formatter 405 | (use-package prettier-js 406 | :after (typescript-mode) 407 | :straight t) 408 | ;; :config 409 | ;; (add-hook 'web-mode-hook #'(lambda () 410 | ;; (enable-minor-mode 411 | ;; '("\\.jsx?\\'" . prettier-js-mode)) 412 | ;; (enable-minor-mode 413 | ;; '("\\.tsx?\\'" . prettier-js-mode))))) 414 | 415 | ;; Web mode (HTML) 416 | (use-package web-mode 417 | :straight t 418 | :config 419 | (setq web-mode-content-types-alist '(;;("jsx" . "\\.[jt]sx?\\'") 420 | ("html" . "\\.html\\'"))) 421 | (setq web-mode-markup-indent-offset 2) 422 | (setq web-mode-css-indent-offset 2) 423 | (setq web-mode-code-indent-offset 2) 424 | (setq web-mode-script-padding 2) 425 | (setq web-mode-block-padding 2) 426 | (setq web-mode-style-padding 2) 427 | (setq web-mode-enable-auto-pairing t) 428 | (setq web-mode-enable-auto-closing t) 429 | (setq web-mode-enable-current-element-highlight t) 430 | 431 | ;; adjust web-mode indent 432 | (defun web-mode-init-hook () 433 | "Hooks for Web mode. Adjust indent." 434 | (setq web-mode-markup-indent-offset 4)) 435 | (add-hook 'web-mode-hook 'web-mode-init-hook) 436 | 437 | ;; disable other js linters 438 | (setq-default flycheck-disabled-checkers 439 | (append flycheck-disabled-checkers 440 | '(javascript-jshint json-jsonlist))) 441 | ;; enable eslint 442 | (flycheck-add-mode 'javascript-eslint 'web-mode) 443 | :mode (;;("\\.js\\'" . web-mode) 444 | ;;("\\.jsx\\'" . web-mode) 445 | ;;("\\.ts\\'" . web-mode) 446 | ;;("\\.tsx\\'" . web-mode) 447 | ("\\.html\\'" . web-mode)) 448 | :commands web-mode) 449 | 450 | ;; Java 451 | (use-package lsp-java 452 | :disabled t 453 | :init 454 | (setq lsp-java-vmargs 455 | (list 456 | "-noverify" 457 | "-Xmx3G" 458 | "-XX:+UseG1GC" 459 | "-XX:+UseStringDeduplication" 460 | ) 461 | 462 | ;; Don't organise imports on save 463 | lsp-java-save-action-organize-imports nil 464 | 465 | ;; Fetch less results from the Eclipse server 466 | lsp-java-completion-max-results 30 467 | 468 | ;; Download 3rd party sources from Maven repo 469 | lsp-java-maven-download-sources t 470 | 471 | ;; Don't format my source code (I use Maven for enforcing my 472 | ;; coding style) 473 | lsp-java-format-enabled nil) 474 | :config 475 | (add-hook 'java-mode-hook #'lsp)) 476 | 477 | ;; Debug Adapter Protocol 478 | (use-package dap-mode 479 | :disabled t 480 | ;;:after lsp-mode 481 | :config 482 | (dap-auto-configure-mode) 483 | (setq dap-ui-locals-expand-depth 3) 484 | (dap-ui-mode t) 485 | (dap-tooltip-mode 1) 486 | (tooltip-mode 1)) 487 | 488 | ;; Clojure 489 | (use-package clojure-mode 490 | :defer 3 491 | :straight t) 492 | 493 | (use-package cider 494 | :straight t 495 | :defer 3 496 | :config 497 | (setq cider-repl-result-prefix "λ" 498 | cider-eval-result-prefix "" 499 | cider-connection-message-fn nil ; cute, but no! 500 | cider-use-overlays nil ; echo area is fine 501 | cider-repl-display-help-banner nil)) 502 | 503 | ;; ;;; GNU Assembly (GAS) 504 | ;; ;; asm-mode is a built-in, but it has a terrible, 505 | ;; ;; terrible comment command that must be rebound. 506 | ;; (use-package asm-mode 507 | ;; :straight t 508 | ;; ;; :pin manual 509 | ;; ;; :ensure nil 510 | ;; :bind 511 | ;; (:map asm-mode-map 512 | ;; (";" . nil) 513 | ;; (":" . self-insert-command)) 514 | ;; :mode 515 | ;; ("\\.s\\|.S\\'" . asm-mode)) 516 | ;; ;; The above regexp matches .emacs, we have to explicitly handle it. 517 | ;; ;; Add .emacs to auto-mode-alist. 518 | ;; (add-to-list 'auto-mode-alist '("\\.emacs\\'" . emacs-lisp-mode)) 519 | 520 | ;;; Netwide Assembly (NASM) 521 | ;; https://nasm.us/ 522 | (use-package nasm-mode 523 | :straight t 524 | :bind 525 | (:map nasm-mode-map 526 | (";" . self-insert-command)) 527 | :mode 528 | ("\\.nasm\\|.asm\\'" . nasm-mode)) 529 | 530 | ;;; EBNF -- Extended Backus-Naur Form 531 | ;; https://github.com/nverno/ebnf-mode 532 | (use-package ebnf-mode 533 | :straight t 534 | :mode 535 | ("\\.bnf\\'" . ebnf-mode)) 536 | 537 | (provide 'languages) 538 | ;;; languages.el ends here 539 | -------------------------------------------------------------------------------- /lisp/mail.el: -------------------------------------------------------------------------------- 1 | (defun mu-setup/build-mu-binary () 2 | "Compiles 'mu' binary." 3 | (interactive) 4 | (async-shell-command "cd ~/.emacs.d/straight/repos/mu; ./autogen.sh; ninja -C build")) 5 | 6 | (defun mu-setup/init-mu () 7 | "Initialize 'mu' db." 8 | (interactive) 9 | (async-shell-command "mu init --maildir=/home/diamond/mail/ --my-address=diamondbond1@gmail.com")) 10 | 11 | (defun mu-setup/rebuild-mu-index () 12 | "Rebuilds 'mu' index." 13 | (interactive) 14 | (async-shell-command "mu index")) 15 | 16 | (defun mu-setup/automagic () 17 | "Auto-magically configures 'mu'." 18 | (interactive) 19 | ;; (mu-setup/build-mu-binary) 20 | ;; (sit-for 5) 21 | (mu-setup/init-mu) 22 | ;; (sit-for 5) 23 | (mu-setup/rebuild-mu-index)) 24 | 25 | (defun sync/mail () 26 | "Sync email." 27 | (interactive) 28 | (async-shell-command "offlineimap") 29 | (mu4e-update-index)) 30 | 31 | (use-package mu4e 32 | :straight t 33 | :custom (mu4e-mu-binary "/usr/local/bin/mu") 34 | :diminish mu4e-headers-mode 35 | :diminish mu4e-modeline-mode 36 | :config 37 | (setq mu4e-maildir (expand-file-name "~/mail")) 38 | 39 | ;; set folders 40 | (setq mu4e-drafts-folder "/[Gmail].Drafts") 41 | (setq mu4e-sent-folder "/[Gmail].Sent Mail") 42 | (setq mu4e-trash-folder "/[Gmail].Trash") 43 | ;; (setq mu4e-mu-home "~/.cache/mu") 44 | 45 | ;; don't save message to Sent Messages, GMail/IMAP will take care of this 46 | (setq mu4e-sent-messages-behavior 'delete) 47 | 48 | ;; composing mail 49 | (setq mu4e-compose-dont-reply-to-self t) 50 | 51 | ;; don't keep message buffers around 52 | (setq message-kill-buffer-on-exit t) 53 | 54 | ;; display options 55 | (setq mu4e-view-show-images t) 56 | (setq mu4e-view-show-addresses 't) 57 | 58 | ;; make sure that moving a message (like to Trash) causes the 59 | ;; message to get a new file name. This helps to avoid the 60 | ;; dreaded "UID is N beyond highest assigned" error. 61 | (setq mu4e-change-filenames-when-moving t) 62 | 63 | ;; setup some handy shortcuts 64 | (setq mu4e-maildir-shortcuts 65 | '(("/INBOX" . ?i) 66 | ("/[Gmail].Sent Mail" . ?s) 67 | ("/[Gmail].Trash" . ?t))) 68 | 69 | ;; attachments go here 70 | (setq mu4e-attachment-dir "~/mail/attachments") 71 | 72 | ;; modify behavior when putting something in the trash (T flag) so as 73 | ;; to make it sync to the remote server. This code deals with the bug 74 | ;; that, whenever a message is marked with the trash label T, 75 | ;; offlineimap wont sync it back to the gmail servers. 76 | ;; 77 | ;; NOTE: Taken from 78 | ;; http://cachestocaches.com/2017/3/complete-guide-email-emacs-using-mu-and-/ 79 | (defun remove-nth-element (nth list) 80 | (if (zerop nth) (cdr list) 81 | (let ((last (nthcdr (1- nth) list))) 82 | (setcdr last (cddr last)) 83 | list))) 84 | (setq mu4e-marks (remove-nth-element 5 mu4e-marks)) 85 | (add-to-list 'mu4e-marks 86 | '(trash 87 | :char ("d" . "▼") 88 | :prompt "dtrash" 89 | :dyn-target (lambda (target msg) (mu4e-get-trash-folder msg)) 90 | :action (lambda (docid msg target) 91 | (mu4e~proc-move docid 92 | (mu4e~mark-check-target target) "-N")))) 93 | 94 | ;; inbox-query 95 | (setq db/mu4e-inbox-query 96 | "(maildir:/Inbox OR maildir:/INBOX) AND flag:unread") 97 | 98 | ;; go-to-inbox function 99 | (defun db/go-to-inbox () 100 | "View unread inbox." 101 | (interactive) 102 | (mu4e-headers-search db/mu4e-inbox-query)) 103 | 104 | ;; allow for updating mail using 'U' in the main view: 105 | (setq mu4e-get-mail-command "offlineimap") 106 | 107 | ;; why would I want to leave my message open after I've sent it? 108 | (setq message-kill-buffer-on-exit t) 109 | ;; don't ask for a 'context' upon opening mu4e 110 | (setq mu4e-context-policy 'pick-first) 111 | ;; don't ask to quit 112 | (setq mu4e-confirm-quit nil) 113 | 114 | ;; disable mu4e-modeline 115 | ;;(mu4e-modeline-mode -1) 116 | 117 | ;; disable mu4e modeline on system with newer mu4e package 118 | (when (string= (system-name) "nitro") 119 | (progn 120 | (add-hook 'mu4e-main-mode-hook (lambda () (mu4e-modeline-mode -1))) 121 | (add-hook 'dashboard-mode-hook (lambda () (mu4e-modeline-mode -1))) 122 | (add-hook 'emacs-startup-hook (lambda () (mu4e-modeline-mode -1))))) 123 | 124 | ;; start mu4e 125 | (mu4e t)) 126 | 127 | (use-package mu4e-alert 128 | :disabled t 129 | :init 130 | (defun db/mu4e-notif () 131 | "Display both mode line and desktop alerts for incoming new emails." 132 | (interactive) 133 | (mu4e-update-mail-and-index 1) ; getting new emails is ran in the background 134 | (mu4e-alert-enable-mode-line-display) ; display new emails in mode-line 135 | (mu4e-alert-enable-notifications)) ; enable desktop notifications for new emails 136 | (defun db/mu4e-refresh () 137 | "Refresh emails every 300 seconds and display desktop alerts." 138 | (interactive) 139 | (mu4e t) ; start silently mu4e (mandatory for mu>=1.3.8) 140 | (run-with-timer 0 300 'db/mu4e-notif)) 141 | :after mu4e 142 | :bind ("" . db/mu4e-refresh) ; F2 turns Emacs into a mail client 143 | :config 144 | 145 | ;; show unread emails from all inboxes 146 | (setq mu4e-alert-interesting-mail-query db/mu4e-inbox-query) 147 | 148 | ;; show notifications for mails already notified 149 | (setq mu4e-alert-notify-repeated-mails nil) 150 | 151 | ;; mode line alerts: 152 | (add-hook 'after-init-hook #'mu4e-alert-enable-mode-line-display) 153 | 154 | ;; desktop alerts 155 | (mu4e-alert-set-default-style 'libnotify) 156 | ;; auto-enable notifications when opening mu4e 157 | (add-hook 'after-init-hook #'mu4e-alert-enable-notifications) 158 | 159 | ;; enable notifications 160 | (mu4e-alert-enable-notifications)) 161 | 162 | (use-package smtpmail 163 | :straight t 164 | :config 165 | (setq message-send-mail-function 'async-smtpmail-send-it 166 | starttls-use-gnutls t 167 | smtpmail-starttls-credentials 168 | '(("smtp.gmail.com" 587 nil nil)) 169 | smtpmail-auth-credentials 170 | (expand-file-name "~/.authinfo.gpg") 171 | smtpmail-default-smtp-server "smtp.gmail.com" 172 | smtpmail-smtp-server "smtp.gmail.com" 173 | smtpmail-smtp-service 587 174 | smtpmail-debug-info t)) 175 | 176 | (provide 'mail) 177 | ;;; mail.el ends here 178 | -------------------------------------------------------------------------------- /modules/archive/acme.org: -------------------------------------------------------------------------------- 1 | * Prerequisite 2 | #+begin_src emacs-lisp 3 | (disable-theme 'modus-operandi) 4 | ;;(pulsar-global-mode 0) 5 | ;;(global-hl-line-mode 1) 6 | (menu-bar-mode 0) 7 | (scroll-bar-mode 0) 8 | #+end_src 9 | 10 | * Acme theme 11 | #+begin_src emacs-lisp 12 | (use-package acme-theme 13 | :config 14 | (load-theme 'acme t)) 15 | #+end_src 16 | 17 | * Plan9 theme 18 | #+begin_src emacs-lisp 19 | (use-package plan9-theme 20 | :config 21 | (load-theme 'plan9 t)) 22 | #+end_src 23 | -------------------------------------------------------------------------------- /modules/archive/b.org: -------------------------------------------------------------------------------- 1 | #+STARTUP: overview 2 | #+TITLE: Buffers Configuration 3 | #+AUTHOR: Diamond Bond 4 | #+LANGUAGE: en 5 | #+OPTIONS: num:nil 6 | #+PROPERTY: header-args :mkdirp yes :tangle yes :results silent :noweb yes 7 | 8 | *** Initialize =bufler= 9 | **** Description 10 | Butler for your buffers, presenting them to you in an organized way based on your instructions. 11 | **** Code 12 | #+begin_src emacs-lisp 13 | (use-package bufler 14 | :straight t) 15 | #+end_src 16 | *** Initialize =burly= 17 | **** Description 18 | Provides tools to save and restore frame and window configurations. 19 | **** Code 20 | #+begin_src emacs-lisp 21 | (use-package burly 22 | :straight t) 23 | #+end_src 24 | -------------------------------------------------------------------------------- /modules/archive/catppuccin.org: -------------------------------------------------------------------------------- 1 | * Prerequisite 2 | #+begin_src emacs-lisp 3 | (disable-theme 'modus-operandi) 4 | ;; (pulsar-global-mode 0) 5 | (global-hl-line-mode 1) 6 | (menu-bar-mode 0) 7 | (scroll-bar-mode 0) 8 | #+end_src 9 | * Initialize =catppuccin-theme= 10 | ** Description 11 | Catppuccin theme for Emacs. 12 | ** Code 13 | #+begin_src emacs-lisp 14 | (use-package catppuccin-theme 15 | :straight t 16 | :config 17 | (load-theme 'catppuccin t)) 18 | #+end_src 19 | -------------------------------------------------------------------------------- /modules/archive/doom.org: -------------------------------------------------------------------------------- 1 | #+PROPERTY: header-args :results silent :noweb yes 2 | 3 | * Prerequisite 4 | #+begin_src emacs-lisp 5 | (disable-theme 'modus-operandi) 6 | ;; (pulsar-global-mode 0) 7 | (global-hl-line-mode 1) 8 | (menu-bar-mode 0) 9 | (scroll-bar-mode 0) 10 | (config/iosevka-fonts) 11 | #+end_src 12 | * Initialize =doom-themes= 13 | ** Description 14 | Doom themes. 15 | ** Code 16 | #+begin_src emacs-lisp 17 | (use-package doom-themes 18 | :straight t 19 | :config 20 | ;; (load-theme 'doom-one t) 21 | (load-theme 'doom-dracula t) 22 | ) 23 | #+end_src 24 | * Initialize =doom-modeline= 25 | ** Description 26 | A fancy and fast mode-line inspired by minimalism design. 27 | ** Code 28 | #+begin_src emacs-lisp 29 | (use-package doom-modeline 30 | :init (doom-modeline-mode) 31 | :config 32 | (setq doom-modeline-height 35) 33 | (setq doom-modeline-buffer-file-name-style 'file-name 34 | doom-modeline-enable-word-count t 35 | doom-modeline-buffer-encoding nil 36 | doom-modeline-icon t ;; Enable/disable all icons 37 | doom-modeline-modal-icon nil ;; Icon for Evil mode 38 | doom-modeline-hud t ;; Replaces scroll-bar 39 | doom-modeline-major-mode-icon t 40 | doom-modeline-major-mode-color-icon t 41 | doom-modeline-bar-width 3)) 42 | #+end_src 43 | -------------------------------------------------------------------------------- /modules/archive/gantt.org: -------------------------------------------------------------------------------- 1 | #+STARTUP: overview 2 | #+TITLE: Gantt Chart Configuration 3 | #+AUTHOR: Diamond Bond 4 | #+LANGUAGE: en 5 | #+OPTIONS: num:nil 6 | #+PROPERTY: header-args :mkdirp yes :tangle yes :results silent :noweb yes 7 | 8 | * Gantt 9 | ** Description 10 | GANTT Chart generator. 11 | ** Code 12 | #+begin_src emacs-lisp 13 | (use-package elgantt 14 | :straight 15 | ( :repo "legalnonsense/elgantt" 16 | :host github 17 | :type git)) 18 | #+end_src 19 | -------------------------------------------------------------------------------- /modules/archive/gruber.org: -------------------------------------------------------------------------------- 1 | * Prerequisite 2 | #+begin_src emacs-lisp 3 | (disable-theme 'modus-operandi) 4 | (global-hl-line-mode 0) 5 | (setq dashboard-startup-banner 'official) 6 | (read-mode/enable) 7 | #+end_src 8 | * Initialize =gruber-darker= 9 | ** Description 10 | Gruber Darker color theme for Emacs by Jason Blevins. 11 | A darker variant of the Gruber Dark theme for BBEdit by John Gruber. 12 | Adapted for deftheme and extended by Alexey Kutepov a.k.a. rexim. 13 | ** Code 14 | #+begin_src emacs-lisp 15 | (use-package gruber-darker-theme 16 | :straight t 17 | :config 18 | (load-theme 'gruber-darker t)) 19 | #+end_src 20 | -------------------------------------------------------------------------------- /modules/archive/honeydew.org: -------------------------------------------------------------------------------- 1 | #+STARTUP: overview 2 | #+TITLE: Frame Alist Configuration 3 | #+AUTHOR: Diamond Bond 4 | #+LANGUAGE: en 5 | #+OPTIONS: num:nil 6 | #+PROPERTY: header-args :mkdirp yes :tangle yes :results silent :noweb yes 7 | #+auto_tangle: t 8 | 9 | * Setup default-frame-alist 10 | #+begin_src emacs-lisp 11 | (setq default-frame-alist 12 | '((internal-border-width . 0) 13 | (background-color . "honeydew") 14 | (font . "DejaVu Sans Mono-14") 15 | (width . 80) 16 | (height . 46) 17 | (left-fringe) 18 | (right-fringe) 19 | (vertical-scroll-bars . right))) 20 | #+end_src 21 | 22 | * Newer default-frame-alist 23 | #+begin_src emacs-lisp 24 | (setq default-frame-alist 25 | '((inhibit-double-buffering . t) 26 | (height . 46) 27 | (width . 80) 28 | (internal-border-width . 0) 29 | (background-color . "honeydew") 30 | (font . "Menlo 10") 31 | (vertical-scroll-bars . right) 32 | (left-fringe) 33 | (right-fringe))) 34 | #+end_src 35 | -------------------------------------------------------------------------------- /modules/archive/leuven.org: -------------------------------------------------------------------------------- 1 | * Prerequisite 2 | #+begin_src emacs-lisp 3 | (disable-theme 'modus-operandi) 4 | ;;(pulsar-global-mode 0) 5 | ;;(global-hl-line-mode 1) 6 | (menu-bar-mode 0) 7 | (scroll-bar-mode 0) 8 | (setq dashboard-startup-banner 'official) 9 | ;; (dashboard-refresh-buffer) 10 | #+end_src 11 | 12 | * Leuven theme 13 | #+begin_src emacs-lisp 14 | (use-package leuven-theme 15 | :config 16 | (load-theme 'leuven t)) 17 | #+end_src 18 | -------------------------------------------------------------------------------- /modules/archive/mpv.org: -------------------------------------------------------------------------------- 1 | #+STARTUP: overview 2 | #+TITLE: MPV Configuration 3 | #+AUTHOR: Diamond Bond 4 | #+LANGUAGE: en 5 | #+OPTIONS: num:nil 6 | #+PROPERTY: header-args :mkdirp yes :tangle yes :results silent :noweb yes 7 | 8 | *** Initialize =mpv= 9 | **** Description 10 | Potpourri of helper functions to control a mpv process via its IPC interface. 11 | **** Code 12 | #+begin_src emacs-lisp 13 | (use-package mpv 14 | :straight t 15 | :defer 3 16 | :config 17 | (org-add-link-type "mpv" #'mpv-play) 18 | (defun org-mpv-complete-link (&optional arg) 19 | (replace-regexp-in-string 20 | "file:" "mpv:" 21 | (org-file-complete-link arg) 22 | t t)) 23 | (add-hook 'org-open-at-point-functions #'mpv-seek-to-position-at-point)) 24 | #+end_src 25 | -------------------------------------------------------------------------------- /modules/archive/naysayer.org: -------------------------------------------------------------------------------- 1 | * Prerequisite 2 | #+begin_src emacs-lisp 3 | (disable-theme 'modus-operandi) 4 | (global-hl-line-mode 1) 5 | (setq dashboard-startup-banner 'official) 6 | (read-mode/enable) 7 | #+end_src 8 | * Initialize =naysayer-theme= 9 | ** Description 10 | Naysayer theme. 11 | ** Code 12 | #+begin_src emacs-lisp 13 | (use-package naysayer-theme 14 | :straight (naysayer-theme :type git :host github :repo "diamondbond/naysayer-theme.el") 15 | :config 16 | (load-theme 'naysayer t)) 17 | #+end_src 18 | -------------------------------------------------------------------------------- /modules/archive/org-hyper.org: -------------------------------------------------------------------------------- 1 | #+STARTUP: overview 2 | #+TITLE: Org Hyperscheduler Configuration 3 | #+AUTHOR: Diamond Bond 4 | #+LANGUAGE: en 5 | #+OPTIONS: num:nil 6 | #+PROPERTY: header-args :mkdirp yes :tangle yes :results silent :noweb yes 7 | #+auto_tangle: t 8 | 9 | * Org-hyperscheduler 10 | #+begin_src emacs-lisp 11 | ;; org agenda in browser 12 | (use-package org-hyperscheduler 13 | :straight 14 | ( :repo "dmitrym0/org-hyperscheduler" 15 | :host github 16 | :type git 17 | :files ("*"))) 18 | #+end_src 19 | -------------------------------------------------------------------------------- /modules/archive/pulsar.org: -------------------------------------------------------------------------------- 1 | * Initialize =pulsar= 2 | ** Description 3 | This is a small package that temporarily highlights the current line after a given function is invoked. 4 | ** Code 5 | #+begin_src emacs-lisp 6 | (use-package pulsar 7 | :straight (:type git :host gitlab :repo "protesilaos/pulsar" :branch "main") 8 | :config 9 | 10 | ;; pulse on change 11 | (setq pulsar-pulse-on-window-change t) 12 | (setq pulsar-pulse t) 13 | 14 | ;; configure 15 | (setq pulsar-delay 0.055) 16 | (setq pulsar-iterations 10) 17 | (setq pulsar-face 'pulsar-magenta) 18 | (setq pulsar-highlight-face 'pulsar-yellow) 19 | 20 | ;; enable globally 21 | (pulsar-global-mode 1) 22 | 23 | ;; integration with the `consult' package: 24 | (add-hook 'consult-after-jump-hook #'pulsar-recenter-top) 25 | (add-hook 'consult-after-jump-hook #'pulsar-reveal-entry) 26 | 27 | ;; integration with the built-in `imenu': 28 | (add-hook 'imenu-after-jump-hook #'pulsar-recenter-top) 29 | (add-hook 'imenu-after-jump-hook #'pulsar-reveal-entry)) 30 | #+end_src 31 | -------------------------------------------------------------------------------- /modules/archive/scrollbar.el: -------------------------------------------------------------------------------- 1 | (if (fboundp 'scroll-bar-mode) 2 | (scroll-bar-mode 1)) 3 | (set-scroll-bar-mode 'right) 4 | -------------------------------------------------------------------------------- /modules/archive/spacemacs.org: -------------------------------------------------------------------------------- 1 | * Initialize =spacemacs-themes= 2 | ** Description 3 | Spacemacs themes. 4 | ** Code 5 | #+begin_src emacs-lisp 6 | (use-package spacemacs-theme 7 | :straight t 8 | :init 9 | (load-theme 'spacemacs-light t)) 10 | #+end_src 11 | -------------------------------------------------------------------------------- /modules/archive/standard.org: -------------------------------------------------------------------------------- 1 | #+PROPERTY: header-args :results silent :noweb yes 2 | 3 | * Prerequisite 4 | #+begin_src emacs-lisp 5 | (setq dashboard-startup-banner 'official) 6 | (disable-theme 'modus-operandi) 7 | (global-hl-line-mode 0) 8 | (menu-bar-mode 1) 9 | (scroll-bar-mode 1) 10 | (tool-bar-mode 0) 11 | #+end_src 12 | 13 | * standard-themes 14 | #+begin_src emacs-lisp 15 | (use-package standard-themes 16 | :straight (:type git :host gitlab :repo "protesilaos/standard-themes" :branch "main") 17 | :init 18 | (load-theme 'standard-light :no-confirm) 19 | :config 20 | (setq standard-themes-bold-constructs t 21 | standard-themes-italic-constructs t 22 | standard-themes-mixed-fonts t 23 | standard-themes-variable-pitch-ui t 24 | standard-themes-mode-line-accented nil 25 | ;; Accepts a symbol value: 26 | standard-themes-fringes 'subtle 27 | ;; The following accept lists of properties 28 | standard-themes-links '(neutral-underline) 29 | standard-themes-region '(no-extend neutral intense) 30 | standard-themes-prompts '(bold italic))) 31 | #+end_src 32 | -------------------------------------------------------------------------------- /modules/archive/sweet.org: -------------------------------------------------------------------------------- 1 | #+begin_src emacs-lisp 2 | (use-package sweet-theme 3 | :ensure t 4 | :init 5 | (load-theme 'sweet t)) 6 | 7 | (use-package doom-modeline 8 | :ensure t 9 | :config 10 | (setq doom-modeline-height 30) 11 | (setq doom-modeline-buffer-file-name-style 'file-name 12 | doom-modeline-enable-word-count t 13 | doom-modeline-buffer-encoding nil 14 | doom-modeline-icon t ;; Enable/disable all icons 15 | doom-modeline-modal-icon nil ;; Icon for Evil mode 16 | doom-modeline-hud t ;; Replaces scroll-bar 17 | doom-modeline-major-mode-icon t 18 | doom-modeline-major-mode-color-icon t 19 | doom-modeline-bar-width 3) 20 | :hook (after-init . doom-modeline-mode)) 21 | 22 | (menu-bar-mode -1) 23 | (scroll-bar-mode -1) 24 | #+end_src 25 | -------------------------------------------------------------------------------- /modules/archive/tarps.org: -------------------------------------------------------------------------------- 1 | #+begin_src emacs-lisp 2 | 3 | (use-package helpful :demand t) 4 | (use-package hsluv :demand t) 5 | 6 | (use-package ct.el 7 | :demand t 8 | :straight (ct.el :type git :host github :repo "neeasade/ct.el")) 9 | 10 | (use-package tarps 11 | :demand t 12 | :straight (tarps :type git :host github :repo "neeasade/tarps")) 13 | 14 | #+end_src 15 | -------------------------------------------------------------------------------- /modules/archive/undofu.org: -------------------------------------------------------------------------------- 1 | #+STARTUP: overview 2 | #+TITLE: Undo-fu Configuration 3 | #+AUTHOR: Diamond Bond 4 | #+LANGUAGE: en 5 | #+OPTIONS: num:nil 6 | #+PROPERTY: header-args :mkdirp yes :tangle yes :results silent :noweb yes 7 | 8 | *** Initialize =undofu= 9 | **** Description 10 | Sane undo & redo. 11 | See evil module for keybinds. 12 | **** Code 13 | #+begin_src emacs-lisp 14 | (use-package undo-fu) 15 | #+end_src 16 | -------------------------------------------------------------------------------- /modules/archive/zenburn.org: -------------------------------------------------------------------------------- 1 | * Prerequisite 2 | #+begin_src emacs-lisp 3 | (disable-theme 'modus-operandi) 4 | #+end_src 5 | * Initialize =zenburn-theme= 6 | ** Description 7 | Zenburn theme. 8 | ** Code 9 | #+begin_src emacs-lisp 10 | (use-package zenburn-theme 11 | :straight t 12 | :config 13 | (load-theme 'zenburn t)) 14 | #+end_src 15 | -------------------------------------------------------------------------------- /modules/discord.org: -------------------------------------------------------------------------------- 1 | #+STARTUP: overview 2 | #+TITLE: Discord Configuration 3 | #+AUTHOR: Diamond Bond 4 | #+LANGUAGE: en 5 | #+OPTIONS: num:nil 6 | #+PROPERTY: header-args :mkdirp yes :tangle yes :results silent :noweb yes 7 | #+auto_tangle: t 8 | 9 | * Header 10 | Enable lexical binding. 11 | #+begin_src emacs-lisp 12 | ;;; discord.el --- Discord Configuration. -*- lexical-binding: t; -*- 13 | 14 | ;; Copyright (C) 2022 Diamond Bond 15 | ;; This file is NOT part of GNU Emacs. 16 | ;; This file is free software. 17 | 18 | ;; Author: Diamond Bond 19 | ;; URL: https://github.com/diamondbond/emacs 20 | ;; Package-Requires: ((emacs "28.1")) 21 | 22 | ;;; Commentary: 23 | ;; This file provides the elcord configuration. 24 | 25 | ;;; Code: 26 | 27 | #+end_src 28 | 29 | * =elcord= 30 | 31 | ** Description 32 | 33 | URL: https://github.com/Mstrodl/elcord 34 | 35 | Discord RPC for Emacs. 36 | =M-x elcord= to toggle. 37 | 38 | NOTE: Set =elcord-client-id= with your ID. 39 | 40 | ** Code 41 | 42 | #+begin_src emacs-lisp 43 | ;; load elcord 44 | (use-package elcord 45 | :straight t 46 | :config 47 | ;; set api token 48 | (setq elcord-client-id "978267848038297661") 49 | ;; set icon 50 | (setq elcord-editor-icon "emacs_icon") 51 | ;; silence 52 | (setq elcord-quiet t) 53 | ;; override buffer-details-format 54 | (defun elcord-buffer-details-format () 55 | "Return the buffer details string shown on discord." 56 | (format "%s" (buffer-name))) 57 | ;; keybind to start elcord 58 | (define-key z-map (kbd "d") 'elcord-mode) 59 | ;; alias to start elcord 60 | (defalias 'discord 'elcord-mode)) 61 | #+end_src 62 | 63 | * Footer 64 | #+begin_src emacs-lisp 65 | 66 | (provide 'discord) 67 | ;;; discord.el ends here 68 | #+end_src 69 | -------------------------------------------------------------------------------- /modules/evil.org: -------------------------------------------------------------------------------- 1 | #+STARTUP: overview 2 | #+TITLE: Evil Configuration 3 | #+AUTHOR: Diamond Bond 4 | #+LANGUAGE: en 5 | #+OPTIONS: num:nil 6 | #+PROPERTY: header-args :mkdirp yes :tangle yes :results silent :noweb yes 7 | #+auto_tangle: t 8 | 9 | * Header 10 | Enable lexical binding. 11 | #+begin_src emacs-lisp 12 | ;;; evil.el --- Evil Configuration. -*- lexical-binding: t; -*- 13 | 14 | ;; Copyright (C) 2022 Diamond Bond 15 | ;; This file is NOT part of GNU Emacs. 16 | ;; This file is free software. 17 | 18 | ;; Author: Diamond Bond 19 | ;; URL: https://github.com/diamondbond/emacs 20 | ;; Package-Requires: ((emacs "28.1")) 21 | 22 | ;;; Commentary: 23 | ;; This file provides the evil configuration. 24 | 25 | ;;; Code: 26 | 27 | #+end_src 28 | 29 | * =evil= 30 | 31 | ** Description 32 | 33 | Heresy; Vim keybindings in Emacs. 34 | 35 | ** Code 36 | #+begin_src emacs-lisp 37 | (use-package evil 38 | :straight t 39 | :defer nil 40 | :init 41 | (setq evil-want-keybinding nil) 42 | (setq evil-want-C-u-scroll t) 43 | :config 44 | ;; enable evil-mode 45 | (evil-mode 1) 46 | 47 | ;; more granular undo with evil 48 | (setq evil-want-fine-undo t) 49 | 50 | ;; set evil state on a per mode basis 51 | ;; insert 52 | (evil-set-initial-state 'vterm-mode 'insert) 53 | ;; normal 54 | (evil-set-initial-state 'messages-buffer-mode 'normal) 55 | (evil-set-initial-state 'mu4e-main-mode 'emacs) 56 | ;; motion 57 | (evil-set-initial-state 'dashboard-mode 'motion) 58 | (evil-set-initial-state 'debugger-mode 'motion) 59 | (evil-set-initial-state 'pdf-view-mode 'motion) 60 | ;; emacs 61 | (evil-set-initial-state 'nov-mode 'emacs) 62 | (evil-set-initial-state 'term-mode 'emacs) 63 | (evil-set-initial-state 'eshell-mode 'emacs) 64 | (evil-set-initial-state 'bufler-list-mode 'emacs) 65 | (evil-set-initial-state 'profiler-report-mode 'emacs) 66 | (evil-set-initial-state 'inferior-scheme-mode 'emacs) 67 | (evil-set-initial-state 'md4rd-mode 'emacs) 68 | (evil-set-initial-state 'pdf-view-mode 'emacs) 69 | (evil-set-initial-state 'dictionary-mode ' emacs) 70 | ;; e2wm 71 | (evil-set-initial-state 'e2wm:def-plugin-history-list-mode 'emacs) 72 | (evil-set-initial-state 'e2wm:def-plugin-files-mode 'emacs) 73 | (evil-set-initial-state 'e2wm:def-plugin-imenu-mode 'emacs) 74 | 75 | ;; undo (requires undo-fu) 76 | ;; (define-key evil-normal-state-map "u" 'undo-fu-only-undo) 77 | ;; (define-key evil-normal-state-map "U" 'undo-fu-only-redo) 78 | 79 | ;; cycles org-mode visiblity 80 | (evil-define-key 'normal org-mode-map (kbd "") #'org-cycle) 81 | 82 | ;; :q kills buffer 83 | (evil-ex-define-cmd "q" 'delete-window)) 84 | 85 | (use-package evil-collection 86 | :after evil 87 | :config 88 | (setq evil-collection-mode-list '(dired (custom cus-edit) (package-menu package) calc diff-mode)) 89 | (evil-collection-init) 90 | ;; A few of my own overrides/customizations 91 | (evil-collection-define-key 'normal 'dired-mode-map 92 | (kbd "RET") 'dired-find-alternate-file)) 93 | #+end_src 94 | 95 | * Functions 96 | 97 | ** Yank Whole Buffer 98 | 99 | #+begin_src emacs-lisp 100 | (defun yank-whole-buffer () 101 | "Yank whole buffer." 102 | (interactive) 103 | (save-excursion 104 | (mark-whole-buffer) 105 | (call-interactively 'evil-yank))) 106 | #+end_src 107 | 108 | * Footer 109 | #+begin_src emacs-lisp 110 | 111 | (provide 'evil) 112 | ;;; evil.el ends here 113 | #+end_src 114 | -------------------------------------------------------------------------------- /modules/mail.org: -------------------------------------------------------------------------------- 1 | #+STARTUP: overview 2 | #+TITLE: Mail Configuration 3 | #+AUTHOR: Diamond Bond 4 | #+LANGUAGE: en 5 | #+OPTIONS: num:nil 6 | #+PROPERTY: header-args :mkdirp yes :tangle yes :results silent :noweb yes 7 | #+auto_tangle: t 8 | 9 | * Header 10 | Enable lexical binding. 11 | #+begin_src emacs-lisp 12 | ;;; mail.el --- Mail Configuration. -*- lexical-binding: t; -*- 13 | 14 | ;; Copyright (C) 2022 Diamond Bond 15 | ;; This file is NOT part of GNU Emacs. 16 | ;; This file is free software. 17 | 18 | ;; Author: Diamond Bond 19 | ;; URL: https://github.com/diamondbond/emacs 20 | ;; Package-Requires: ((emacs "28.1")) 21 | 22 | ;;; Commentary: 23 | ;; This file provides the user configuration. 24 | 25 | ;;; Code: 26 | 27 | #+end_src 28 | 29 | * Introduction 30 | 31 | URL: https://github.com/DiamondBond/emacs/blob/master/modules/mail.org 32 | 33 | /mu4e/ (/mu/) & /offlineimap/ to manage Email within Emacs. 34 | 35 | /mu/ is the server. 36 | 37 | /mu4e/ is the mail client within Emacs. 38 | 39 | /offlineimap/ is the imap synchronization utility. 40 | 41 | Make sure you store your gmail app specific passwords in ~/.emacs.d/authinfo.gpg. 42 | 43 | mu4e and mu can be automatically compiled and installed with the defuns below in =functions=. 44 | There is no need to install either of these packages with your package manager, Emacs can handle the mail server components for you. 45 | 46 | #+begin_quote 47 | M-x mu-setup/automagic 48 | #+end_quote 49 | 50 | NOTE: You'll need to comb through this document and replace all instances of my Email address with yours and my file-paths with your respective file-paths. 51 | 52 | ** Sources 53 | 54 | https://blog.leonardotamiano.xyz/posts/mu4e-setup/#part-2-configuring-mu4e 55 | https://f-santos.gitlab.io/2020-04-24-mu4e.html 56 | http://cachestocaches.com/2017/3/complete-guide-email-emacs-using-mu-and-/ 57 | 58 | * Installation 59 | 60 | ** 0. Prerequisites 61 | 62 | *** 0.1 maildir 63 | Create your maildir in $HOME as ~/mail 64 | 65 | #+begin_src sh :tangle no 66 | mkdir -p ~/mail 67 | #+end_src 68 | 69 | *** 0.2 offlineimap 70 | 71 | #+begin_src sh :tangle no 72 | yay -S offlineimap 73 | #+end_src 74 | 75 | ** 1. Configuring offlineimap 76 | 77 | ~/[[https://github.com/DiamondBond/dotfiles/blob/master/.offlineimaprc][offlineimap.rc]] 78 | 79 | [[https://github.com/DiamondBond/dotfiles/blob/master/.offlineimap.py][~/offlineimap.py]] 80 | 81 | These files should be automatically tangled below. 82 | 83 | ** 2. Configuring mu 84 | 85 | Scroll down to =Functions= to understand what these functions do, you'll have to change the maildir & my-address flags to correspond to your own maildir & address. 86 | 87 | *** Automatically 88 | 89 | Automatically build, install & run mu server/index. 90 | 91 | #+begin_quote 92 | M-x mu-setup/automagic 93 | #+end_quote 94 | 95 | *** Manually 96 | 97 | **** Compile mu 98 | 99 | Compile mu & mu4e. 100 | 101 | #+begin_src sh 102 | mkdir -p ~/src; cd ~/src 103 | git clone https://github.com/djcb/mu 104 | ./autogen.sh && make 105 | sudo make install 106 | #+end_src 107 | 108 | ***** Tip: mu4e-binary 109 | 110 | Set as *mu4e-mu-binary*. 111 | 112 | #+begin_example 113 | $ whereis mu 114 | mu: /usr/local/bin/mu 115 | #+end_example 116 | 117 | **** Initialize mu 118 | 119 | Initialize mu with maildir & address. 120 | 121 | #+begin_quote 122 | M-x mu-setup/init-mu 123 | #+end_quote 124 | 125 | **** Build mu index 126 | 127 | Inform mu as to the contents of ~/mail by building/rebuilding the mu index. 128 | 129 | #+begin_quote 130 | M-x mu-setup/rebuild-mu-index 131 | #+end_quote 132 | 133 | * Declaration 134 | ** Configuration Files 135 | 136 | These files will get automatically tangled to their respective locations. 137 | 138 | *** =~/.offlineimaprc= 139 | #+begin_src conf :tangle ~/.offlineimaprc 140 | [general] 141 | accounts = Gmail 142 | maxsyncaccounts = 1 143 | pythonfile = ~/.offlineimap.py 144 | 145 | [Account Gmail] 146 | localrepository = Local 147 | remoterepository = Remote 148 | 149 | [Repository Local] 150 | type = Maildir 151 | localfolders = ~/mail 152 | 153 | [Repository Remote] 154 | type = Gmail 155 | remoteuser = diamondbond1@gmail.com 156 | remotepasseval = get_password_emacs("imap.gmail.com", "diamondbond1@gmail.com", "993") 157 | realdelete = no 158 | 159 | folderfilter = lambda foldername: foldername not in ['[Gmail]/Spam', '[Gmail]/All Mail', '[Gmail]/Starred', '[Gmail]/Important'] 160 | 161 | holdconnectionopen = true 162 | keepalive = 60 163 | sslcacertfile = /etc/ssl/certs/ca-certificates.crt 164 | #+end_src 165 | 166 | *** =~/.offlineimap.py= 167 | #+begin_src python :tangle ~/.offlineimap.py 168 | #!/usr/bin/python 169 | import re, os 170 | 171 | def get_password_emacs(machine, login, port): 172 | s = "machine %s login %s port %s password ([^ ]*)\n" % (machine, login, port) 173 | p = re.compile(s) 174 | authinfo = os.popen("gpg -q --no-tty -d ~/.authinfo.gpg").read() 175 | return p.search(authinfo).group(1) 176 | #+end_src 177 | ** Functions 178 | *** 1. Compile mu 179 | 180 | 'mu' binary is output to ~/.emacs.d/straight/repos/mu/build/mu/mu 181 | 182 | #+begin_src emacs-lisp 183 | (defun mu-setup/build-mu-binary () 184 | "Compiles 'mu' binary." 185 | (interactive) 186 | (async-shell-command "cd ~/.emacs.d/straight/repos/mu; ./autogen.sh; ninja -C build")) 187 | #+end_src 188 | 189 | *** 2. Initialize mu 190 | 191 | NOTE: Modify this defun to contain your =maildir= & email address. 192 | 193 | #+begin_src emacs-lisp 194 | (defun mu-setup/init-mu () 195 | "Initialize 'mu' db." 196 | (interactive) 197 | (async-shell-command "mu init --maildir=/home/diamond/mail/ --my-address=diamondbond1@gmail.com")) 198 | #+end_src 199 | 200 | *** 3. Rebuild mu index. 201 | #+begin_src emacs-lisp 202 | (defun mu-setup/rebuild-mu-index () 203 | "Rebuilds 'mu' index." 204 | (interactive) 205 | (async-shell-command "mu index")) 206 | #+end_src 207 | 208 | *** 4. Automagic setup 209 | #+begin_src emacs-lisp 210 | (defun mu-setup/automagic () 211 | "Auto-magically configures 'mu'." 212 | (interactive) 213 | ;; (mu-setup/build-mu-binary) 214 | ;; (sit-for 5) 215 | (mu-setup/init-mu) 216 | ;; (sit-for 5) 217 | (mu-setup/rebuild-mu-index)) 218 | #+end_src 219 | 220 | *** =sync/mail= 221 | Sync Email to local mail directory. 222 | #+begin_src emacs-lisp 223 | (defun sync/mail () 224 | "Sync email." 225 | (interactive) 226 | (async-shell-command "offlineimap") 227 | (mu4e-update-index)) 228 | #+end_src 229 | ** Use-package 230 | *** Initialize =mu4e= 231 | **** Description 232 | mu4e mail client. 233 | **** Code 234 | #+begin_src emacs-lisp 235 | (use-package mu4e 236 | :straight t 237 | ;; :straight ( :host github 238 | ;; :repo "djcb/mu" 239 | ;; :branch "master" 240 | ;; :files ("build/mu4e/*")) 241 | ;; :pre-build (("./autogen.sh") ("make"))) 242 | :custom (mu4e-mu-binary "/usr/local/bin/mu") 243 | :diminish mu4e-headers-mode 244 | :config 245 | ;; default 246 | ;; (require 'org-mu4e) 247 | (setq mu4e-maildir (expand-file-name "~/mail")) 248 | 249 | ;; set folders 250 | (setq mu4e-drafts-folder "/[Gmail].Drafts") 251 | (setq mu4e-sent-folder "/[Gmail].Sent Mail") 252 | (setq mu4e-trash-folder "/[Gmail].Trash") 253 | ;; (setq mu4e-mu-home "~/.cache/mu") 254 | 255 | ;; don't save message to Sent Messages, GMail/IMAP will take care of this 256 | (setq mu4e-sent-messages-behavior 'delete) 257 | 258 | ;; composing mail 259 | (setq mu4e-compose-dont-reply-to-self t) 260 | 261 | ;; don't keep message buffers around 262 | (setq message-kill-buffer-on-exit t) 263 | 264 | ;; display options 265 | (setq mu4e-view-show-images t) 266 | (setq mu4e-view-show-addresses 't) 267 | 268 | ;; make sure that moving a message (like to Trash) causes the 269 | ;; message to get a new file name. This helps to avoid the 270 | ;; dreaded "UID is N beyond highest assigned" error. 271 | ;; See this link for more info: https://stackoverflow.com/a/43461973 272 | (setq mu4e-change-filenames-when-moving t) 273 | 274 | ;; setup some handy shortcuts 275 | (setq mu4e-maildir-shortcuts 276 | '(("/INBOX" . ?i) 277 | ("/[Gmail].Sent Mail" . ?s) 278 | ("/[Gmail].Trash" . ?t))) 279 | 280 | ;; attachments go here 281 | (setq mu4e-attachment-dir "~/mail/attachments") 282 | 283 | ;; modify behavior when putting something in the trash (T flag) so as 284 | ;; to make it sync to the remote server. This code deals with the bug 285 | ;; that, whenever a message is marked with the trash label T, 286 | ;; offlineimap wont sync it back to the gmail servers. 287 | ;; 288 | ;; NOTE: Taken from 289 | ;; http://cachestocaches.com/2017/3/complete-guide-email-emacs-using-mu-and-/ 290 | (defun remove-nth-element (nth list) 291 | (if (zerop nth) (cdr list) 292 | (let ((last (nthcdr (1- nth) list))) 293 | (setcdr last (cddr last)) 294 | list))) 295 | (setq mu4e-marks (remove-nth-element 5 mu4e-marks)) 296 | (add-to-list 'mu4e-marks 297 | '(trash 298 | :char ("d" . "▼") 299 | :prompt "dtrash" 300 | :dyn-target (lambda (target msg) (mu4e-get-trash-folder msg)) 301 | :action (lambda (docid msg target) 302 | (mu4e~proc-move docid 303 | (mu4e~mark-check-target target) "-N")))) 304 | 305 | ;; inbox-query 306 | (setq db/mu4e-inbox-query 307 | "(maildir:/Inbox OR maildir:/INBOX) AND flag:unread") 308 | 309 | ;; go-to-inbox function 310 | (defun db/go-to-inbox () 311 | "View unread inbox." 312 | (interactive) 313 | (mu4e-headers-search db/mu4e-inbox-query)) 314 | 315 | ;; allow for updating mail using 'U' in the main view: 316 | (setq mu4e-get-mail-command "offlineimap") 317 | 318 | ;; why would I want to leave my message open after I've sent it? 319 | (setq message-kill-buffer-on-exit t) 320 | ;; don't ask for a 'context' upon opening mu4e 321 | (setq mu4e-context-policy 'pick-first) 322 | ;; don't ask to quit 323 | (setq mu4e-confirm-quit nil) 324 | 325 | ;; define z-map keybind 326 | (define-key z-map (kbd "M") 'mu4e) 327 | 328 | ;; disable mu4e-modeline 329 | (mu4e-modeline-mode -1) 330 | (add-hook 'mu4e-main-mode-hook (lambda () (mu4e-modeline-mode -1))) 331 | (add-hook 'dashboard-mode-hook (lambda () (mu4e-modeline-mode -1))) 332 | 333 | ;; start mu4e 334 | (mu4e t)) 335 | #+end_src 336 | *** Initialize =mu4e-alert= 337 | **** Description 338 | Show alerts for unread emails. 339 | **** Code 340 | #+begin_src emacs-lisp 341 | (use-package mu4e-alert 342 | :disabled t 343 | :init 344 | (defun db/mu4e-notif () 345 | "Display both mode line and desktop alerts for incoming new emails." 346 | (interactive) 347 | (mu4e-update-mail-and-index 1) ; getting new emails is ran in the background 348 | (mu4e-alert-enable-mode-line-display) ; display new emails in mode-line 349 | (mu4e-alert-enable-notifications)) ; enable desktop notifications for new emails 350 | (defun db/mu4e-refresh () 351 | "Refresh emails every 300 seconds and display desktop alerts." 352 | (interactive) 353 | (mu4e t) ; start silently mu4e (mandatory for mu>=1.3.8) 354 | (run-with-timer 0 300 'db/mu4e-notif)) 355 | :after mu4e 356 | :bind ("" . db/mu4e-refresh) ; F2 turns Emacs into a mail client 357 | :config 358 | 359 | ;; show unread emails from all inboxes 360 | (setq mu4e-alert-interesting-mail-query db/mu4e-inbox-query) 361 | 362 | ;; show notifications for mails already notified 363 | (setq mu4e-alert-notify-repeated-mails nil) 364 | 365 | ;; mode line alerts: 366 | (add-hook 'after-init-hook #'mu4e-alert-enable-mode-line-display) 367 | 368 | ;; desktop alerts 369 | (mu4e-alert-set-default-style 'libnotify) 370 | ;; auto-enable notifications when opening mu4e 371 | (add-hook 'after-init-hook #'mu4e-alert-enable-notifications) 372 | 373 | ;; enable notifications 374 | (mu4e-alert-enable-notifications)) 375 | #+end_src 376 | *** Initialize =smtpmail= 377 | **** Description 378 | smtp mail within Emacs. 379 | **** Code 380 | #+begin_src emacs-lisp 381 | (use-package smtpmail 382 | :straight t 383 | :config 384 | (setq message-send-mail-function 'smtpmail-send-it 385 | starttls-use-gnutls t 386 | smtpmail-starttls-credentials 387 | '(("smtp.gmail.com" 587 nil nil)) 388 | smtpmail-auth-credentials 389 | (expand-file-name "~/.authinfo.gpg") 390 | smtpmail-default-smtp-server "smtp.gmail.com" 391 | smtpmail-smtp-server "smtp.gmail.com" 392 | smtpmail-smtp-service 587 393 | smtpmail-debug-info t)) 394 | #+end_src 395 | 396 | * Footer 397 | #+begin_src emacs-lisp 398 | 399 | (provide 'mail) 400 | ;;; mail.el ends here 401 | #+end_src 402 | -------------------------------------------------------------------------------- /modules/reddit.org: -------------------------------------------------------------------------------- 1 | #+STARTUP: overview 2 | #+TITLE: Reddit Configuration 3 | #+AUTHOR: Diamond Bond 4 | #+LANGUAGE: en 5 | #+OPTIONS: num:nil 6 | #+PROPERTY: header-args :mkdirp yes :tangle yes :results silent :noweb yes 7 | #+auto_tangle: t 8 | 9 | * Header 10 | Enable lexical binding. 11 | #+begin_src emacs-lisp 12 | ;;; reddit.el --- Reddit Configuration. -*- lexical-binding: t; -*- 13 | 14 | ;; Copyright (C) 2022 Diamond Bond 15 | ;; This file is NOT part of GNU Emacs. 16 | ;; This file is free software. 17 | 18 | ;; Author: Diamond Bond 19 | ;; URL: https://github.com/diamondbond/emacs 20 | ;; Package-Requires: ((emacs "28.1")) 21 | 22 | ;;; Commentary: 23 | ;; This file provides the md4rd configuration. 24 | 25 | ;;; Code: 26 | 27 | #+end_src 28 | 29 | * =md4rd= 30 | ** Description 31 | URL: https://github.com/ahungry/md4rd 32 | 33 | Reddit client within Emacs with oauth2 support. 34 | 35 | ** Code 36 | #+begin_src emacs-lisp 37 | (use-package md4rd 38 | :straight t 39 | :config 40 | ;; set subreddits 41 | (setq md4rd-subs-active '(emacs linux lisp+Common_Lisp prolog clojure)) 42 | (load-if-exists "~/.emacs.d/secrets.el.gpg") 43 | ;;(add-hook 'md4rd-mode-hook 'visual-line-mode) 44 | ) 45 | #+end_src 46 | 47 | * Footer 48 | #+begin_src emacs-lisp 49 | 50 | (provide 'reddit) 51 | ;;; reddit.el ends here 52 | #+end_src 53 | -------------------------------------------------------------------------------- /themes/lensor-min-theme.el: -------------------------------------------------------------------------------- 1 | ;;; lensor-min-theme.el --- A minimalist dark theme -*- lexical-binding:t -*- 2 | 3 | ;; This file is not part of GNU Emacs 4 | 5 | ;; This program is free software: you can redistribute it and/or modify 6 | ;; it under the terms of the GNU General Public License as published by 7 | ;; the Free Software Foundation, either version 3 of the License, or 8 | ;; (at your option) any later version. 9 | 10 | ;; This program is distributed in the hope that it will be useful, 11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ;; GNU General Public License for more details. 14 | 15 | ;; You should have received a copy of the GNU General Public License 16 | ;; along with this program. If not, see . 17 | 18 | ;;; Commentary: 19 | 20 | ;; Place this file in emacs-user-directory, "~/.emacs.d/", 21 | ;; then load from `~/.emacs` init file with (load-theme 'lensor-min). 22 | 23 | ;; (copy-file "lensor-min-theme.el" "~/.emacs.d/lensor-min-theme.el" t) 24 | 25 | ;;; Code: 26 | 27 | (deftheme lensor-min 28 | "A minimalist dark theme for Emacs.") 29 | 30 | ;;; Color definitions 31 | (let ((*foreground* "#ffffff") 32 | (*background* "#161718") 33 | 34 | (*link* "#2cabff") 35 | (*link-visited* "#2cabee") 36 | 37 | (*foreground-secondary* "#fcfcfc") 38 | (*lensor-grey-1* "#e4ebe8") 39 | (*lensor-grey-2* "#babebb") 40 | (*lensor-grey-3* "#7f8388") 41 | (*lensor-grey-4* "#515456") 42 | (*lensor-grey-5* "#353535") 43 | 44 | (*lensor-bright-red* "#e71111") 45 | (*lensor-dark-red* "#b40000") 46 | (*lensor-bright-orange* "#f86911") 47 | (*lensor-bright-yellow* "#fffd80") 48 | (*lensor-yellow* "#ffee20") 49 | (*lensor-bright-green* "#2fdd69") 50 | (*lensor-green* "#2da50e") 51 | (*lensor-min-green* "#68c94f") 52 | (*lensor-light-green* "#0aff8d") 53 | (*lensor-min-light-green* "#afd787") 54 | (*lensor-light-blue* "#ceffff") 55 | (*lensor-bright-blue* "#2cabff") 56 | (*lensor-blue* "#135be2") 57 | (*lensor-dark-blue* "#091626") 58 | (*lensor-bright-cyan* "#00ffff") 59 | (*lensor-cyan* "#00e2e2") 60 | (*lensor-bright-magenta* "#dd64f4") 61 | (*lensor-min-magenta* "#ae81ff") 62 | (*lensor-magenta* "#a033e0") 63 | 64 | (*lensor-bisque-1* "#ffebbb") 65 | (*lensor-bisque-2* "#fea80c")) 66 | 67 | (custom-theme-set-faces 68 | 'lensor-min 69 | 70 | ;;; Basic faces 71 | `(default 72 | ((t (:background 73 | , *background* 74 | :foreground 75 | , *foreground* 76 | )))) 77 | `(cursor ((t (:background , *lensor-yellow*)))) 78 | 79 | ;;; GUI 80 | `(fringe ((t (:background , *background*)))) 81 | 82 | ;;; Highlighting/Selection 83 | `(shadow ((t (:foreground , *lensor-grey-2*)))) 84 | `(highlight 85 | ((t (:background 86 | ,"#000000" 87 | :foreground 88 | , *lensor-bright-orange* 89 | )))) 90 | `(region ((t (:background , *lensor-grey-5*)))) 91 | `(secondary-selection ((t (:background , *lensor-dark-blue*)))) 92 | `(isearch 93 | ((t (:background 94 | , *lensor-bright-orange* 95 | :foreground 96 | , *foreground* 97 | )))) 98 | `(lazy-highlight 99 | ((t (:background 100 | ,"#000000" 101 | :foreground 102 | , *lensor-bright-orange* 103 | )))) 104 | 105 | ;;; Whitespace mode 106 | `(trailing-whitespace ((t (:background , *lensor-bright-red*)))) 107 | 108 | ;;; Font lock 109 | `(font-lock-builtin-face ((t (:foreground , *lensor-min-magenta*)))) 110 | `(font-lock-comment-face ((t (:foreground , *lensor-grey-3*)))) 111 | `(font-lock-preprocessor-face ((t (:foreground , *lensor-grey-2*)))) 112 | `(font-lock-constant-face ((t (:foreground , *lensor-light-blue*)))) 113 | `(font-lock-function-name-face ((t (:foreground , *lensor-bisque-1*)))) 114 | `(font-lock-keyword-face ((t (:foreground , *lensor-min-magenta*)))) 115 | `(font-lock-string-face ((t (:foreground , *lensor-min-green*)))) 116 | `(font-lock-type-face ((t (:foreground , *lensor-bright-blue*)))) 117 | `(font-lock-variable-name-face ((t (:foreground , *foreground*)))) 118 | `(font-lock-operator-face ((t (:foreground , *lensor-light-green*)))) 119 | `(font-lock-delimiter-face ((t (:foreground , *lensor-min-light-green*)))) 120 | 121 | ;;; Button and links 122 | `(link ((t (:underline t :foreground , *link*)))) 123 | `(link-visited ((t (:underline t :foreground , *link-visited*)))) 124 | 125 | ;;; Mode line 126 | `(mode-line 127 | ((t (:background 128 | , *lensor-grey-2* 129 | :foreground 130 | , *background* 131 | :box 132 | (:line-width -1 :style released-button) 133 | )))) 134 | `(eglot-mode-line ((t (:inherit mode-line)))) 135 | `(mode-line-inactive 136 | ((t (:box 137 | (:line-width -1 :style released-button) 138 | :background 139 | , *lensor-grey-4* 140 | :foreground 141 | , *lensor-grey-2* 142 | )))) 143 | 144 | ;;; Tab bar 145 | `(tab-bar 146 | ((t 147 | (:background 148 | , *background* 149 | :foreground 150 | , *foreground* 151 | )))) 152 | `(tab-bar-tab 153 | ((t 154 | (:box 155 | (:line-width 156 | 2 157 | :style 158 | released-button 159 | :color 160 | , *lensor-grey-3*) 161 | :background 162 | , *lensor-grey-4* 163 | )))) 164 | `(tab-bar-tab-inactive 165 | ((t 166 | (:box 167 | (:line-width 2 :style released-button) 168 | :inherit 169 | tab-bar 170 | )))) 171 | 172 | ;;; Bookmarks 173 | `(bookmark-face 174 | ((t (:background 175 | , *background* 176 | :foreground 177 | , *lensor-bright-orange* 178 | )))) 179 | 180 | `(compilation-mode-line-fail ((t (:foreground , *lensor-dark-red*)))) 181 | `(compilation-mode-line-run ((t (:foreground , *lensor-bright-orange*)))) 182 | `(compilation-mode-line-exit ((t (:foreground , *lensor-dark-red*)))) 183 | 184 | ;;; Escape and prompt faces 185 | `(minibuffer-prompt ((t (:foreground , *lensor-grey-2*)))) 186 | `(escape-glyph ((t (:foreground , *lensor-bisque-2*)))) 187 | `(homoglyph ((t (:foreground , *lensor-bisque-2*)))) 188 | `(error ((t (:foreground , *lensor-bright-red*)))) 189 | `(warning ((t (:foreground , *lensor-bright-orange*)))) 190 | `(success ((t (:foreground , *lensor-green*)))) 191 | 192 | ;;; ANSI Color Code faces 193 | `(ansi-color-black 194 | ((t (:background 195 | , *background* 196 | :foreground 197 | , *background* 198 | )))) 199 | `(ansi-color-red 200 | ((t (:background 201 | , *lensor-dark-red* 202 | :foreground 203 | , *lensor-dark-red* 204 | )))) 205 | `(ansi-color-green 206 | ((t (:background 207 | , *lensor-green* 208 | :foreground 209 | , *lensor-green* 210 | )))) 211 | `(ansi-color-yellow 212 | ((t (:background 213 | , *lensor-yellow* 214 | :foreground 215 | , *lensor-yellow* 216 | )))) 217 | `(ansi-color-blue 218 | ((t (:background 219 | , *lensor-blue* 220 | :foreground 221 | , *lensor-blue* 222 | )))) 223 | `(ansi-color-magenta 224 | ((t (:background 225 | , *lensor-magenta* 226 | :foreground 227 | , *lensor-magenta* 228 | )))) 229 | `(ansi-color-cyan 230 | ((t (:background 231 | , *lensor-cyan* 232 | :foreground 233 | , *lensor-cyan* 234 | )))) 235 | `(ansi-color-white 236 | ((t (:background 237 | , *foreground-secondary* 238 | :foreground 239 | , *foreground-secondary* 240 | )))) 241 | `(ansi-color-brightblack 242 | ((t (:background 243 | , *lensor-grey-3* 244 | :foreground 245 | , *lensor-grey-3* 246 | )))) 247 | `(ansi-color-brightred 248 | ((t (:background 249 | , *lensor-bright-red* 250 | :foreground 251 | , *lensor-bright-red* 252 | )))) 253 | `(ansi-color-brightgreen 254 | ((t (:background 255 | , *lensor-bright-green* 256 | :foreground 257 | , *lensor-bright-green* 258 | )))) 259 | `(ansi-color-brightyellow 260 | ((t (:background 261 | , *lensor-bright-yellow* 262 | :foreground 263 | , *lensor-bright-yellow* 264 | )))) 265 | `(ansi-color-brightblue 266 | ((t (:background 267 | , *lensor-bright-blue* 268 | :foreground 269 | , *lensor-bright-blue* 270 | )))) 271 | `(ansi-color-brightmagenta 272 | ((t (:background 273 | , *lensor-bright-magenta* 274 | :foreground 275 | , *lensor-bright-magenta* 276 | )))) 277 | `(ansi-color-brightcyan 278 | ((t (:background 279 | , *lensor-bright-cyan* 280 | :foreground 281 | , *lensor-bright-cyan* 282 | )))) 283 | `(ansi-color-brightwhite 284 | ((t (:background 285 | , *foreground* 286 | :foreground 287 | , *foreground* 288 | )))) 289 | 290 | ;;; Line number current line 291 | `(line-number-current-line 292 | ((t (:inherit 293 | 'default 294 | :foreground 295 | , *lensor-yellow* 296 | )))) 297 | 298 | ;;; imenu 299 | `(imenu-list-entry-face-0 ((t (:foreground , *lensor-light-blue*)))) 300 | `(imenu-list-entry-face-1 ((t (:foreground , *foreground*)))) 301 | `(imenu-list-entry-face-2 ((t (:foreground , *lensor-grey-2*)))) 302 | `(imenu-list-entry-face-3 ((t (:foreground , *lensor-grey-3*)))) 303 | `(imenu-list-entry-subalist-face-0 ((t (:foreground , *lensor-yellow*)))) 304 | `(imenu-list-entry-subalist-face-1 ((t (:foreground , *lensor-bisque-2*)))) 305 | `(imenu-list-entry-subalist-face-2 ((t (:foreground , *lensor-bright-blue*)))) 306 | `(imenu-list-entry-subalist-face-3 ((t (:foreground , *lensor-bright-green*)))) 307 | )) 308 | 309 | ;;(custom-theme-set-variables 310 | ;; 'lensor-min 311 | ;; ;;'(variable-name EXPRESSION) 312 | ;; ) 313 | 314 | (provide-theme 'lensor-min) 315 | 316 | ;;; lensor-min-theme.el ends here 317 | -------------------------------------------------------------------------------- /themes/lensor-theme.el: -------------------------------------------------------------------------------- 1 | ;;; lensor-theme.el --- A palateable dark theme -*- lexical-binding:t -*- 2 | 3 | ;; This file is not part of GNU Emacs 4 | 5 | ;; This program is free software: you can redistribute it and/or modify 6 | ;; it under the terms of the GNU General Public License as published by 7 | ;; the Free Software Foundation, either version 3 of the License, or 8 | ;; (at your option) any later version. 9 | 10 | ;; This program is distributed in the hope that it will be useful, 11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ;; GNU General Public License for more details. 14 | 15 | ;; You should have received a copy of the GNU General Public License 16 | ;; along with this program. If not, see . 17 | 18 | ;;; Commentary: 19 | 20 | ;; Place this file in emacs-user-directory, "~/.emacs.d/", 21 | ;; then load from `~/.emacs` init file with (load-theme 'lensor). 22 | 23 | ;;; Code: 24 | 25 | (deftheme lensor 26 | "A dark theme for Emacs based on my preference :^).") 27 | 28 | ;;; Color definitions 29 | (let ((*foreground* "#ffffff") 30 | (*background* "#161718") 31 | 32 | (*link* "#2cabff") 33 | (*link-visited* "#2cabee") 34 | 35 | (*foreground-secondary* "#fcfcfc") 36 | (*lensor-grey-1* "#e4ebe8") 37 | (*lensor-grey-2* "#babebb") 38 | (*lensor-grey-3* "#7f8388") 39 | (*lensor-grey-4* "#515456") 40 | (*lensor-grey-5* "#353535") 41 | 42 | (*lensor-bright-red* "#e71111") 43 | (*lensor-dark-red* "#b40000") 44 | (*lensor-light-red* "#f58864") 45 | (*lensor-light-light-red* "#ffb4a0") 46 | (*lensor-bright-orange* "#f86911") 47 | (*lensor-bright-yellow* "#fffd80") 48 | (*lensor-yellow* "#ffee20") 49 | (*lensor-light-yellow* "#f5eba1") 50 | (*lensor-bright-green* "#2fdd69") 51 | (*lensor-green* "#2da50e") 52 | (*lensor-light-green* "#0aff8d") 53 | (*lensor-light-light-green* "#a3f5c1") 54 | (*lensor-light-blue-green* "#80fffd") 55 | (*lensor-blue-green* "#6bdcce") 56 | (*lensor-light-blue* "#ceffff") 57 | (*lensor-bright-blue* "#2cabff") 58 | (*lensor-blue* "#135be2") 59 | (*lensor-beautiful-blue* "#028090") 60 | (*lensor-dark-blue* "#091626") 61 | (*lensor-bright-cyan* "#00ffff") 62 | (*lensor-cyan* "#00e2e2") 63 | (*lensor-bright-magenta* "#dd64f4") 64 | (*lensor-magenta* "#a033e0") 65 | 66 | (*lensor-bisque-1* "#ffebbb") 67 | (*lensor-bisque-2* "#fea80c")) 68 | 69 | (custom-theme-set-faces 70 | 'lensor 71 | 72 | ;;; Basic faces 73 | `(default 74 | ((t (:background 75 | , *background* 76 | :foreground 77 | , *foreground* 78 | )))) 79 | `(cursor ((t (:background , *lensor-yellow*)))) 80 | 81 | ;;; GUI 82 | `(fringe ((t (:background , *background*)))) 83 | 84 | ;;; Highlighting/Selection 85 | `(shadow ((t (:foreground , *lensor-grey-2*)))) 86 | `(highlight 87 | ((t (:background 88 | ,"#000000" 89 | :foreground 90 | , *lensor-bright-orange* 91 | )))) 92 | `(region ((t (:background , *lensor-grey-5*)))) 93 | `(secondary-selection ((t (:background , *lensor-dark-blue*)))) 94 | `(isearch 95 | ((t (:background 96 | , *lensor-bright-orange* 97 | :foreground 98 | , *foreground* 99 | )))) 100 | `(lazy-highlight 101 | ((t (:background 102 | ,"#000000" 103 | :foreground 104 | , *lensor-bright-orange* 105 | )))) 106 | 107 | ;;; Whitespace mode 108 | `(trailing-whitespace ((t (:background , *lensor-bright-red*)))) 109 | 110 | ;;; Font lock 111 | `(font-lock-builtin-face ((t (:foreground , *lensor-bright-magenta*)))) 112 | `(font-lock-comment-face ((t (:foreground , *lensor-grey-3*)))) 113 | `(font-lock-preprocessor-face ((t (:foreground , *lensor-grey-2*)))) 114 | `(font-lock-constant-face ((t (:foreground , *lensor-light-blue*)))) 115 | `(font-lock-number-face ((t (:inherit font-lock-constant-face)))) 116 | `(font-lock-function-name-face ((t (:foreground , *lensor-bisque-1*)))) 117 | `(font-lock-keyword-face ((t (:foreground , *lensor-bright-magenta*)))) 118 | `(font-lock-string-face ((t (:foreground , *lensor-yellow*)))) 119 | `(font-lock-escape-face ((t (:foreground , *lensor-bright-yellow*)))) 120 | `(font-lock-type-face ((t (:foreground , *lensor-bright-blue*)))) 121 | `(font-lock-operator-face ((t (:foreground , *lensor-light-green*)))) 122 | `(font-lock-delimiter-face ((t (:foreground , *lensor-grey-1*)))) 123 | `(font-lock-property-face ((t (:foreground , *lensor-bright-yellow*)))) 124 | `(font-lock-variable-name-face ((t (:foreground , *lensor-light-blue-green*)))) 125 | 126 | ;;; Button and links 127 | `(link ((t (:underline t :foreground , *link*)))) 128 | `(link-visited ((t (:underline t :foreground , *link-visited*)))) 129 | 130 | ;;; Mode line 131 | `(mode-line 132 | ((t (:background 133 | , *lensor-grey-2* 134 | :foreground 135 | , *background* 136 | :box 137 | (:line-width -1 :style released-button) 138 | )))) 139 | `(eglot-mode-line ((t (:inherit mode-line)))) 140 | `(mode-line-inactive 141 | ((t (:box 142 | (:line-width -1 :style released-button) 143 | :background 144 | , *lensor-grey-4* 145 | :foreground 146 | , *lensor-grey-2* 147 | )))) 148 | 149 | ;;; Tab bar 150 | `(tab-bar 151 | ((t 152 | (:background 153 | , *background* 154 | :foreground 155 | , *foreground* 156 | )))) 157 | `(tab-bar-tab 158 | ((t 159 | (:box 160 | (:line-width 161 | 2 162 | :style 163 | released-button 164 | :color 165 | , *lensor-grey-3*) 166 | :background 167 | , *lensor-grey-4* 168 | )))) 169 | `(tab-bar-tab-inactive 170 | ((t 171 | (:box 172 | (:line-width 2 :style released-button) 173 | :inherit 174 | tab-bar 175 | )))) 176 | 177 | ;;; Bookmarks 178 | `(bookmark-face 179 | ((t (:background 180 | , *background* 181 | :foreground 182 | , *lensor-bright-orange* 183 | )))) 184 | 185 | `(compilation-mode-line-fail ((t (:foreground , *lensor-dark-red*)))) 186 | `(compilation-mode-line-run ((t (:foreground , *lensor-bright-orange*)))) 187 | `(compilation-mode-line-exit ((t (:foreground , *lensor-dark-red*)))) 188 | 189 | ;;; Escape and prompt faces 190 | `(minibuffer-prompt ((t (:foreground , *lensor-grey-2*)))) 191 | `(escape-glyph ((t (:foreground , *lensor-bisque-2*)))) 192 | `(homoglyph ((t (:foreground , *lensor-bisque-2*)))) 193 | `(error ((t (:foreground , *lensor-bright-red*)))) 194 | `(warning ((t (:foreground , *lensor-bright-orange*)))) 195 | `(success ((t (:foreground , *lensor-green*)))) 196 | 197 | ;;; ANSI Color Code faces 198 | `(ansi-color-black 199 | ((t (:background 200 | , *background* 201 | :foreground 202 | , *background* 203 | )))) 204 | `(ansi-color-red 205 | ((t (:background 206 | , *lensor-dark-red* 207 | :foreground 208 | , *lensor-dark-red* 209 | )))) 210 | `(ansi-color-green 211 | ((t (:background 212 | , *lensor-green* 213 | :foreground 214 | , *lensor-green* 215 | )))) 216 | `(ansi-color-yellow 217 | ((t (:background 218 | , *lensor-yellow* 219 | :foreground 220 | , *lensor-yellow* 221 | )))) 222 | `(ansi-color-blue 223 | ((t (:background 224 | , *lensor-blue* 225 | :foreground 226 | , *lensor-blue* 227 | )))) 228 | `(ansi-color-magenta 229 | ((t (:background 230 | , *lensor-magenta* 231 | :foreground 232 | , *lensor-magenta* 233 | )))) 234 | `(ansi-color-cyan 235 | ((t (:background 236 | , *lensor-cyan* 237 | :foreground 238 | , *lensor-cyan* 239 | )))) 240 | `(ansi-color-white 241 | ((t (:background 242 | , *foreground-secondary* 243 | :foreground 244 | , *foreground-secondary* 245 | )))) 246 | `(ansi-color-brightblack 247 | ((t (:background 248 | , *lensor-grey-3* 249 | :foreground 250 | , *lensor-grey-3* 251 | )))) 252 | `(ansi-color-brightred 253 | ((t (:background 254 | , *lensor-bright-red* 255 | :foreground 256 | , *lensor-bright-red* 257 | )))) 258 | `(ansi-color-brightgreen 259 | ((t (:background 260 | , *lensor-bright-green* 261 | :foreground 262 | , *lensor-bright-green* 263 | )))) 264 | `(ansi-color-brightyellow 265 | ((t (:background 266 | , *lensor-bright-yellow* 267 | :foreground 268 | , *lensor-bright-yellow* 269 | )))) 270 | `(ansi-color-brightblue 271 | ((t (:background 272 | , *lensor-bright-blue* 273 | :foreground 274 | , *lensor-bright-blue* 275 | )))) 276 | `(ansi-color-brightmagenta 277 | ((t (:background 278 | , *lensor-bright-magenta* 279 | :foreground 280 | , *lensor-bright-magenta* 281 | )))) 282 | `(ansi-color-brightcyan 283 | ((t (:background 284 | , *lensor-bright-cyan* 285 | :foreground 286 | , *lensor-bright-cyan* 287 | )))) 288 | `(ansi-color-brightwhite 289 | ((t (:background 290 | , *foreground* 291 | :foreground 292 | , *foreground* 293 | )))) 294 | 295 | ;;; Line number current line 296 | `(line-number-current-line 297 | ((t (:inherit 298 | 'default 299 | :foreground 300 | , *lensor-yellow* 301 | )))) 302 | 303 | ;;; imenu 304 | `(imenu-list-entry-face-0 ((t (:foreground , *lensor-light-blue*)))) 305 | `(imenu-list-entry-face-1 ((t (:foreground , *foreground*)))) 306 | `(imenu-list-entry-face-2 ((t (:foreground , *lensor-grey-2*)))) 307 | `(imenu-list-entry-face-3 ((t (:foreground , *lensor-grey-3*)))) 308 | `(imenu-list-entry-subalist-face-0 ((t (:foreground , *lensor-yellow*)))) 309 | `(imenu-list-entry-subalist-face-1 ((t (:foreground , *lensor-bisque-2*)))) 310 | `(imenu-list-entry-subalist-face-2 ((t (:foreground , *lensor-bright-blue*)))) 311 | `(imenu-list-entry-subalist-face-3 ((t (:foreground , *lensor-bright-green*)))) 312 | )) 313 | 314 | ;;(custom-theme-set-variables 315 | ;; 'lensor 316 | ;; ;;'(variable-name EXPRESSION) 317 | ;; ) 318 | 319 | (provide-theme 'lensor) 320 | 321 | ;;; lensor-theme.el ends here 322 | --------------------------------------------------------------------------------