]> jturnerusa.dev Git - emacs.d/commitdiff
init
authorJohn Turner <jturner.usa@gmail.com>
Mon, 4 Jul 2022 01:29:51 +0000 (21:29 -0400)
committerJohn Turner <jturner.usa@gmail.com>
Mon, 4 Jul 2022 01:29:51 +0000 (21:29 -0400)
45 files changed:
.gitignore [new file with mode: 0644]
config/company/config-company.el [new file with mode: 0644]
config/conf-mode/config-conf-mode-hooks.el [new file with mode: 0644]
config/conf-mode/config-conf-mode.el [new file with mode: 0644]
config/config.el [new file with mode: 0644]
config/dired/config-dired.el [new file with mode: 0644]
config/display-buffer/config-display-buffer-alist.el [new file with mode: 0644]
config/display-buffer/config-display-buffer.el [new file with mode: 0644]
config/eglot/config-eglot-servers.el [new file with mode: 0644]
config/eglot/config-eglot.el [new file with mode: 0644]
config/eldoc/config-eldoc.el [new file with mode: 0644]
config/electric/config-electric.el [new file with mode: 0644]
config/files/config-files-backup-on-save-hook.el [new file with mode: 0644]
config/files/config-files.el [new file with mode: 0644]
config/flycheck/config-flycheck-cargo-has-command-p-fix.el [new file with mode: 0644]
config/flycheck/config-flycheck.el [new file with mode: 0644]
config/flymake/config-flymake-hooks.el [new file with mode: 0644]
config/flymake/config-flymake.el [new file with mode: 0644]
config/garbage-collection/config-garbage-collection.el [new file with mode: 0644]
config/keys/config-keys.el [new file with mode: 0644]
config/lsp-mode/config-lsp-mode-disable-install-server.el [new file with mode: 0644]
config/lsp-mode/config-lsp-mode.el [new file with mode: 0644]
config/man/config-man-helper-functions.el [new file with mode: 0644]
config/man/config-man.el [new file with mode: 0644]
config/native-comp/config-native-comp.el [new file with mode: 0644]
config/package/config-package.el [new file with mode: 0644]
config/prog-mode/config-prog-mode-hooks.el [new file with mode: 0644]
config/prog-mode/config-prog-mode.el [new file with mode: 0644]
config/programming-languages/c/config-c-functions.el [new file with mode: 0644]
config/programming-languages/c/config-c.el [new file with mode: 0644]
config/programming-languages/config-programming-languages.el [new file with mode: 0644]
config/programming-languages/shell/config-shell.el [new file with mode: 0644]
config/project/config-project-find-rust-projects.el [new file with mode: 0644]
config/project/config-project.el [new file with mode: 0644]
config/recentf/config-recentf.el [new file with mode: 0644]
config/savehist/config-savehist.el [new file with mode: 0644]
config/text-mode/config-text-mode-hooks.el [new file with mode: 0644]
config/text-mode/config-text-mode.el [new file with mode: 0644]
config/tramp/config-tramp-connection-properties.el [new file with mode: 0644]
config/tramp/config-tramp-sudo-hang-fix.el [new file with mode: 0644]
config/tramp/config-tramp.el [new file with mode: 0644]
custom.el [new file with mode: 0644]
init.el [new file with mode: 0644]
themes/custom-wombat-theme.el [new file with mode: 0644]
themes/github-dim-theme.el [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..42200f5
--- /dev/null
@@ -0,0 +1,6 @@
+/*
+!/.gitignore
+!/init.el
+!/custom.el
+!/themes
+!/config
\ No newline at end of file
diff --git a/config/company/config-company.el b/config/company/config-company.el
new file mode 100644 (file)
index 0000000..e98e2a2
--- /dev/null
@@ -0,0 +1,8 @@
+(require 'company)
+
+(setq company-idle-delay 0
+      company-clang-executable "/usr/lib/llvm/11/bin/clang"
+      company-clang-insert-arguments nil
+      company-minimum-prefix-length 1)
+
+(provide 'config-company)
diff --git a/config/conf-mode/config-conf-mode-hooks.el b/config/conf-mode/config-conf-mode-hooks.el
new file mode 100644 (file)
index 0000000..c662e45
--- /dev/null
@@ -0,0 +1 @@
+(setq conf-mode-hook (copy-tree text-mode-hook))
diff --git a/config/conf-mode/config-conf-mode.el b/config/conf-mode/config-conf-mode.el
new file mode 100644 (file)
index 0000000..1e1554b
--- /dev/null
@@ -0,0 +1,5 @@
+(require 'config-text-mode)
+
+(load "config-conf-mode-hooks")
+
+(provide 'config-conf-mode)
diff --git a/config/config.el b/config/config.el
new file mode 100644 (file)
index 0000000..837282c
--- /dev/null
@@ -0,0 +1,54 @@
+(require 'seq)
+
+(defvar config-directory (file-name-directory (locate-library "config")))
+
+(defun config-add-modules-to-load-path (directory)
+  (let* ((pattern (file-name-concat directory "*"))
+         (results (file-expand-wildcards pattern))
+         (directories (seq-filter 'file-directory-p results))
+         (non-hidden (seq-filter (lambda (d)
+                                   (let ((base (file-name-base d)))
+                                     (not (string-prefix-p "." base))))
+                                 directories)))
+    (mapc (lambda (m)
+            (add-to-list 'load-path m))
+          non-hidden)))
+
+(config-add-modules-to-load-path config-directory)
+
+(require 'config-dired)
+(require 'config-display-buffer)
+(require 'config-eldoc)
+(require 'config-electric)
+(require 'config-files)
+(require 'config-flymake)
+(require 'config-garbage-collection)
+(require 'config-keys)
+(require 'config-man)
+(require 'config-package)
+(require 'config-programming-languages)
+(require 'config-project)
+(require 'config-recentf)
+(require 'config-savehist)
+(require 'config-tramp)
+
+(require 'config-text-mode)
+(require 'config-conf-mode)
+(require 'config-prog-mode)
+
+(when (locate-library "company")
+  (require 'config-company))
+
+(when (locate-library "eglot")
+  (require 'config-eglot))
+
+(when (locate-library "flycheck")
+  (require 'config-flycheck))
+
+(when (locate-library "lsp-mode")
+  (require 'config-lsp-mode))
+
+(when (and (>= emacs-major-version 28) (native-comp-available-p))
+  (require 'config-native-comp))
+
+(provide 'config)
diff --git a/config/dired/config-dired.el b/config/dired/config-dired.el
new file mode 100644 (file)
index 0000000..d037bfb
--- /dev/null
@@ -0,0 +1,4 @@
+(setq dired-listing-switches "-alh"
+      dired-kill-when-opening-new-dired-buffer t)
+
+(provide 'config-dired)
diff --git a/config/display-buffer/config-display-buffer-alist.el b/config/display-buffer/config-display-buffer-alist.el
new file mode 100644 (file)
index 0000000..caf2229
--- /dev/null
@@ -0,0 +1,23 @@
+(defvar config-display-buffer-gaps-width 20)
+
+(defun config-display-buffer-which-side ()
+  (if (> (+ (frame-pixel-width) config-display-buffer-gaps-width) (/ (x-display-pixel-width) 2))
+      'right
+    'bottom))
+
+(defun config-display-buffer-update-alist (_)
+  (let ((side (config-display-buffer-which-side)))
+    (setq display-buffer-alist `(("\\*Flymake diagnostics.*"
+                                  (display-buffer-in-side-window)
+                                  (side . ,side)
+                                  (window-height . 15)
+                                 (window-width  . 75)
+                                 ("\*Flycheck errors\*"
+                                  (display-buffer-in-side-window)
+                                  (side . ,side)
+                                  (window-height . 15)
+                                  (window-width . 75)))))))
+
+(add-hook 'after-make-frame-functions 'config-display-buffer-update-alist)
+
+(add-hook 'window-size-change-functions 'config-display-buffer-update-alist)
diff --git a/config/display-buffer/config-display-buffer.el b/config/display-buffer/config-display-buffer.el
new file mode 100644 (file)
index 0000000..c36d35f
--- /dev/null
@@ -0,0 +1,5 @@
+(setq display-buffer-base-action '(display-buffer-same-window display-buffer-reuse-window))
+
+(load "config-display-buffer-alist")
+
+(provide 'config-display-buffer)
diff --git a/config/eglot/config-eglot-servers.el b/config/eglot/config-eglot-servers.el
new file mode 100644 (file)
index 0000000..833766d
--- /dev/null
@@ -0,0 +1,9 @@
+(defvar config-eglot-server-clangd '((c-mode c++-mode) .
+                                     ("clangd"
+                                      "--header-insersion=never")))
+
+(defvar config-eglot-server-rust-analyzer '((rust-mode) .
+                                            ("rust-analyzer")))
+  
+(add-to-list 'eglot-server-programs config-eglot-server-clangd)
+(add-to-list 'eglot-server-programs config-eglot-server-rust-analyzer)
diff --git a/config/eglot/config-eglot.el b/config/eglot/config-eglot.el
new file mode 100644 (file)
index 0000000..17b36de
--- /dev/null
@@ -0,0 +1,7 @@
+(require 'eglot)
+
+(setq eglot-autoshutdown t)
+
+(load "config-eglot-servers")
+
+(provide 'config-eglot)
diff --git a/config/eldoc/config-eldoc.el b/config/eldoc/config-eldoc.el
new file mode 100644 (file)
index 0000000..9513919
--- /dev/null
@@ -0,0 +1,4 @@
+(setq eldoc-idle-delay 0
+      eldoc-echo-area-use-multiline-p 5)
+
+(provide 'config-eldoc)
diff --git a/config/electric/config-electric.el b/config/electric/config-electric.el
new file mode 100644 (file)
index 0000000..a401739
--- /dev/null
@@ -0,0 +1,7 @@
+(require 'electric)
+(require 'elec-pair)
+
+(add-to-list 'electric-pair-pairs '("?(" . "?)"))
+(add-to-list 'electric-pair-pairs '("?{" . "?}"))
+
+(provide 'config-electric)
diff --git a/config/files/config-files-backup-on-save-hook.el b/config/files/config-files-backup-on-save-hook.el
new file mode 100644 (file)
index 0000000..53b96d1
--- /dev/null
@@ -0,0 +1,50 @@
+(defvar config-files-backup-directory (file-name-concat user-emacs-directory "backups"))
+
+(unless (file-exists-p config-files-backup-directory)
+  (mkdir config-files-backup-directory))
+
+(defun config-files-format-backup-path (path number)
+  (format "%s.~%s~" path number))
+
+(defun config-files-backup-extension (path)
+  (let* ((i (string-search "." (reverse path)))
+         (extension (substring path (- (length path) i))))
+    extension))
+
+(defun config-files-backup-no-extension (path)
+  (let* ((i (string-search "." (reverse path)))
+         (no-extension (substring path 0 (- (length path) (+ i 1)))))
+    no-extension))
+
+(defun config-files-backup-number (path)
+  (let* ((extension (config-files-backup-extension path))
+         (extracted (substring extension 1 (- (length extension) 1)))
+         (as-number (unless (zerop (length extracted))
+                      (string-to-number extracted))))
+    as-number))
+
+(defun config-files-shift-path (path)
+  (let* ((without-extension (config-files-backup-no-extension path))
+         (number (config-files-backup-number path))
+         (next-number (+ number 1))
+         (shifted-path (config-files-format-backup-path
+                        without-extension
+                        next-number)))
+    shifted-path))
+
+(defun config-files-shift-backup (path)
+  (let ((next-path (config-files-shift-path path)))
+    (when (file-exists-p next-path)
+        (config-files-shift-backup next-path))
+    (rename-file path next-path)))
+
+(defun config-files-backup-before-save ()
+  (unless backup-inhibited
+    (let* ((path (buffer-file-name))
+           (backup-path (config-files-format-backup-path path 0)))
+      (when (file-exists-p path)
+        (when (file-exists-p backup-path)
+          (config-files-shift-backup backup-path))
+        (copy-file path backup-path)))))
+
+(add-hook 'before-save-hook 'config-files-backup-before-save)
diff --git a/config/files/config-files.el b/config/files/config-files.el
new file mode 100644 (file)
index 0000000..9e92ee4
--- /dev/null
@@ -0,0 +1,3 @@
+(load "config-files-backup-on-save-hook")
+
+(provide 'config-files)
diff --git a/config/flycheck/config-flycheck-cargo-has-command-p-fix.el b/config/flycheck/config-flycheck-cargo-has-command-p-fix.el
new file mode 100644 (file)
index 0000000..1135165
--- /dev/null
@@ -0,0 +1,7 @@
+(defun config-flycheck-rust-cargo-has-command-p (command)
+  (let* ((commands (process-lines "cargo" "--list"))
+         (trimmed (-map (lambda (row) (-slice row 4 (string-search " " 4))) commands)))
+    (seq-contains-p (-rest trimmed) command)))
+
+(advice-add 'flycheck-rust-cargo-has-command-p
+            :override 'config-flycheck-rust-cargo-has-command-p)
diff --git a/config/flycheck/config-flycheck.el b/config/flycheck/config-flycheck.el
new file mode 100644 (file)
index 0000000..7478606
--- /dev/null
@@ -0,0 +1,7 @@
+(require 'flycheck)
+
+(add-hook 'flycheck-error-list-mode-hook (lambda () (visual-line-mode 1)))
+
+(load "config-flycheck-cargo-has-command-p-fix")
+
+(provide 'config-flycheck)
diff --git a/config/flymake/config-flymake-hooks.el b/config/flymake/config-flymake-hooks.el
new file mode 100644 (file)
index 0000000..a19bc3c
--- /dev/null
@@ -0,0 +1,2 @@
+(add-hook 'flymake-diagnostics-buffer-mode-hook (lambda ()
+                                                  (visual-line-mode 1)))
diff --git a/config/flymake/config-flymake.el b/config/flymake/config-flymake.el
new file mode 100644 (file)
index 0000000..203e52b
--- /dev/null
@@ -0,0 +1,5 @@
+(require 'flymake)
+
+(load "config-flymake-hooks")
+
+(provide 'config-flymake)
diff --git a/config/garbage-collection/config-garbage-collection.el b/config/garbage-collection/config-garbage-collection.el
new file mode 100644 (file)
index 0000000..1540baf
--- /dev/null
@@ -0,0 +1,3 @@
+(setq gc-cons-threshold (* (expt 1024 2) 25))
+
+(provide 'config-garbage-collection)
diff --git a/config/keys/config-keys.el b/config/keys/config-keys.el
new file mode 100644 (file)
index 0000000..6d74b0a
--- /dev/null
@@ -0,0 +1,11 @@
+(global-unset-key (kbd "<left>"))
+(global-unset-key (kbd "<right>"))
+(global-unset-key (kbd "<up>"))
+(global-unset-key (kbd "<down>"))
+(global-unset-key (kbd "<C-left>"))
+(global-unset-key (kbd "<C-right>"))
+(global-unset-key (kbd "<C-up>"))
+(global-unset-key (kbd "<C-down>"))
+(global-set-key   (kbd "C-x k")     'kill-buffer)
+
+(provide 'config-keys)
diff --git a/config/lsp-mode/config-lsp-mode-disable-install-server.el b/config/lsp-mode/config-lsp-mode-disable-install-server.el
new file mode 100644 (file)
index 0000000..7a3c415
--- /dev/null
@@ -0,0 +1,40 @@
+(setq lsp-server-install-dir "/somewhere/that/doesnt/exist")
+
+(defun config-lsp-mode-disable-install-server-error ()
+  (error "lsp-mode server install features have been disabled"))
+
+(advice-add 'lsp-install-server
+            :around
+            'config-lsp-mode-disable-install-server-error)
+
+(advice-add 'lsp-update-server
+            :around
+            'config-lsp-mode-disable-install-server-error)
+
+(advice-add 'lsp-update-servers
+            :around
+            'config-lsp-mode-disable-install-server-error)
+
+(advice-add 'lsp-download-install
+            :around
+            'config-lsp-mode-disable-install-server-error)
+
+(advice-add 'lsp-download-path
+            :around
+            'config-lsp-mode-disable-install-server-error)
+
+(advice-add 'lsp-async-start-process
+            :around
+            'config-lsp-mode-disable-install-server-error)
+
+(advice-add 'lsp--download-status
+            :around
+            'config-lsp-mode-disable-install-server-error)
+
+(advice-add 'lsp--install-server-internal
+            :around
+            'config-lsp-mode-disable-install-server-error)
+
+(advice-add 'lsp--npm-dependency-install
+            :around
+            'config-lsp-mode-disable-install-server-error)
diff --git a/config/lsp-mode/config-lsp-mode.el b/config/lsp-mode/config-lsp-mode.el
new file mode 100644 (file)
index 0000000..a42498e
--- /dev/null
@@ -0,0 +1,19 @@
+(require 'lsp-mode)
+(require 'flycheck)
+
+(setq lsp-enable-dap-auto-configure nil
+      lsp-enable-folding nil
+      lsp-enable-indentation t
+      lsp-enable-on-type-formatting nil
+      lsp-completion-enable nil
+      lsp-enable-snippet nil
+      lsp-modeline-code-actions-enable nil
+      lsp-lens-enable nil
+      lsp-signature-auto-activate nil
+      lsp-eldoc-render-all t
+      lsp-rls-server-command nil
+      lsp-enable-suggest-server-download nil)
+
+(load "config-lsp-mode-disable-install-server")
+
+(provide 'config-lsp-mode)
diff --git a/config/man/config-man-helper-functions.el b/config/man/config-man-helper-functions.el
new file mode 100644 (file)
index 0000000..a58ba75
--- /dev/null
@@ -0,0 +1,31 @@
+(defun config-man-pages ()
+  (let* ((manpath (getenv "MANPATH"))
+         (directories (split-string manpath ":" t))
+         (that-exist (seq-filter 'file-exists-p directories))
+         (files (mapcar (lambda (d)
+                          (directory-files-recursively d ".*" nil))
+                        that-exist))
+         (flattened (flatten-list files))
+         (pages (mapcar 'file-name-nondirectory flattened))
+         (without-second-ext (mapcar (lambda (p)
+                                       (let ((extension (file-name-extension p)))
+                                         (if (string-match-p "^[0-9+]$" extension)
+                                             p
+                                           (file-name-sans-extension p))))
+                                     pages)))
+    without-second-ext))
+
+(defun config-man-locate-page (page)
+  (with-temp-buffer
+    (let ((exit-code (call-process "man" nil (current-buffer) nil "--where" page)))
+      (when exit-code
+        (let* ((output (buffer-string))
+               (trimmed (string-trim-right output "\n")))
+          trimmed)))))
+
+(defun config-man-advice (orig &rest args)
+  (interactive)
+  (let ((page (or args (list (completing-read "Select page: " (config-man-pages) nil t)))))
+    (apply orig page)))
+
+(advice-add 'man :around 'config-man-advice)
diff --git a/config/man/config-man.el b/config/man/config-man.el
new file mode 100644 (file)
index 0000000..566420e
--- /dev/null
@@ -0,0 +1,5 @@
+(setq Man-notify-method 'pushy)
+
+(load "config-man-helper-functions")
+
+(provide 'config-man)
diff --git a/config/native-comp/config-native-comp.el b/config/native-comp/config-native-comp.el
new file mode 100644 (file)
index 0000000..c44a984
--- /dev/null
@@ -0,0 +1,3 @@
+(setq native-comp-async-jobs-number (string-to-number (shell-command-to-string "nproc")))
+
+(provide 'config-native-comp)
diff --git a/config/package/config-package.el b/config/package/config-package.el
new file mode 100644 (file)
index 0000000..d3be495
--- /dev/null
@@ -0,0 +1,4 @@
+(setq package-archives nil
+      package-check-signature 'all)
+
+(provide 'config-package)
diff --git a/config/prog-mode/config-prog-mode-hooks.el b/config/prog-mode/config-prog-mode-hooks.el
new file mode 100644 (file)
index 0000000..a3c63e0
--- /dev/null
@@ -0,0 +1 @@
+(setq prog-mode-hook (copy-tree text-mode-hook))
diff --git a/config/prog-mode/config-prog-mode.el b/config/prog-mode/config-prog-mode.el
new file mode 100644 (file)
index 0000000..5caf9f2
--- /dev/null
@@ -0,0 +1,5 @@
+(require 'config-text-mode)
+
+(load "config-prog-mode-hooks")
+
+(provide 'config-prog-mode)
diff --git a/config/programming-languages/c/config-c-functions.el b/config/programming-languages/c/config-c-functions.el
new file mode 100644 (file)
index 0000000..b60d38c
--- /dev/null
@@ -0,0 +1,4 @@
+(defun config-c-mode-insert-header-guard ()
+  (interactive)
+  (let ((guard (upcase (format "%s_H" (file-name-base (buffer-file-name))))))
+    (insert (format "#ifndef %s\n#define %s\n#endif" guard guard))))
diff --git a/config/programming-languages/c/config-c.el b/config/programming-languages/c/config-c.el
new file mode 100644 (file)
index 0000000..3cb6a32
--- /dev/null
@@ -0,0 +1,5 @@
+(setq c-default-style "stroustrup" c-basic-offset 4)
+
+(load "config-c-functions")
+
+(provide 'config-c)
diff --git a/config/programming-languages/config-programming-languages.el b/config/programming-languages/config-programming-languages.el
new file mode 100644 (file)
index 0000000..3976cce
--- /dev/null
@@ -0,0 +1,14 @@
+(defvar config-programming-languages-directory (file-name-directory
+                                               (locate-library "config-programming-languages")))
+
+(defvar config-programming-languages-modules '(c shell))
+
+(mapc (lambda (module)
+       (let ((module-load-path (file-name-concat config-programming-languages-directory (symbol-name module))))
+         (add-to-list 'load-path module-load-path)))
+      config-programming-languages-modules)
+
+(require 'config-c)
+(require 'config-shell)
+
+(provide 'config-programming-languages)
diff --git a/config/programming-languages/shell/config-shell.el b/config/programming-languages/shell/config-shell.el
new file mode 100644 (file)
index 0000000..0c1e82c
--- /dev/null
@@ -0,0 +1,3 @@
+(setq sh-shell-file "/bin/bash")
+
+(provide 'config-shell)
diff --git a/config/project/config-project-find-rust-projects.el b/config/project/config-project-find-rust-projects.el
new file mode 100644 (file)
index 0000000..65359bd
--- /dev/null
@@ -0,0 +1,4 @@
+(add-to-list 'project-find-functions (lambda (directory)
+                                       (let ((rust-project (locate-dominating-file directory "Cargo.toml")))
+                                         (when rust-project
+                                           (cons 'transient rust-project)))))
diff --git a/config/project/config-project.el b/config/project/config-project.el
new file mode 100644 (file)
index 0000000..c4c61ea
--- /dev/null
@@ -0,0 +1,3 @@
+(load "config-project-find-rust-projects")
+
+(provide 'config-project)
diff --git a/config/recentf/config-recentf.el b/config/recentf/config-recentf.el
new file mode 100644 (file)
index 0000000..3b7466a
--- /dev/null
@@ -0,0 +1,4 @@
+(setq recentf-max-menu-items 25
+      recentf-max-saved-items 25)
+
+(provide 'config-recentf)
diff --git a/config/savehist/config-savehist.el b/config/savehist/config-savehist.el
new file mode 100644 (file)
index 0000000..7a1cc40
--- /dev/null
@@ -0,0 +1,11 @@
+(require 'savehist)
+
+(setq savehist-file (expand-file-name "savehist" user-emacs-directory)
+      savehist-save-minibuffer-history t)
+
+(add-to-list 'savehist-additional-variables 'command-history)
+
+(unless (file-exists-p savehist-file)
+  (make-empty-file savehist-file))
+
+(provide 'config-savehist)
diff --git a/config/text-mode/config-text-mode-hooks.el b/config/text-mode/config-text-mode-hooks.el
new file mode 100644 (file)
index 0000000..f740e0c
--- /dev/null
@@ -0,0 +1,9 @@
+(add-hook 'text-mode-hook (lambda ()         
+                            (display-line-numbers-mode 1)
+                            (visual-line-mode 1)
+                            (display-fill-column-indicator-mode 1)
+                            (electric-pair-mode 1)
+                            (electric-indent-mode 1)
+                            (setq-local display-fill-column-indicator-column 120)
+                            (when (require 'highlight-indentation nil t)
+                              (highlight-indentation-mode 1))))
diff --git a/config/text-mode/config-text-mode.el b/config/text-mode/config-text-mode.el
new file mode 100644 (file)
index 0000000..f2a832e
--- /dev/null
@@ -0,0 +1,3 @@
+(load "config-text-mode-hooks")
+
+(provide 'config-text-mode)
diff --git a/config/tramp/config-tramp-connection-properties.el b/config/tramp/config-tramp-connection-properties.el
new file mode 100644 (file)
index 0000000..88f2dfd
--- /dev/null
@@ -0,0 +1,2 @@
+(add-to-list 'tramp-connection-properties (list (regexp-quote (format "/sudo:root@%s:" system-name))
+                                                "session-timeout" (* 60 20)))
diff --git a/config/tramp/config-tramp-sudo-hang-fix.el b/config/tramp/config-tramp-sudo-hang-fix.el
new file mode 100644 (file)
index 0000000..3882f28
--- /dev/null
@@ -0,0 +1,3 @@
+(defun sudo-edit ()
+  (interactive)
+  (find-file (format "/sudo:root@%s:%s" system-name (read-file-name "Edit as root: "))))
diff --git a/config/tramp/config-tramp.el b/config/tramp/config-tramp.el
new file mode 100644 (file)
index 0000000..e50ff1d
--- /dev/null
@@ -0,0 +1,10 @@
+(require 'tramp)
+
+(setq password-cache nil
+      password-cache-expiry 0
+      tramp-persistency-file-name nil)
+
+(load "config-tramp-connection-properties")
+(load "config-tramp-sudo-hang-fix")
+
+(provide 'config-tramp)
diff --git a/custom.el b/custom.el
new file mode 100644 (file)
index 0000000..87ef0b4
--- /dev/null
+++ b/custom.el
@@ -0,0 +1,22 @@
+(custom-set-variables
+ ;; custom-set-variables was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(safe-local-variable-values
+   '((rust-rustfmt-switches "--edition" "2021")
+     (projectile-package-compilation-cmd . "/home/notroot/bin/cargo-wrapper build")
+     (projectile-package-test-cmd . "/home/notroot/bin/cargo-wrapper test")
+     (projectile-package-compilation-cmd . "nonet cargo build")
+     (projectile-package-test-cmd . "nonet cargo test")
+     (projectile-package-cmd . "nonet cargo test")
+     (eval lsp)
+     (eval eglot-ensure)))
+ '(warning-suppress-types '((comp))))
+(custom-set-faces
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(default ((t (:family "Noto Sans Mono" :foundry "GOOG" :slant normal :weight normal :height 98 :width normal))))
+ '(flymake-error ((t (:underline nil)))))
diff --git a/init.el b/init.el
new file mode 100644 (file)
index 0000000..fafe2a5
--- /dev/null
+++ b/init.el
@@ -0,0 +1,35 @@
+(add-to-list 'load-path (file-name-concat user-emacs-directory "config"))
+
+(require 'config)
+
+(setq auth-source-save-behavior nil
+      auto-save-default nil
+      change-major-mode-with-file-name nil
+      custom-buffer-indent 4
+      custom-file (file-name-concat user-emacs-directory "custom.el")
+      custom-theme-directory (file-name-concat user-emacs-directory "themes/")
+      inhibit-splash-screen t
+      make-backup-files nil
+      tab-width 4)
+
+(setq-default display-fill-column-indicator-column 120
+              mode-line-format (list "%b (%m)")
+              indent-tabs-mode nil)
+
+(when (file-exists-p (file-name-concat custom-theme-directory "custom-wombat-theme.el"))
+  (load-theme 'custom-wombat t))
+
+(when (file-exists-p custom-file)
+  (load custom-file))
+
+(cua-mode 1)
+(recentf-mode 1)
+(savehist-mode 1)
+(save-place-mode 1)
+(show-paren-mode 1)
+(pixel-scroll-mode 1)
+(pixel-scroll-precision-mode 1)
+(menu-bar-mode 0)
+(scroll-bar-mode 0)
+(tool-bar-mode 0)
+(tooltip-mode 0)
diff --git a/themes/custom-wombat-theme.el b/themes/custom-wombat-theme.el
new file mode 100644 (file)
index 0000000..a205f18
--- /dev/null
@@ -0,0 +1,120 @@
+;;; wombat-theme.el --- Custom face theme for Emacs  -*- lexical-binding:t -*-
+
+;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+
+;; Author: Kristoffer Grönlund <krig@koru.se>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(deftheme custom-wombat
+  "Medium-contrast faces with a dark gray background.
+Adapted, with permission, from a Vim color scheme by Lars H. Nielsen.
+Basic, Font Lock, Isearch, Gnus, Message, and Ansi-Color faces
+are included.")
+
+(let ((class '((class color) (min-colors 89))))
+  (custom-theme-set-faces
+   'custom-wombat
+   `(default ((,class (:background "#242424" :foreground "#f6f3e8"))))
+   `(cursor ((,class (:background "#656565"))))
+   ;; Highlighting faces
+   `(fringe ((,class (:background "#242424" :foreground "#f6f3e8"))))
+   `(highlight ((,class (:background "#454545" :foreground "#ffffff"
+                        :underline t))))
+   `(region ((,class (:background "#444444"))))
+   `(secondary-selection ((,class (:background "#333366" :foreground "#f6f3e8"))))
+   `(isearch ((,class (:background "#343434" :foreground "#857b6f"))))
+   `(lazy-highlight ((,class (:background "#384048" :foreground "#a0a8b0"))))
+   ;; Mode line faces
+   `(mode-line ((,class (:background "#444444" :foreground "#f6f3e8"))))
+   `(mode-line-inactive ((,class (:background "#444444" :foreground "#857b6f"))))
+   ;; Escape and prompt faces
+   `(minibuffer-prompt ((,class (:foreground "#e5786d"))))
+   `(escape-glyph ((,class (:foreground "#ddaa6f" :weight bold))))
+   `(homoglyph ((,class (:foreground "#ddaa6f" :weight bold))))
+   ;; Font lock faces
+   `(font-lock-builtin-face ((,class (:foreground "#e5786d"))))
+   `(font-lock-comment-face ((,class (:foreground "#99968b"))))
+   `(font-lock-constant-face ((,class (:foreground "#e5786d"))))
+   `(font-lock-function-name-face ((,class (:foreground "#cae682"))))
+   `(font-lock-keyword-face ((,class (:foreground "#8ac6f2" :weight bold))))
+   `(font-lock-string-face ((,class (:foreground "#95e454"))))
+   `(font-lock-type-face ((,class (:foreground "#92a65e" :weight bold))))
+   `(font-lock-variable-name-face ((,class (:foreground "#cae682"))))
+   `(font-lock-warning-face ((,class (:foreground "#ccaa8f"))))
+   ;; Help faces
+   `(help-key-binding ((,class (:background "#333333" :foreground "#f6f3e8"))))
+   ;; Button and link faces
+   `(link ((,class (:foreground "#8ac6f2" :underline t))))
+   `(link-visited ((,class (:foreground "#e5786d" :underline t))))
+   `(button ((,class (:background "#333333" :foreground "#f6f3e8"))))
+   `(header-line ((,class (:background "#303030" :foreground "#e7f6da"))))
+   ;; Gnus faces
+   `(gnus-group-news-1 ((,class (:weight bold :foreground "#95e454"))))
+   `(gnus-group-news-1-low ((,class (:foreground "#95e454"))))
+   `(gnus-group-news-2 ((,class (:weight bold :foreground "#cae682"))))
+   `(gnus-group-news-2-low ((,class (:foreground "#cae682"))))
+   `(gnus-group-news-3 ((,class (:weight bold :foreground "#ccaa8f"))))
+   `(gnus-group-news-3-low ((,class (:foreground "#ccaa8f"))))
+   `(gnus-group-news-4 ((,class (:weight bold :foreground "#99968b"))))
+   `(gnus-group-news-4-low ((,class (:foreground "#99968b"))))
+   `(gnus-group-news-5 ((,class (:weight bold :foreground "#cae682"))))
+   `(gnus-group-news-5-low ((,class (:foreground "#cae682"))))
+   `(gnus-group-news-low ((,class (:foreground "#99968b"))))
+   `(gnus-group-mail-1 ((,class (:weight bold :foreground "#95e454"))))
+   `(gnus-group-mail-1-low ((,class (:foreground "#95e454"))))
+   `(gnus-group-mail-2 ((,class (:weight bold :foreground "#cae682"))))
+   `(gnus-group-mail-2-low ((,class (:foreground "#cae682"))))
+   `(gnus-group-mail-3 ((,class (:weight bold :foreground "#ccaa8f"))))
+   `(gnus-group-mail-3-low ((,class (:foreground "#ccaa8f"))))
+   `(gnus-group-mail-low ((,class (:foreground "#99968b"))))
+   `(gnus-header-content ((,class (:foreground "#8ac6f2"))))
+   `(gnus-header-from ((,class (:weight bold :foreground "#95e454"))))
+   `(gnus-header-subject ((,class (:foreground "#cae682"))))
+   `(gnus-header-name ((,class (:foreground "#8ac6f2"))))
+   `(gnus-header-newsgroups ((,class (:foreground "#cae682"))))
+   ;; Message faces
+   `(message-header-name ((,class (:foreground "#8ac6f2" :weight bold))))
+   `(message-header-cc ((,class (:foreground "#95e454"))))
+   `(message-header-other ((,class (:foreground "#95e454"))))
+   `(message-header-subject ((,class (:foreground "#cae682"))))
+   `(message-header-to ((,class (:foreground "#cae682"))))
+   `(message-cited-text ((,class (:foreground "#99968b"))))
+   `(message-separator ((,class (:foreground "#e5786d" :weight bold))))
+   ;; ANSI colors
+   `(ansi-color-black ((,class (:background "#242424" :foreground "#242424"))))
+   `(ansi-color-red ((,class (:background "#b85149" :foreground "#b85149"))))
+   `(ansi-color-green ((,class (:background "#92a65e" :foreground "#92a65e"))))
+   `(ansi-color-yellow ((,class (:background "#ccaa8f" :foreground "#ccaa8f"))))
+   `(ansi-color-blue ((,class (:background "#5b98c2" :foreground "#5b98c2"))))
+   `(ansi-color-magenta ((,class (:background "#64619a" :foreground "#64619a"))))
+   `(ansi-color-cyan ((,class (:background "#3f9f9e" :foreground "#3f9f9e"))))
+   `(ansi-color-white ((,class (:background "#f6f3e8" :foreground "#f6f3e8"))))
+   `(ansi-color-bright-black ((,class (:background "#444444" :foreground "#444444"))))
+   `(ansi-color-bright-red ((,class (:background "#e5786d" :foreground "#e5786d"))))
+   `(ansi-color-bright-green ((,class (:background "#95e454" :foreground "#95e454"))))
+   `(ansi-color-bright-yellow ((,class (:background "#edc4a3" :foreground "#edc4a3"))))
+   `(ansi-color-bright-blue ((,class (:background "#8ac6f2" :foreground "#8ac6f2"))))
+   `(ansi-color-bright-magenta ((,class (:background "#a6a1de" :foreground "#a6a1de"))))
+   `(ansi-color-bright-cyan ((,class (:background "#70cecc" :foreground "#70cecc"))))
+   `(ansi-color-bright-white ((,class (:background "#ffffff" :foreground "#ffffff"))))))
+
+(when (require 'highlight-indentation nil t)
+  (set-face-attribute 'highlight-indentation-face nil :background "#303030"))
+
+(provide-theme 'custom-wombat)
diff --git a/themes/github-dim-theme.el b/themes/github-dim-theme.el
new file mode 100644 (file)
index 0000000..c3b2a3e
--- /dev/null
@@ -0,0 +1,102 @@
+(deftheme github-dim)
+
+(defvar github-dim-colors (list (cons 'foreground "#adbac7")
+                                (cons 'background "#22272e")
+                                (cons 'comment "#768390")
+                                (cons 'constant "#6cb6ff")
+                                (cons 'function "#dcbdfb")
+                                (cons 'keyword "#f47067")
+                                (cons 'string  "#96d0ff")
+                                (cons 'variable "#f69d50")))
+
+(let ((class '((class color) (min-colors 89)))
+      (colors github-dim-colors))
+  (custom-theme-set-faces
+   'github-dim
+   `(default ((,class (:background ,(cdr (assoc 'background colors)) :foreground ,(cdr (assoc 'foreground colors))))))
+   `(cursor ((,class (:background ,(cdr (assoc 'foreground colors))))))
+   ;; Highlighting faces
+   `(fringe ((,class (:background ,(cdr (assoc 'background colors)) :foreground ,(cdr (assoc 'foreground colors))))))
+   `(highlight ((,class (:background "#454545" :foreground "#ffffff"
+                        :underline t))))
+   `(region ((,class (:background "#444444"))))
+   `(secondary-selection ((,class (:background "#333366" :foreground "#f6f3e8"))))
+   `(isearch ((,class (:background "#343434" :foreground "#857b6f"))))
+   `(lazy-highlight ((,class (:background "#384048" :foreground "#a0a8b0"))))
+   ;; Mode line faces
+   `(mode-line ((,class (:background "#444444" :foreground "#f6f3e8"))))
+   `(mode-line-inactive ((,class (:background "#444444" :foreground "#857b6f"))))
+   ;; Escape and prompt faces
+   `(minibuffer-prompt ((,class (:foreground "#e5786d"))))
+   `(escape-glyph ((,class (:foreground "#ddaa6f" :weight bold))))
+   `(homoglyph ((,class (:foreground "#ddaa6f" :weight bold))))
+   ;; Font lock faces
+   `(font-lock-builtin-face ((,class (:foreground ,(cdr (assoc 'keyword colors))))))
+   `(font-lock-comment-face ((,class (:foreground ,(cdr (assoc 'comment colors))))))
+   `(font-lock-constant-face ((,class (:foreground ,(cdr (assoc 'constant colors))))))
+   `(font-lock-function-name-face ((,class (:foreground ,(cdr (assoc 'function colors))))))
+   `(font-lock-keyword-face ((,class (:foreground ,(cdr (assoc 'keyword colors)) :weight bold))))
+   `(font-lock-string-face ((,class (:foreground ,(cdr (assoc 'string colors))))))
+   `(font-lock-type-face ((,class (:foreground ,(cdr (assoc 'function colors)) :weight bold))))
+   `(font-lock-variable-name-face ((,class (:foreground ,(cdr (assoc 'variable colors))))))
+   `(font-lock-warning-face ((,class (:foreground "#ccaa8f"))))
+   ;; Help faces
+   `(help-key-binding ((,class (:background "#333333" :foreground "#f6f3e8"))))
+   ;; Button and link faces
+   `(link ((,class (:foreground "#8ac6f2" :underline t))))
+   `(link-visited ((,class (:foreground "#e5786d" :underline t))))
+   `(button ((,class (:background "#333333" :foreground "#f6f3e8"))))
+   `(header-line ((,class (:background "#303030" :foreground "#e7f6da"))))
+   ;; Gnus faces
+   `(gnus-group-news-1 ((,class (:weight bold :foreground "#95e454"))))
+   `(gnus-group-news-1-low ((,class (:foreground "#95e454"))))
+   `(gnus-group-news-2 ((,class (:weight bold :foreground "#cae682"))))
+   `(gnus-group-news-2-low ((,class (:foreground "#cae682"))))
+   `(gnus-group-news-3 ((,class (:weight bold :foreground "#ccaa8f"))))
+   `(gnus-group-news-3-low ((,class (:foreground "#ccaa8f"))))
+   `(gnus-group-news-4 ((,class (:weight bold :foreground "#99968b"))))
+   `(gnus-group-news-4-low ((,class (:foreground "#99968b"))))
+   `(gnus-group-news-5 ((,class (:weight bold :foreground "#cae682"))))
+   `(gnus-group-news-5-low ((,class (:foreground "#cae682"))))
+   `(gnus-group-news-low ((,class (:foreground "#99968b"))))
+   `(gnus-group-mail-1 ((,class (:weight bold :foreground "#95e454"))))
+   `(gnus-group-mail-1-low ((,class (:foreground "#95e454"))))
+   `(gnus-group-mail-2 ((,class (:weight bold :foreground "#cae682"))))
+   `(gnus-group-mail-2-low ((,class (:foreground "#cae682"))))
+   `(gnus-group-mail-3 ((,class (:weight bold :foreground "#ccaa8f"))))
+   `(gnus-group-mail-3-low ((,class (:foreground "#ccaa8f"))))
+   `(gnus-group-mail-low ((,class (:foreground "#99968b"))))
+   `(gnus-header-content ((,class (:foreground "#8ac6f2"))))
+   `(gnus-header-from ((,class (:weight bold :foreground "#95e454"))))
+   `(gnus-header-subject ((,class (:foreground "#cae682"))))
+   `(gnus-header-name ((,class (:foreground "#8ac6f2"))))
+   `(gnus-header-newsgroups ((,class (:foreground "#cae682"))))
+   ;; Message faces
+   `(message-header-name ((,class (:foreground "#8ac6f2" :weight bold))))
+   `(message-header-cc ((,class (:foreground "#95e454"))))
+   `(message-header-other ((,class (:foreground "#95e454"))))
+   `(message-header-subject ((,class (:foreground "#cae682"))))
+   `(message-header-to ((,class (:foreground "#cae682"))))
+   `(message-cited-text ((,class (:foreground "#99968b"))))
+   `(message-separator ((,class (:foreground "#e5786d" :weight bold))))
+   ;; ANSI colors
+   `(ansi-color-black ((,class (:background "#242424" :foreground "#242424"))))
+   `(ansi-color-red ((,class (:background "#b85149" :foreground "#b85149"))))
+   `(ansi-color-green ((,class (:background "#92a65e" :foreground "#92a65e"))))
+   `(ansi-color-yellow ((,class (:background "#ccaa8f" :foreground "#ccaa8f"))))
+   `(ansi-color-blue ((,class (:background "#5b98c2" :foreground "#5b98c2"))))
+   `(ansi-color-magenta ((,class (:background "#64619a" :foreground "#64619a"))))
+   `(ansi-color-cyan ((,class (:background "#3f9f9e" :foreground "#3f9f9e"))))
+   `(ansi-color-white ((,class (:background "#f6f3e8" :foreground "#f6f3e8"))))
+   `(ansi-color-bright-black ((,class (:background "#444444" :foreground "#444444"))))
+   `(ansi-color-bright-red ((,class (:background "#e5786d" :foreground "#e5786d"))))
+   `(ansi-color-bright-green ((,class (:background "#95e454" :foreground "#95e454"))))
+   `(ansi-color-bright-yellow ((,class (:background "#edc4a3" :foreground "#edc4a3"))))
+   `(ansi-color-bright-blue ((,class (:background "#8ac6f2" :foreground "#8ac6f2"))))
+   `(ansi-color-bright-magenta ((,class (:background "#a6a1de" :foreground "#a6a1de"))))
+   `(ansi-color-bright-cyan ((,class (:background "#70cecc" :foreground "#70cecc"))))
+   `(ansi-color-bright-white ((,class (:background "#ffffff" :foreground "#ffffff"))))))
+
+(provide-theme 'github-dim)
+
+;;; wombat-theme.el ends here