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)
(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)
(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)
(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."