From 7d29ef0502000a5f232a98567056500898d0d355 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Fri, 12 May 2023 23:00:13 +0300 Subject: [PATCH] Update Emacs configuration --- .emacs.d/init.el | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 0c86462..9a10263 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -415,7 +415,7 @@ . ,(regexp-opt '("Key translations" - "Global Bindings" + "Global Bindings:" "Function key map translations" "pixel-scroll-precision-mode" "context-menu-mode"))))) @@ -554,11 +554,12 @@ (defun esy/clone (remote) (interactive "sClone: ") - (vc-clone remote 'Git - (expand-file-name - (file-name-base (car (url-path-and-query - (url-generic-parse-url remote)))) - "~/checkouts")))) + (let ((dir (expand-file-name + (file-name-base (car (url-path-and-query + (url-generic-parse-url remote)))) + "~/checkouts"))) + (vc-clone remote 'Git dir) + (find-file dir)))) (esy/init-step auto-exec-permissions "Ensure scripts ran with `executable-interpret' are executable." @@ -699,10 +700,12 @@ If no known project matches the selected name, prompt for a sub-directory of `esy/projects-directory' using the selected name as the initial input for completion, and return that directory." (let* ((name-dir-alist - (mapcar (lambda (dir) - (cons (project-name (project-current nil dir)) - dir)) - (project-known-project-roots))) + (delete + nil + (mapcar (lambda (dir) + (when-let ((proj (project-current nil dir))) + (cons (project-name proj) dir))) + (project-known-project-roots)))) (current (project-current)) (default (and current (project-name current))) (name (completing-read (format-prompt "Project" default) @@ -722,14 +725,15 @@ as the initial input for completion, and return that directory." "Configure SQL connections." (with-eval-after-load 'sql (setq sql-connection-alist (let* ((a (auth-source-search :port 5432 - :max 6 + :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))) + (i (nth 5 a)) + (g (nth 6 a))) `((dev (sql-product 'postgres) (sql-user ,(plist-get d :user)) @@ -771,7 +775,14 @@ as the initial input for completion, and return that directory." (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 "^")))))))) + (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 "^")))))))) (add-hook 'sql-interactive-mode-hook #'toggle-truncate-lines) (define-key sql-mode-map (kbd "C-c C-f") #'sqlformat) (define-advice sql-comint-postgres (:around (fun &rest args) use-sql-password) @@ -1062,6 +1073,13 @@ as the initial input for completion, and return that directory." (add-hook 'kill-emacs-hook #'esy/compile-config 10)) +(esy/init-step dict + "Configure dictionary servers." + (with-eval-after-load 'dict + (setq dict-server-host "dict.org" + dict-dictionary "gcide" + dict-strategy "prefix"))) + (esy/init-step elfeed "Configure news feeds." (with-eval-after-load 'elfeed -- 2.39.2