]> git.eshelyaron.com Git - dotfiles.git/commitdiff
Update Emacs configuration
authorEshel Yaron <me@eshelyaron.com>
Fri, 12 May 2023 20:00:13 +0000 (23:00 +0300)
committerEshel Yaron <me@eshelyaron.com>
Fri, 12 May 2023 20:00:13 +0000 (23:00 +0300)
.emacs.d/init.el

index 0c86462c0515a12df4625be8ef035578a3f600be..9a10263c894a9fc313f8ea70207fd0c8def7db74 100644 (file)
                                       .
                                       ,(regexp-opt
                                         '("Key translations"
-                                          "Global Bindings"
+                                          "Global Bindings:"
                                           "Function key map translations"
                                           "pixel-scroll-precision-mode"
                                           "context-menu-mode")))))
 
   (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