From 8b1a2f3244208cebd3dc595d8e7027bb9c5c3625 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Sun, 12 Apr 2020 12:40:55 -0400 Subject: [PATCH 1/1] Assimilate 11 drones (no-littering, magit, ivy, org, and their deps) Assimilate amx v3.3-7-ge512e74 Assimilate async v1.9.4-13-g86aef2c Assimilate dash 2.17.0 Assimilate ivy 0.13.0-189-g64f05f4 Assimilate libgit 6c3b892 Assimilate magit v2.90.1-955-g0f1234e7 Assimilate no-littering v1.0.3-13-g92661bc Assimilate org release_9.3.6-479-g32d8f2f32 Assimilate s 1.12.0-12-g43ba8b5 Assimilate transient v0.2.0-1-gafa0c2f Assimilate with-editor v2.9.1-3-g4fe66d4 Also, move exwm things from init.el out to lisp/bandali-exwm.el. --- .gitmodules | 46 ++++++++ init.el | 243 +++---------------------------------------- lib/amx | 1 + lib/async | 1 + lib/dash | 1 + lib/ivy | 1 + lib/libgit | 1 + lib/magit | 1 + lib/no-littering | 1 + lib/org | 1 + lib/s | 1 + lib/transient | 1 + lib/with-editor | 1 + lisp/bandali-exwm.el | 212 +++++++++++++++++++++++++++++++++++++ 14 files changed, 286 insertions(+), 226 deletions(-) create mode 160000 lib/amx create mode 160000 lib/async create mode 160000 lib/dash create mode 160000 lib/ivy create mode 160000 lib/libgit create mode 160000 lib/magit create mode 160000 lib/no-littering create mode 160000 lib/org create mode 160000 lib/s create mode 160000 lib/transient create mode 160000 lib/with-editor create mode 100644 lisp/bandali-exwm.el diff --git a/.gitmodules b/.gitmodules index 61b63fa..003c015 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,58 @@ +[submodule "amx"] + path = lib/amx + url = https://github.com/DarwinAwardWinner/amx.git +[submodule "async"] + path = lib/async + url = https://github.com/jwiegley/emacs-async.git [submodule "auto-compile"] path = lib/auto-compile url = https://github.com/emacscollective/auto-compile.git [submodule "borg"] path = lib/borg url = https://github.com/emacscollective/borg.git +[submodule "dash"] + path = lib/dash + url = https://github.com/magnars/dash.el.git + no-makeinfo = dash-template.texi + # dash creates a `dir' dash info file, which makes git think + # that the submodule is dirty. so, let's ignore the untracked + # files of dash's submodule + ignore = untracked +[submodule "ivy"] + path = lib/ivy + url = https://github.com/abo-abo/swiper.git + info-path = doc +[submodule "libgit"] + path = lib/libgit + url = https://github.com/magit/libegit2.git + build-step = make +[submodule "magit"] + path = lib/magit + url = https://github.com/magit/magit.git + recursive-byte-compile = true + info-path = Documentation +[submodule "no-littering"] + path = lib/no-littering + url = https://github.com/emacscollective/no-littering.git +[submodule "org"] + path = lib/org + url = https://code.orgmode.org/bzg/org-mode.git + build-step = make + load-path = lisp + load-path = contrib/lisp + info-path = doc [submodule "packed"] path = lib/packed url = https://github.com/emacscollective/packed.git +[submodule "s"] + path = lib/s + url = https://github.com/magnars/s.el.git +[submodule "transient"] + path = lib/transient + url = https://github.com/magit/transient.git [submodule "use-package"] path = lib/use-package url = https://github.com/jwiegley/use-package.git +[submodule "with-editor"] + path = lib/with-editor + url = https://github.com/magit/with-editor.git diff --git a/init.el b/init.el index 22b7b68..f8f755a 100644 --- a/init.el +++ b/init.el @@ -42,6 +42,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 +69,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 @@ -138,9 +141,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 @@ -483,6 +483,7 @@ For disabling the behaviour for certain buffers and/or modes." :after epg-config) (use-package pinentry + :disabled :demand :after (epa epg server) :config @@ -542,222 +543,10 @@ 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) - -(use-package exwm-edit - :demand - :after exwm) - -;; use the org-plus-contrib package to get the whole deal -(use-package org-plus-contrib) +(when b/exwm-p + (require 'bandali-exwm)) (use-package org - :defer 0.5 :config (setq org-src-tab-acts-natively t org-src-preserve-indentation nil @@ -1007,6 +796,7 @@ This function is intended for use with `ivy-ignore-buffers'." (counsel-mode 1) (defalias 'locate #'counsel-locate)) +(comment (use-package eshell :defer 0.5 :commands eshell @@ -2569,6 +2359,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))) diff --git a/lib/amx b/lib/amx new file mode 160000 index 0000000..e512e74 --- /dev/null +++ b/lib/amx @@ -0,0 +1 @@ +Subproject commit e512e74e8368f9b1cf83bee16dd2522f3b1dbeea diff --git a/lib/async b/lib/async new file mode 160000 index 0000000..86aef2c --- /dev/null +++ b/lib/async @@ -0,0 +1 @@ +Subproject commit 86aef2c38e7d35e8509b7feeee3e989d825eba91 diff --git a/lib/dash b/lib/dash new file mode 160000 index 0000000..721436b --- /dev/null +++ b/lib/dash @@ -0,0 +1 @@ +Subproject commit 721436b04da4e2795387cb48a98ac6de37ece0fd diff --git a/lib/ivy b/lib/ivy new file mode 160000 index 0000000..64f05f4 --- /dev/null +++ b/lib/ivy @@ -0,0 +1 @@ +Subproject commit 64f05f4735bba8b708bc12cfc2cbfb7fb7706787 diff --git a/lib/libgit b/lib/libgit new file mode 160000 index 0000000..6c3b892 --- /dev/null +++ b/lib/libgit @@ -0,0 +1 @@ +Subproject commit 6c3b89276a149b2d009882f756a9edf866671f05 diff --git a/lib/magit b/lib/magit new file mode 160000 index 0000000..0f1234e --- /dev/null +++ b/lib/magit @@ -0,0 +1 @@ +Subproject commit 0f1234e785747b2865eb8aa5205f4e4eafceeb86 diff --git a/lib/no-littering b/lib/no-littering new file mode 160000 index 0000000..92661bc --- /dev/null +++ b/lib/no-littering @@ -0,0 +1 @@ +Subproject commit 92661bc9b33af1e9d405d23f226c1fc80c0c9c01 diff --git a/lib/org b/lib/org new file mode 160000 index 0000000..32d8f2f --- /dev/null +++ b/lib/org @@ -0,0 +1 @@ +Subproject commit 32d8f2f32e5fb0cd597d240b4976cb83cab44edf diff --git a/lib/s b/lib/s new file mode 160000 index 0000000..43ba8b5 --- /dev/null +++ b/lib/s @@ -0,0 +1 @@ +Subproject commit 43ba8b563bee3426cead0e6d4ddc09398e1a349d diff --git a/lib/transient b/lib/transient new file mode 160000 index 0000000..afa0c2f --- /dev/null +++ b/lib/transient @@ -0,0 +1 @@ +Subproject commit afa0c2f98453b9ffd9d8160831debc7e36cdb87b diff --git a/lib/with-editor b/lib/with-editor new file mode 160000 index 0000000..4fe66d4 --- /dev/null +++ b/lib/with-editor @@ -0,0 +1 @@ +Subproject commit 4fe66d4d55c8eacebda53a13cc38e01d32bdaaa2 diff --git a/lisp/bandali-exwm.el b/lisp/bandali-exwm.el new file mode 100644 index 0000000..d9be901 --- /dev/null +++ b/lisp/bandali-exwm.el @@ -0,0 +1,212 @@ +(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) + +(use-package exwm-edit + :demand + :after exwm) + +(provide 'bandali-exwm) -- 2.20.1