X-Git-Url: https://git.shemshak.org/~bandali/configs/blobdiff_plain/2ec18855d6d4e144776551dfb4921e1b133dfd29..679463c61523f4eed0ab40468e9504166863e4ac:/init.el diff --git a/init.el b/init.el index 04133fe..184ae64 100644 --- a/init.el +++ b/init.el @@ -19,8 +19,7 @@ ;; GNU Emacs configuration of Amin Bandali, computer scientist, ;; Free Software activist, and GNU maintainer & webmaster. Packages -;; are installed through GNU Guix for a fully reproducible setup. -;; Before switching to Guix, I used straight.el, and before that Borg. +;; are installed through using Borg for a fully reproducible setup. ;; Over the years, I've taken inspiration from configurations of many ;; great people. Some that I can remember off the top of my head are: @@ -42,6 +41,8 @@ "Value of `current-time' when Emacs begins loading `user-init-file'.") (defvar b/emacs-initialized nil "Whether Emacs has been initialized.") +(defvar b/exwm-p (string= (system-name) "chaman") + "Whether or not we will be using `exwm'.") (when (not (bound-and-true-p b/emacs-initialized)) (message "Loading Emacs...done (%.3fs)" @@ -67,15 +68,16 @@ gc-cons-threshold b/gc-cons-threshold gc-cons-percentage b/gc-cons-percentage file-name-handler-alist b/file-name-handler-alist) - (with-eval-after-load 'exwm-workspace - (setq-default - mode-line-format - (append - mode-line-format - '((:eval - (format - "[%s]" (number-to-string - exwm-workspace-current-index)))))))) + (when b/exwm-p + (with-eval-after-load 'exwm-workspace + (setq-default + mode-line-format + (append + mode-line-format + '((:eval + (format + "[%s]" (number-to-string + exwm-workspace-current-index))))))))) (add-hook 'after-init-hook #'b/post-init) ;; increase number of lines kept in *Messages* log @@ -104,14 +106,14 @@ ;;; Package management -;; No package.el (for emacs 26 and before) -(when (version< emacs-version "27") - (setq package-enable-at-startup nil) - ;; (package-initialize) - ) -;; for emacs 27 and later, we use early-init.el. see -;; https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=24acb31c04b4048b85311d794e600ecd7ce60d3b - +(progn ; `borg' + (add-to-list 'load-path + (expand-file-name "lib/borg" user-emacs-directory)) + (require 'borg) + (borg-initialize) + (setq borg-rewrite-urls-alist + '(("git@github.com:" . "https://github.com/") + ("git@gitlab.com:" . "https://gitlab.com/")))) ;; use-package (if nil ; set to t when need to debug init @@ -130,9 +132,6 @@ ;;; Initial setup -(defvar b/exwm-p (string= (system-name) "chaman") - "Whether or not we will be using `exwm'.") - ;; keep ~/.emacs.d clean (use-package no-littering :demand @@ -140,6 +139,17 @@ (defalias 'b/etc 'no-littering-expand-etc-file-name) (defalias 'b/var 'no-littering-expand-var-file-name)) +(use-package auto-compile + :demand + :config + (auto-compile-on-load-mode) + (auto-compile-on-save-mode) + (setq auto-compile-display-buffer nil) + (setq auto-compile-mode-line-counter t) + (setq auto-compile-source-recreate-deletes-dest t) + (setq auto-compile-toggle-deletes-nonlib-dest t) + (setq auto-compile-update-autoloads t)) + ;; separate custom file (don't want it mixing with init.el) (use-package custom :no-require @@ -163,16 +173,12 @@ ;; start up emacs server. see ;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html#Emacs-Server (use-package server - :defer 0.4 + :defer 0.5 :config (or (server-running-p) (server-mode))) ;;; Useful utilities -;; useful libraries -(require 'cl-lib) -(require 'subr-x) - (defmacro b/setq-every (value &rest vars) "Set all the variables from VARS to value VALUE." (declare (indent defun) (debug t)) @@ -197,7 +203,7 @@ (defun b/add-elisp-section () (interactive) (insert "\n") - (previous-line) + (forward-line -1) (insert "\n \n;;; ")) ;; (defvar b/fill-column 47 @@ -260,7 +266,7 @@ For disabling the behaviour for certain buffers and/or modes." indent-tabs-mode nil tab-width 4 ;; cursor shape - cursor-type 'bar) + cursor-type t) ;; unicode support (comment @@ -358,7 +364,7 @@ For disabling the behaviour for certain buffers and/or modes." (display-time-mode) :custom (display-time-default-load-average nil) - (display-time-format "%a %b %-e %-l:%M%P") + (display-time-format " %a %b %-e %-l:%M%P") (display-time-mail-icon '(image :type xpm :file "gnus/gnus-pointer.xpm" :ascent center)) (display-time-use-mail-icon t)) @@ -367,7 +373,7 @@ For disabling the behaviour for certain buffers and/or modes." :config (display-battery-mode) :custom - (battery-mode-line-format " %p%% %t")) + (battery-mode-line-format "%p%% %t")) (use-package fringe :demand @@ -454,9 +460,7 @@ For disabling the behaviour for certain buffers and/or modes." :config ;; ask for GPG passphrase in minibuffer ;; this will fail if gpg>=2.1 is not available - (if (version< "27" emacs-version) - (setq epg-pinentry-mode 'loopback) - (setq epa-pinentry-mode 'loopback)) + (setq epg-pinentry-mode 'loopback) :custom (epg-gpg-program (executable-find "gpg"))) @@ -464,6 +468,7 @@ For disabling the behaviour for certain buffers and/or modes." :after epg-config) (use-package pinentry + :disabled :demand :after (epa epg server) :config @@ -490,6 +495,10 @@ For disabling the behaviour for certain buffers and/or modes." ("C-c e u" . emacs-uptime) ("C-c e v" . emacs-version) + ("C-c f ." . find-file) + ("C-c f d" . find-name-dired) + ("C-c f l" . find-library) + ("C-c F m" . make-frame-command) ("C-c F d" . delete-frame) ("C-c F D" . server-edit) @@ -497,6 +506,8 @@ For disabling the behaviour for certain buffers and/or modes." ("C-S-h C" . describe-char) ("C-S-h F" . describe-face) + ("C-c x" . execute-extended-command) + ("C-x k" . b/kill-current-buffer) ("C-x K" . kill-buffer) ("C-x s" . save-buffer) @@ -523,320 +534,18 @@ For disabling the behaviour for certain buffers and/or modes." ;;; Essential packages -(use-package exwm - :if b/exwm-p - :demand - :config - ;; make class name the buffer name, truncating beyond 60 characters - (defun b/exwm-rename-buffer () - (interactive) - (exwm-workspace-rename-buffer - (concat exwm-class-name ":" - (if (<= (length exwm-title) 60) exwm-title - (concat (substring exwm-title 0 59) "..."))))) - ;; Enable EXWM - (exwm-enable) - :hook ((exwm-update-class . b/exwm-rename-buffer) - (exwm-update-title . b/exwm-rename-buffer))) - -(use-package exwm-config - :demand - :after exwm - :hook (exwm-init . exwm-config--fix/ido-buffer-window-other-frame)) - -(use-package exwm-input - :demand - :after exwm - :config - (defun b/exwm-ws-prev-index () - "Return the index for the previous EXWM workspace, wrapping -around if needed." - (if (= exwm-workspace-current-index 0) - (1- exwm-workspace-number) - (1- exwm-workspace-current-index))) - - (defun b/exwm-ws-next-index () - "Return the index for the next EXWM workspace, wrapping -around if needed." - (if (= exwm-workspace-current-index - (1- exwm-workspace-number)) - 0 - (1+ exwm-workspace-current-index))) - - ;; shorten 'C-c C-q' to 'C-q' - (define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key) - - (setq exwm-workspace-number 4 - exwm-input-global-keys - `(([?\s-R] . exwm-reset) - ([?\s-\\] . exwm-workspace-switch) - ([?\s-\s] . dmenu) - ([?\S-\s-\s] . (lambda (command) - (interactive - (list (read-shell-command "➜ "))) - (start-process-shell-command - command nil command))) - ([s-return] . (lambda () - (interactive) - (start-process "" nil "urxvt"))) - ([?\C-\s-\s] . counsel-linux-app) - ([?\M-\s-\s] . (lambda () - (interactive) - (start-process-shell-command - "rofi-pass" nil "rofi-pass"))) - ([?\s-h] . windmove-left) - ([?\s-j] . windmove-down) - ([?\s-k] . windmove-up) - ([?\s-l] . windmove-right) - ([?\s-H] . windmove-swap-states-left) - ([?\s-J] . windmove-swap-states-down) - ([?\s-K] . windmove-swap-states-up) - ([?\s-L] . windmove-swap-states-right) - ([?\M-\s-h] . shrink-window-horizontally) - ([?\M-\s-l] . enlarge-window-horizontally) - ([?\M-\s-k] . shrink-window) - ([?\M-\s-j] . enlarge-window) - ([?\s-\[] . (lambda () - (interactive) - (exwm-workspace-switch-create - (b/exwm-ws-prev-index)))) - ([?\s-\]] . (lambda () - (interactive) - (exwm-workspace-switch-create - (b/exwm-ws-next-index)))) - ([?\s-{] . (lambda () - (interactive) - (exwm-workspace-move-window - (b/exwm-ws-prev-index)))) - ([?\s-}] . (lambda () - (interactive) - (exwm-workspace-move-window - (b/exwm-ws-next-index)))) - ,@(mapcar (lambda (i) - `(,(kbd (format "s-%d" i)) . - (lambda () - (interactive) - (exwm-workspace-switch-create ,i)))) - (number-sequence 0 (1- exwm-workspace-number))) - ([?\s-t] . exwm-floating-toggle-floating) - ([?\s-f] . exwm-layout-toggle-fullscreen) - ([?\s-W] . (lambda () - (interactive) - (kill-buffer (current-buffer)))) - ([?\s-Q] . (lambda () - (interactive) - (exwm-manage--kill-client))) - ([?\s-\'] . (lambda () - (interactive) - (start-process-shell-command - "rofi-light" nil "rofi-light"))) - ([XF86AudioMute] . - (lambda () - (interactive) - (start-process "" nil "amixer" "set" "'Master',0" "toggle"))) - ([XF86AudioLowerVolume] . - (lambda () - (interactive) - (start-process - "" nil "amixer" "set" "'Master',0" "5%-"))) - ([XF86AudioRaiseVolume] . - (lambda () - (interactive) - (start-process - "" nil "amixer" "set" "'Master',0" "5%+"))) - ([XF86AudioPlay] . - (lambda () - (interactive) - (start-process "" nil "mpc" "toggle"))) - ([XF86AudioPrev] . - (lambda () - (interactive) - (start-process "" nil "mpc" "prev"))) - ([XF86AudioNext] . - (lambda () - (interactive) - (start-process "" nil "mpc" "next"))) - ([XF86ScreenSaver] . - (lambda () - (interactive) - (start-process "" nil "dm-tool" "lock"))) - ([\s-XF86Back] . previous-buffer) - ([\s-XF86Forward] . next-buffer))) - - ;; Line-editing shortcuts - (setq exwm-input-simulation-keys - '(;; movement - ([?\C-b] . [left]) - ([?\M-b] . [C-left]) - ([?\C-f] . [right]) - ([?\M-f] . [C-right]) - ([?\C-p] . [up]) - ([?\C-n] . [down]) - ([?\C-a] . [home]) - ([?\C-e] . [end]) - ([?\M-v] . [prior]) - ([?\C-v] . [next]) - ([?\C-d] . [delete]) - ([?\C-k] . [S-end ?\C-x]) - ([?\M-<] . C-home) - ([?\M->] . C-end) - ;; cut/copy/paste - ([?\C-w] . [?\C-x]) - ([?\M-w] . [?\C-c]) - ([?\C-y] . [?\C-v]) - ([?\M-d] . [C-S-right ?\C-x]) - ([?\M-\d] . [C-S-left ?\C-x]) - ;; window - ([?\s-w] . [?\C-w]) - ([?\s-q] . [?\C-q]) - ;; misc - ([?\C-s] . [?\C-f]) - ([?\s-s] . [?\C-s]) - ([?\C-g] . [escape])))) - -(use-package exwm-manage - :demand - :after exwm - :hook - (exwm-manage-finish . (lambda () - (when exwm-class-name - (cond - ((string= exwm-class-name "IceCat") - (exwm-input-set-local-simulation-keys - `(,@exwm-input-simulation-keys - ([?\C-\S-d] . [?\C-d])))) - ((string= exwm-class-name "URxvt") - (exwm-input-set-local-simulation-keys - '(([?\C-c ?\C-c] . [?\C-c]) - ([?\C-c ?\C-u] . [?\C-u])))) - ((string= exwm-class-name "Zathura") - (exwm-input-set-local-simulation-keys - '(([?\C-p] . [C-up]) - ([?\C-n] . [C-down]))))))))) - -(use-package exwm-randr - :demand - :after exwm - :config - (exwm-randr-enable) - :custom - (exwm-randr-workspace-monitor-plist '(1 "VGA-1"))) - -(use-package exwm-systemtray - :demand - :after exwm - :config - (exwm-systemtray-enable)) - -(use-package exwm-workspace) +(add-to-list + 'load-path + (expand-file-name + (convert-standard-filename "lisp") user-emacs-directory)) -(use-package exwm-edit - :demand - :after exwm) +(when b/exwm-p + (require 'bandali-exwm)) -;; use the org-plus-contrib package to get the whole deal -(use-package org-plus-contrib) - -(use-package org - :defer 0.5 - :config - (setq org-src-tab-acts-natively t - org-src-preserve-indentation nil - org-edit-src-content-indentation 0 - org-link-email-description-format "Email %c: %s" ; %.30s - org-highlight-latex-and-related '(entities) - org-use-speed-commands t - org-startup-folded 'content - org-catch-invisible-edits 'show-and-error - org-log-done 'time) - (when (version< org-version "9.3") - (setq org-email-link-description-format - org-link-email-description-format)) - (add-to-list 'org-structure-template-alist '("L" . "src emacs-lisp") t) - (add-to-list 'org-modules 'org-habit) - :bind - (("C-c a o a" . org-agenda) - :map org-mode-map - ("M-L" . org-insert-last-stored-link) - ("M-O" . org-toggle-link-display)) - :hook ((org-mode . org-indent-mode) - (org-mode . auto-fill-mode) - (org-mode . flyspell-mode)) - :custom - (org-pretty-entities t) - (org-agenda-files '("~/usr/org/todos/personal.org" - "~/usr/org/todos/habits.org" - "~/src/git/masters-thesis/todo.org")) - (org-agenda-start-on-weekday 0) - (org-agenda-time-leading-zero t) - (org-habit-graph-column 44) - (org-latex-packages-alist '(("" "listings") ("" "color"))) - :custom-face - '(org-block-begin-line ((t (:foreground "#5a5b5a" :background "#1d1f21")))) - '(org-block ((t (:background "#1d1f21")))) - '(org-latex-and-related ((t (:foreground "#b294bb"))))) - -(use-package ox-latex - :after ox - :config - (setq org-latex-listings 'listings - ;; org-latex-prefer-user-labels t - ) - (add-to-list 'org-latex-classes - '("IEEEtran" "\\documentclass[11pt]{IEEEtran}" - ("\\section{%s}" . "\\section*{%s}") - ("\\subsection{%s}" . "\\subsection*{%s}") - ("\\subsubsection{%s}" . "\\subsubsection*{%s}") - ("\\paragraph{%s}" . "\\paragraph*{%s}") - ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) - t) - (require 'ox-beamer)) - -(use-package ox-extra - :config - (ox-extras-activate '(latex-header-blocks ignore-headlines))) - -;; asynchronous tangle, using emacs-async to asynchronously tangle an -;; org file. closely inspired by -;; https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles -(with-eval-after-load 'org - (defvar b/show-async-tangle-results nil - "Keep *emacs* async buffers around for later inspection.") - - (defvar b/show-async-tangle-time nil - "Show the time spent tangling the file.") - - (defun b/async-babel-tangle () - "Tangle org file asynchronously." - (interactive) - (let* ((file-tangle-start-time (current-time)) - (file (buffer-file-name)) - (file-nodir (file-name-nondirectory file)) - ;; (async-quiet-switch "-q") - (file-noext (file-name-sans-extension file))) - (async-start - `(lambda () - (require 'org) - (org-babel-tangle-file ,file)) - (unless b/show-async-tangle-results - `(lambda (result) - (if result - (message "Tangled %s%s" - ,file-nodir - (if b/show-async-tangle-time - (format " (%.3fs)" - (float-time (time-subtract (current-time) - ',file-tangle-start-time))) - "")) - (message "Tangling %s failed" ,file-nodir)))))))) - -(add-to-list - 'safe-local-variable-values - '(eval add-hook 'after-save-hook #'b/async-babel-tangle 'append 'local)) +(require 'bandali-org) ;; *the* right way to do git (use-package magit - :defer 0.5 :bind (("C-x g" . magit-status) ("C-c g g" . magit-status) ("C-c g b" . magit-blame-addition) @@ -850,7 +559,7 @@ around if needed." ;; 'magit-insert-ignored-files ;; 'magit-insert-untracked-files ;; 'append) - (setq magit-repository-directories '(("~/" . 0) + (setq magit-repository-directories '(("~/.emacs.d/" . 0) ("~/src/git/" . 2))) (nconc magit-section-initial-visibility-alist '(([unpulled status] . show) @@ -871,252 +580,18 @@ around if needed." :custom (recentf-max-saved-items 2000)) -;; smart M-x enhancement (needed by counsel for history) -;; (use-package smex) - -(bind-keys - ("C-c f ." . find-file) - ("C-c f d" . find-name-dired) - ("C-c f l" . find-library) - ;; ("C-c f r" . recentf-open-files) - ("C-c x" . execute-extended-command)) - -(comment - (use-package ido - :demand - :bind - (:map ido-common-completion-map - ([escape] . minibuffer-keyboard-quit) - ("DEL" . b/ido-backspace)) - :config - (require 'delsel) - (defun b/ido-backspace () - "Forward to `backward-delete-char'. On error (read-only), quit." - (interactive) - (condition-case nil - (backward-delete-char 1) - (error - (minibuffer-keyboard-quit)))) - (ido-mode 1) - (ido-everywhere 1) - :custom - (ido-enable-flex-matching t) - ;; (ido-enable-regexp t) - ;; (ido-enable-prefix t) - (ido-max-window-height 10) - (ido-use-virtual-buffers t)) - - (use-package ido-vertical-mode - :defer 0.3 - :config - (ido-vertical-mode 1) - :custom - (ido-vertical-define-keys 'C-n-C-p-up-and-down) - (ido-vertical-show-count t)) - - (use-package ido-completing-read+ - :defer 0.3 - :after ido - :config - (ido-ubiquitous-mode 1)) - - (use-package crm-custom - :defer 0.3 - :config - (crm-custom-mode 1)) - - (use-package icomplete - :defer 0.3 - :config - (icomplete-mode 1))) - +;; needed for history for counsel (use-package amx :defer 0.3 :config (amx-mode)) -(use-package ivy - :defer 0.3 - :bind - (:map ivy-minibuffer-map - ([escape] . keyboard-escape-quit) - ([S-up] . ivy-previous-history-element) - ([S-down] . ivy-next-history-element) - ("DEL" . ivy-backward-delete-char)) - :config - (setq ivy-wrap t - ;; ivy-height 14 - ivy-use-virtual-buffers t - ivy-virtual-abbreviate 'abbreviate - ivy-count-format "%d/%d ") - - (defvar b/ivy-ignore-buffer-modes '(magit-mode erc-mode dired-mode)) - (defun b/ivy-ignore-buffer-p (str) - "Return non-nil if str names a buffer with a major mode -derived from one of `b/ivy-ignore-buffer-modes'. - -This function is intended for use with `ivy-ignore-buffers'." - (let* ((buf (get-buffer str)) - (mode (and buf (buffer-local-value 'major-mode buf)))) - (and mode - (apply #'provided-mode-derived-p mode b/ivy-ignore-buffer-modes)))) - (add-to-list 'ivy-ignore-buffers 'b/ivy-ignore-buffer-p) - - (ivy-mode 1) - :custom-face - (ivy-minibuffer-match-face-1 ((t (:background "#eeeeee")))) - (ivy-minibuffer-match-face-2 ((t (:background "#e7e7e7" :weight bold)))) - (ivy-minibuffer-match-face-3 ((t (:background "light goldenrod" :weight semi-bold)))) - (ivy-minibuffer-match-face-4 ((t (:background "misty rose" :weight semi-bold)))) - (ivy-current-match ((((class color) (background light)) - :background "#d7d7d7" :foreground "black") - (((class color) (background dark)) - :background "#65a7e2" :foreground "black")))) - -(use-package swiper - :demand - :after ivy - :bind (("C-S-s" . swiper-isearch))) +;; (require 'bandali-ido) +(require 'bandali-ivy) -(use-package counsel - :demand - :after ivy - :bind (("C-c f r" . counsel-recentf) - :map minibuffer-local-map - ("C-r" . counsel-minibuffer-history)) - :config - (counsel-mode 1) - (defalias 'locate #'counsel-locate)) +(require 'bandali-eshell) -(use-package eshell - :defer 0.5 - :commands eshell - :bind ("C-c a s e" . eshell) - :config - (eval-when-compile (defvar eshell-prompt-regexp)) - (defun b/eshell-quit-or-delete-char (arg) - (interactive "p") - (if (and (eolp) (looking-back eshell-prompt-regexp nil)) - (eshell-life-is-too-much) - (delete-char arg))) - - (defun b/eshell-clear () - (interactive) - (let ((inhibit-read-only t)) - (erase-buffer)) - (eshell-send-input)) - - (defun b/eshell-setup () - (make-local-variable 'company-idle-delay) - (defvar company-idle-delay) - (setq company-idle-delay nil) - (bind-keys :map eshell-mode-map - ("C-d" . b/eshell-quit-or-delete-char) - ("C-S-l" . b/eshell-clear) - ("M-r" . counsel-esh-history) - ;; ([tab] . company-complete) - ) - (if (version< "27" emacs-version) - (bind-keys :map eshell-hist-mode-map - ("M-r" . counsel-esh-history)) - (bind-keys :map eshell-mode-map - ("M-r" . counsel-esh-history)))) - - (setq - eshell-prompt-regexp "\\(.*\n\\)*[$#] " - eshell-prompt-function - (lambda () - (concat - (propertize (format "%s@%s:" (user-login-name) (system-name)) - 'face 'default) - (propertize (abbreviate-file-name default-directory) - 'face 'font-lock-comment-face) - (propertize "\n" 'face 'default) - (if (= (user-uid) 0) - (propertize "#" 'face 'red) - (propertize "$" 'face 'default)) - (propertize " " 'face 'default)))) - - :hook (eshell-mode . b/eshell-setup) - :custom - (eshell-hist-ignoredups t) - (eshell-input-filter 'eshell-input-filter-initial-space)) - -(use-package ibuffer - :bind - (("C-x C-b" . ibuffer) - :map ibuffer-mode-map - ("P" . ibuffer-backward-filter-group) - ("N" . ibuffer-forward-filter-group) - ("M-p" . ibuffer-do-print) - ("M-n" . ibuffer-do-shell-command-pipe-replace)) - :config - ;; Use human readable Size column instead of original one - (define-ibuffer-column size-h - (:name "Size" :inline t) - (cond - ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0))) - ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0))) - ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0))) - (t (format "%8d" (buffer-size))))) - :custom - (ibuffer-saved-filter-groups - '(("default" - ("dired" (mode . dired-mode)) - ("org" (mode . org-mode)) - ("gnus" - (or - (mode . gnus-group-mode) - (mode . gnus-summary-mode) - (mode . gnus-article-mode) - ;; not really, but... - (mode . message-mode))) - ("web" - (or - ;; (mode . web-mode) - (mode . mhtml-mode) - (mode . css-mode) - (mode . scss-mode) - (mode . js2-mode))) - ("shell" - (or - (mode . eshell-mode) - (mode . shell-mode) - (mode . term-mode))) - ("programming" - (or - (mode . python-mode) - (mode . c-mode) - (mode . c++-mode) - (mode . java-mode) - (mode . emacs-lisp-mode) - (mode . scheme-mode) - (mode . haskell-mode) - (mode . lean-mode) - ;; (mode . go-mode) - (mode . alloy-mode))) - ("tex" - (or - (mode . bibtex-mode) - (mode . latex-mode))) - ("emacs" - (or - (name . "^\\*scratch\\*$") - (name . "^\\*Messages\\*$"))) - ("exwm" (mode . exwm-mode)) - ("erc" (mode . erc-mode))))) - (ibuffer-formats - '((mark modified read-only locked " " - (name 72 72 :left :elide) - " " - (size-h 9 -1 :right) - " " - (mode 16 16 :left :elide) - " " filename-and-process) - (mark " " - (name 16 -1) - " " filename))) - :hook (ibuffer . (lambda () (ibuffer-switch-to-saved-filter-groups "default")))) +(require 'bandali-ibuffer) (use-package outline :disabled @@ -1136,58 +611,11 @@ This function is intended for use with `ivy-ignore-buffers'." ("h" . outline-hide-subtree) ("s" . outline-show-subtree))) +(comment (use-package ls-lisp :custom (ls-lisp-dirs-first t)) -(use-package dired - :config - (setq dired-dwim-target t - dired-listing-switches "-alh" - ls-lisp-use-insert-directory-program nil) - - ;; easily diff 2 marked files - ;; https://oremacs.com/2017/03/18/dired-ediff/ - (defun dired-ediff-files () - (interactive) - (require 'dired-aux) - (defvar ediff-after-quit-hook-internal) - (let ((files (dired-get-marked-files)) - (wnd (current-window-configuration))) - (if (<= (length files) 2) - (let ((file1 (car files)) - (file2 (if (cdr files) - (cadr files) - (read-file-name - "file: " - (dired-dwim-target-directory))))) - (if (file-newer-than-file-p file1 file2) - (ediff-files file2 file1) - (ediff-files file1 file2)) - (add-hook 'ediff-after-quit-hook-internal - (lambda () - (setq ediff-after-quit-hook-internal nil) - (set-window-configuration wnd)))) - (error "no more than 2 files should be marked")))) - - (require 'dired-x) - (setq dired-guess-shell-alist-user - '(("\\.pdf\\'" "evince" "zathura" "okular") - ("\\.doc\\'" "libreoffice") - ("\\.docx\\'" "libreoffice") - ("\\.ppt\\'" "libreoffice") - ("\\.pptx\\'" "libreoffice") - ("\\.xls\\'" "libreoffice") - ("\\.xlsx\\'" "libreoffice") - ("\\.flac\\'" "mpv"))) - :bind (:map dired-mode-map - ("b" . dired-up-directory) - ("E" . dired-ediff-files) - ("e" . dired-toggle-read-only) - ("\\" . dired-hide-details-mode) - ("z" . (lambda () - (interactive) - (b/dired-start-process "zathura")))) - :hook (dired-mode . dired-hide-details-mode)) +(require 'bandali-dired) (use-package help :config @@ -2550,6 +1978,7 @@ https://csclub.uwaterloo.ca/~abandali") ;;; Post initialization +) (message "Loading %s...done (%.3fs)" user-init-file (float-time (time-subtract (current-time) b/before-user-init-time)))