From 3306e2caceac642a7099bdc899736ad9fd54e89a Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Fri, 9 Jun 2023 10:41:16 +0300 Subject: [PATCH] Update Emacs and Bash configurations --- .bash_profile | 2 ++ .bashrc | 8 +++++ .emacs.d/init.el | 92 +++++++++++++++++------------------------------- Brewfile | 40 +++++++++++++++++++++ 4 files changed, 82 insertions(+), 60 deletions(-) create mode 100644 .bash_profile create mode 100644 .bashrc create mode 100644 Brewfile diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..62dd079 --- /dev/null +++ b/.bash_profile @@ -0,0 +1,2 @@ +PATH="/Users/eshelyaron/.cargo/bin:/Users/eshelyaron/emacs/nextstep/Emacs.app/Contents/MacOS:$PATH" + diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..92a81f0 --- /dev/null +++ b/.bashrc @@ -0,0 +1,8 @@ +PATH="/Users/eshelyaron/.cargo/bin:/Users/eshelyaron/emacs/nextstep/Emacs.app/Contents/MacOS:$PATH" +LDFLAGS="-L/usr/local/opt/libarchive/lib" +CPPFLAGS="-I/usr/local/opt/libarchive/include -I/Users/eshelyaron/emacs/nextstep/Emacs.app/Contents/Resources/include" +PKG_CONFIG_PATH="/usr/local/opt/libarchive/lib/pkgconfig" + +PS1='\w \$ ' + +[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/bash" diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 921670e..ae7f088 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -87,6 +87,7 @@ corfu devdocs diff-hl + eat elfeed embark-consult emms @@ -376,7 +377,7 @@ completion-styles '(orderless partial-completion basic) completion-show-help nil ;; completions-header-format nil - completion-auto-help 'visual + ;; completion-auto-help 'visible completions-max-height 16 completion-auto-wrap t corfu-cycle t @@ -455,6 +456,10 @@ (backward-word) (kill-region (point) end)))) + (defun esy/ttyper () + (interactive) + (eat "ttyper" t)) + (defun esy/pulse-line (&optional _) "Pulse current line." (interactive) @@ -616,6 +621,7 @@ (keymap-global-set "C-c C" #'esy-publish-create-post) (keymap-global-set "C-c O" #'openai-chat) (keymap-global-set "C-c E" #'elfeed) + (keymap-global-set "C-c T" #'esy/ttyper) (keymap-global-set "C-c G" #'gnus) (keymap-global-set "C-c M" #'mastodon) (keymap-global-set "C-c F" #'esy/find-init-file) @@ -723,66 +729,20 @@ as the initial input for completion, and return that directory." (esy/init-step sql "Configure SQL connections." (with-eval-after-load 'sql - (setq sql-connection-alist (let* ((a (auth-source-search :port 5432 - :max 7 - :require '(:user :port :secret :host))) - (d (nth 0 a)) - (p (nth 1 a)) - (c (nth 2 a)) - (e (nth 3 a)) - (f (nth 4 a)) - (i (nth 5 a)) - (g (nth 6 a))) - `((dev - (sql-product 'postgres) - (sql-user ,(plist-get d :user)) - (sql-port 5432) - (sql-password ,(funcall (plist-get d :secret))) - (sql-server ,(plist-get d :host)) - (sql-database "alerts")) - (prod - (sql-product 'postgres) - (sql-user ,(plist-get p :user)) - (sql-port 5432) - (sql-password ,(funcall (plist-get p :secret))) - (sql-server ,(plist-get p :host)) - (sql-database "alerts")) - (cgs - (sql-product 'postgres) - (sql-user ,(plist-get c :user)) - (sql-port 5432) - (sql-password ,(funcall (plist-get c :secret))) - (sql-server ,(plist-get c :host)) - (sql-database "container_graph")) - (ten - (sql-product 'postgres) - (sql-user ,(plist-get e :user)) - (sql-port 5432) - (sql-password ,(funcall (plist-get e :secret))) - (sql-server ,(cadr (split-string (plist-get e :host) (rx "^")))) - (sql-database ,(car (split-string (plist-get e :host) (rx "^"))))) - (ac - (sql-product 'postgres) - (sql-user ,(plist-get f :user)) - (sql-port 5432) - (sql-password ,(funcall (plist-get f :secret))) - (sql-server ,(cadr (split-string (plist-get f :host) (rx "^")))) - (sql-database ,(car (split-string (plist-get f :host) (rx "^"))))) - (int - (sql-product 'postgres) - (sql-user ,(plist-get i :user)) - (sql-port 5432) - (sql-password ,(funcall (plist-get i :secret))) - (sql-server ,(cadr (split-string (plist-get i :host) (rx "^")))) - (sql-database ,(car (split-string (plist-get i :host) (rx "^"))))) - (fin - (sql-product 'postgres) - (sql-user ,(plist-get g :user)) - (sql-port 5432) - (sql-password ,(funcall (plist-get g :secret))) - (sql-server ,(cadr (split-string (plist-get g :host) (rx "^")))) - (sql-database ,(car (split-string (plist-get g :host) (rx "^")))))))) + (setq sql-connection-alist (mapcar (lambda (source) + (pcase (split-string (plist-get source :host) + (rx "^")) + (`(,con ,db ,host) + (list (intern con) + (list 'sql-product ''postgres) + (list 'sql-user (plist-get source :user)) + (list 'sql-port (string-to-number (plist-get source :port))) + (list 'sql-password (funcall (plist-get source :secret))) + (list 'sql-server host) + (list 'sql-database db))))) + (auth-source-search :port 5432 :max 10))) (add-hook 'sql-interactive-mode-hook #'toggle-truncate-lines) + (add-hook 'sql-interactive-mode-hook #'abbrev-mode) (define-key sql-mode-map (kbd "C-c C-f") #'sqlformat) (define-advice sql-comint-postgres (:around (fun &rest args) use-sql-password) (let ((process-environment @@ -1102,6 +1062,18 @@ as the initial input for completion, and return that directory." (goto-char (point-min)) (read (current-buffer)))))) +(esy/init-step eat + "Configure Eat." + (with-eval-after-load 'eat + + (defun esy/eat-exit-hook (process) + (let ((buffer (process-buffer process))) + (set-process-buffer process nil) + (when (buffer-live-p buffer) + (kill-buffer buffer)))) + + (add-hook 'eat-exit-hook #'esy/eat-exit-hook))) + (dolist (step (sort esy/init-step-times (lambda (l r) (time-less-p (cdr r) (cdr l))))) (message "%f %s" (float-time (cdr step)) diff --git a/Brewfile b/Brewfile new file mode 100644 index 0000000..dbf8ea5 --- /dev/null +++ b/Brewfile @@ -0,0 +1,40 @@ +tap "homebrew/bundle" +tap "homebrew/cask-fonts" +tap "homebrew/services" +brew "autoconf" +brew "automake" +brew "awscli" +brew "bash" +brew "cmake" +brew "dbus" +brew "gcc" +brew "git" +brew "gnutls" +brew "gnupg" +brew "gtk+3" +brew "imagemagick" +brew "ispell" +brew "jansson" +brew "kubernetes-cli" +brew "libarchive" +brew "libgccjit" +brew "libpq", link: true +brew "libxpm" +brew "libyaml" +brew "mailutils" +brew "mupdf" +brew "ninja" +brew "node@16" +brew "pgformatter" +brew "pinentry-mac" +brew "pkg-config" +brew "poppler" +brew "postgresql@15" +brew "ripgrep" +brew "stow" +brew "texinfo" +brew "tree-sitter" +cask "font-iosevka" +cask "font-iosevka-aile" +cask "font-iosevka-etoile" +cask "iterm2" -- 2.39.2