]> git.eshelyaron.com Git - dotfiles.git/commitdiff
Update Emacs and Brew configurations
authorEshel Yaron <me@eshelyaron.com>
Mon, 19 Jun 2023 06:04:47 +0000 (09:04 +0300)
committerEshel Yaron <me@eshelyaron.com>
Mon, 19 Jun 2023 06:04:47 +0000 (09:04 +0300)
.emacs.d/init.el
.gitignore
Brewfile

index ae7f08804e0915f3c0f58fe55c44f5787eca2ed3..87304185228baa6b1a87416563822092fd99a8a2 100644 (file)
@@ -68,6 +68,8 @@
    bookmark-save-flag 1
    ;; show matches count in isearch prompt
    isearch-lazy-count t
+   ;; don't spawn new frames in Ediff
+   ediff-window-setup-function #'ediff-setup-windows-plain
    ;; make some space in the Packages menu
    package-archive-column-width 12
    package-version-column-width 28
                                avy
                                bbdb
                                corfu
+                               debbugs
                                devdocs
                                diff-hl
                                eat
+                               ef-themes
                                elfeed
                                embark-consult
                                emms
   (defun esy/recent-log-summary ()
     "Display a summary of my website's most recent access log."
     (interactive)
-    (let ((default-directory "/ssh:root@direct.eshelyaron.com:/var/log/apache2/"))
-      (async-shell-command (string-join  '("grep -E '\"GET.+\" 2' access.log"
-                                           "tr -d '\"'"
-                                           "tr -d \"'\""
-                                           "cut -f 7,11,12 -d ' '"
-                                           "sort"
-                                           "uniq -c"
-                                           "sort -n")
-                                         " | ")
-                           "*Recent Log Summary*")))
+    (async-shell-command (string-join (list "ssh"
+                                            "root@direct.eshelyaron.com"
+                                            (shell-quote-argument
+                                             (string-join '("grep -E '\"GET.+\" 2' /var/log/apache2/access.log"
+                                                            "tr -d '\"'"
+                                                            "tr -d \"'\""
+                                                            "cut -f 7,11,12 -d ' '"
+                                                            "sort"
+                                                            "uniq -c"
+                                                            "sort -n")
+                                                          " | ")))
+                                      " ")
+                         "*Recent Log Summary*"))
 
   (defun esy/access-log-summary ()
     "Display a summary of my website's access log."
   (keymap-global-set "C-c P" #'list-packages)
   (keymap-global-set "C-c SPC" #'consult-mark)
   (keymap-global-set "C-c 1" #'delete-other-windows)
+  (keymap-global-set "C-c 2" #'split-window-below)
+  (keymap-global-set "C-c 3" #'split-window-right)
   (keymap-global-set "<remap> <kill-region>" #'esy/kill-dwim)
   (keymap-global-set "<remap> <goto-line>" #'consult-goto-line)
   (keymap-global-set "<remap> <suspend-frame>" #'zap-up-to-char)
@@ -729,18 +738,22 @@ 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 (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)))
+    (defun esy/update-sql-connection-alist ()
+      (interactive)
+      (auth-source-forget-all-cached)
+      (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))))
+    (esy/update-sql-connection-alist)
     (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)
@@ -989,6 +1002,7 @@ as the initial input for completion, and return that directory."
 
 (esy/init-step sweep
   "Configure Prolog integration via `sweeprolog'."
+  (setq-default prolog-system 'swi)
   (add-to-list 'major-mode-remap-alist '(prolog-mode . sweeprolog-mode))
   (with-eval-after-load 'sweeprolog
     (add-hook 'sweeprolog-mode-hook #'sweeprolog-electric-layout-mode)
@@ -1051,16 +1065,56 @@ as the initial input for completion, and return that directory."
 (esy/init-step elfeed
   "Configure news feeds."
   (with-eval-after-load 'elfeed
+    (defvar esy/feeds-file (locate-user-emacs-file "feeds.eld"))
+
+    (defun esy/feeds ()
+      (with-temp-buffer
+        (insert-file-contents-literally esy/feeds-file)
+        (goto-char (point-min))
+        (read (current-buffer))))
+
+    (defun esy/read-feed-keywords ()
+      (mapcar #'intern
+              (completing-read-multiple
+               "Keywords: "
+               (let ((keywords nil))
+                 (dolist
+                     (feed-keywords
+                      (mapcar
+                       #'cdr
+                       (esy/feeds)))
+                   (mapc (lambda (keyword)
+                           (add-to-list 'keywords keyword))
+                         feed-keywords))
+                 (mapcar #'symbol-name keywords)))))
+
+    (defun esy/add-feed (url keywords)
+      (interactive (let ((default (thing-at-point-url-at-point)))
+                     (list (read-string (format-prompt "Feed URL"
+                                                       default)
+                                        nil nil default)
+                           (esy/read-feed-keywords))))
+      (let ((feeds (cons (cons url keywords) (esy/feeds))))
+        (with-temp-buffer
+          (pp (cons (cons url keywords) (esy/feeds))
+              (current-buffer))
+          (write-region (point-min)
+                        (point-max)
+                        esy/feeds-file))
+        (setq elfeed-feeds feeds)))
+
+    (with-eval-after-load 'eww
+      (defun esy/eww-add-feed (url keywords)
+        (interactive (list (eww-read-alternate-url)
+                           (esy/read-feed-keywords))
+                     eww-mode)
+        (esy/add-feed url keywords)))
+
     (setq
      ;; don't use bold face for unread Elfeed entries
      elfeed-search-face-alist '((unread (default)))
      ;; read feeds list from a separate file
-     elfeed-feeds
-     (with-temp-buffer
-       (insert-file-contents-literally
-        (locate-user-emacs-file "feeds.eld"))
-       (goto-char (point-min))
-       (read (current-buffer))))))
+     elfeed-feeds (esy/feeds))))
 
 (esy/init-step eat
   "Configure Eat."
index f300489a0c70c92ef58d766244f14180d39d897c..d70b289673021e3f737d4a514db8ba173ea9a742 100644 (file)
@@ -25,3 +25,4 @@
 /.emacs.d/esy.elc
 /.emacs.d/esy.el
 /.emacs.d/etc/
+/Brewfile.lock.json
index dbf8ea5a12c17d38e90030ae1accca1e70dcc88b..7f6a6f095b147213233d1d528ab80ee7dc3663bc 100644 (file)
--- a/Brewfile
+++ b/Brewfile
@@ -11,10 +11,13 @@ brew "gcc"
 brew "git"
 brew "gnutls"
 brew "gnupg"
+brew "go"
+brew "gopls"
 brew "gtk+3"
 brew "imagemagick"
 brew "ispell"
 brew "jansson"
+brew "jq"
 brew "kubernetes-cli"
 brew "libarchive"
 brew "libgccjit"
@@ -34,7 +37,9 @@ brew "ripgrep"
 brew "stow"
 brew "texinfo"
 brew "tree-sitter"
+brew "tnftp"
 cask "font-iosevka"
 cask "font-iosevka-aile"
 cask "font-iosevka-etoile"
+cask "graphiql"
 cask "iterm2"