]> git.eshelyaron.com Git - dotfiles.git/commitdiff
Update Emacs configuration
authorEshel Yaron <me@eshelyaron.com>
Mon, 13 May 2024 12:09:57 +0000 (14:09 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 13 May 2024 12:09:57 +0000 (14:09 +0200)
.emacs.d/init.el
.emacs.d/lisp/esy-comm.el
.emacs.d/theme/esy-theme.el
.gitignore

index 5581ac086023cce663ca1ea43174a402ce99c352..cde77c6d5fe070ebd576f52d3bf8a8d2b5f716ac 100644 (file)
@@ -65,7 +65,7 @@
 
 ;;; Set up Elpaca
 
-(defvar elpaca-installer-version 0.6)
+(defvar elpaca-installer-version 0.7)
 (defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
 (defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
 (defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
 (add-hook 'after-init-hook #'elpaca-process-queues)
 (elpaca `(,@elpaca-order))
 
-
 ;;; Install packages
 
 (elpaca org-transclusion)
                       "-f" "org-texinfo-export-to-texinfo")
                      ("mv" "README.texi"  "pdf-tools.texi"))))
 (elpaca ob-prolog)
-(elpaca (query-replace-parallel
-         :repo "https://github.com/hokomo/query-replace-parallel.git"))
 
 (elpaca-wait)
 
   "U" #'elpaca-merge-all
   "v" #'elpaca-visit
   "d" #'elpaca-delete
-  "l" #'elpaca-log
+  "l" #'elpaca-log-updates
   "i" #'elpaca-info
   "t" #'elpaca-try)
 
+(keymap-unset elpaca-ui-mode-map "p" t)
+(keymap-set elpaca-ui-mode-map "l" #'elpaca-ui-mark-pull)
+
+(defun esy/log-diff (id ref)
+  (require 'diff-mode)
+  (let ((diff-default-read-only t))
+    (elpaca-log-diff id ref)))
+
+(setq elpaca-log-diff-function #'esy/log-diff)
+
+(add-hook 'elpaca-log-mode-hook #'elpaca-log-update-mode)
+(add-hook 'elpaca-log-mode-hook
+          (lambda ()
+            (add-hook 'quit-window-hook
+                      (lambda ()
+                        (when (get-buffer-window "*elpaca-diff*")
+                         (quit-windows-on "*elpaca-diff*")))
+                      nil t)))
+
 (defalias 'esy/elpaca-prefix-map esy/elpaca-prefix-map)
 
 ;;; Set some variables
  read-mail-command 'gnus
  ;; direct Custom definitions to some file and forget about it
  custom-file (expand-file-name "custom.el" user-emacs-directory)
- ;; silence native compilation warnings
- native-comp-async-report-warnings-errors 'silent
  ;; only display the warning buffer if something's really broken
  warning-minimum-level :error
  ;; don't use stale .elc files
  display-time-24hr-format t
  ;; enable recursive minibuffers
  enable-recursive-minibuffers t
+ minibuffer-beginning-of-buffer-movement t
  bug-reference-url-format "https://debbugs.gnu.org/%s"
  ;; save bookmarks immediately
  bookmark-save-flag 1
@@ -356,6 +371,7 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t))
  remote-file-name-inhibit-auto-save t
  ;; don't ask me about it either
  tramp-allow-unsafe-temporary-files t
+ remote-file-name-inhibit-locks t
  ;; increase maximum number of recent files Emacs remembers
  recentf-max-saved-items 1024
  ;; increase maximum kill ring size
@@ -367,6 +383,7 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t))
  osm-copyright nil
  ;; follow links to version-controlled files without confirming
  vc-follow-symlinks t
+ vc-handled-backends '(Git)
  ;; jump from .c to .h files with find-sibling-file
  find-sibling-rules '(("\\([^/]+\\)\\.c\\'" "\\1.h")
                       ("nextstep/Emacs.app/Contents/Resources/\\(.*\\)\\'"
@@ -409,18 +426,17 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t))
  read-extended-command-predicate #'command-completion-default-include-p
  completions-format 'horizontal
  completions-group t
+ completions-sort nil
  completions-detailed t
  completion-auto-select nil
  completion-styles '(substring partial-completion)
  completion-category-overrides
  '((buffer       (styles                          substring))
-   (file         (styles basic partial-completion substring))
+   (file         (styles basic partial-completion substring)
+                 (sort-function . minibuffer-sort-by-history))
    (project-file (styles basic partial-completion substring))
    (recent-file  (styles basic partial-completion substring))
-   (command      (display-sort-function . minibuffer-sort-by-history)
-                 (cycle-sort-function   . minibuffer-sort-by-history)))
- completion-show-help nil
- ;; completions-header-format nil
+   (command      (sort-function . minibuffer-sort-by-history)))
  ;; completion-auto-help 'visible
  completions-max-height 16
  completion-auto-wrap t
@@ -483,8 +499,6 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t))
 
 (add-to-list 'load-path (expand-file-name "lisp/" user-emacs-directory))
 (autoload 'some-button "some-button" nil t)
-;; (autoload 'completions-auto-update-mode "completions-auto-update" nil t)
-;; (autoload 'completions-auto-update-global-mode "completions-auto-update" nil t)
 
 (unless (eq system-type 'android)
   (add-to-list 'load-path "~/checkouts/esy-publish/")
@@ -628,7 +642,7 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t))
 
 (with-eval-after-load 'comint
   (keymap-set comint-mode-map "C-c C-q" #'esy/log-buffer)
-  (add-hook 'comint-mode-hook #'completion-preview-mode))
+  (setq comint-completion-addsuffix nil))
 
 (defun esy/recent-log-summary ()
   "Display a summary of my website's most recent access log."
@@ -813,8 +827,7 @@ Interactively, POINT is point and KILL is the prefix argument."
 (dolist (mode '(bug-reference-prog-mode
                 display-fill-column-indicator-mode
                 display-line-numbers-mode
-                flymake-mode
-                completion-preview-mode))
+                flymake-mode))
   (add-hook 'prog-mode-hook mode))
 
 (add-hook 'lisp-data-mode-hook #'paredit-mode)
@@ -823,7 +836,6 @@ Interactively, POINT is point and KILL is the prefix argument."
 ;;; Extend standard text mode hooks
 
 (add-hook 'text-mode-hook #'flyspell-mode)
-(add-hook 'text-mode-hook #'completion-preview-mode)
 
 ;;; Bind some keys
 
@@ -988,7 +1000,7 @@ as the initial input for completion, and return that directory."
                                                           (list 'sql-password  (funcall (plist-get source :secret)))
                                                           (list 'sql-server host)
                                                           (list 'sql-database db)))))
-                                               (auth-source-search :port 5432 :max 10)))))
+                                               (auth-source-search :port 5432 :max 100)))))
   (esy/update-sql-connection-alist)
   (add-hook 'sql-interactive-mode-hook #'toggle-truncate-lines)
   (add-hook 'sql-interactive-mode-hook #'abbrev-mode)
@@ -1046,35 +1058,22 @@ as the initial input for completion, and return that directory."
 
 ;;; Configure minibuffer completions
 
-(add-to-list 'display-buffer-alist
-             '("\\*Completions\\*"
-               (display-buffer-reuse-window display-buffer-at-bottom)
-               (window-parameters
-                ;; (mode-line-format . none)
-                (split-window . ignore))))
+;; (add-to-list 'display-buffer-alist
+;;              '("\\*Completions\\*"
+;;                (display-buffer-reuse-window display-buffer-at-bottom)
+;;                (window-parameters
+;;                 ;; (mode-line-format . none)
+;;                 (split-window . ignore))))
 
 (add-hook 'completion-list-mode-hook
           (lambda ()
             (setq-local cursor-in-non-selected-windows nil)))
 
-(dolist (key-binding '(("C-p" . minibuffer-previous-completion)
-                       ("C-n" . minibuffer-next-completion)
-                       ("M-j" . minibuffer-force-complete-and-exit)))
-  (keymap-set minibuffer-local-completion-map
-              (car key-binding)
-              (cdr key-binding)))
-
-;;; Define some custom `completion-at-point-functions'
-
-(defun file-capf ()
-  "File completion at point function."
-  (pcase (bounds-of-thing-at-point 'filename)
-    (`(,beg . ,end)
-     (list beg end #'completion-file-name-table
-           :annotation-function (lambda (_) " File")
-           :exclusive 'no))))
-
-(add-hook 'completion-at-point-functions #'file-capf)
+;; (dolist (key-binding '(("C-p" . minibuffer-previous-completion)
+;;                        ("C-n" . minibuffer-next-completion)))
+;;   (keymap-set minibuffer-local-completion-map
+;;               (car key-binding)
+;;               (cdr key-binding)))
 
 ;;; Configure highlighting of the current line via `lin'
 
@@ -1105,7 +1104,8 @@ as the initial input for completion, and return that directory."
                 winner-mode
                 completions-auto-update-mode
                 mode-face-global-mode
-                which-function-mode
+                global-completion-preview-mode
+                ;; tab-bar-mode
                 ))
   (funcall mode))
 
@@ -1126,7 +1126,16 @@ as the initial input for completion, and return that directory."
 (defvar-keymap esy/emms-map
   :doc "My keymap for EMMS commands."
   :prefix 'esy/emms-map
-  :repeat t
+  :repeat (:hints ((emms-next          . "Next")
+                   (emms-previous      . "Previous")
+                   (emms-stop          . "Stop")
+                   (emms-seek-backward . "backward")
+                   (emms-seek-forward  . "forward")
+                   (emms-seek          . "seek")
+                   (emms-show          . "show")
+                   (emms-pause         . "pause")
+                   (emms-start         . "start")
+                   (emms-seek-to       . "to")))
   "N" #'emms-next
   "P" #'emms-previous
   "S" #'emms-stop
@@ -1159,6 +1168,7 @@ as the initial input for completion, and return that directory."
 
 (setq-default prolog-system 'swi)
 (add-to-list 'major-mode-remap-alist '(prolog-mode . sweeprolog-mode))
+;; (setq sweeprolog-swipl-path "/Applications/SWI-Prolog.app/Contents/MacOS/swipl")
 (with-eval-after-load 'sweeprolog
   (setq sweeprolog-top-level-persistent-history
         (locate-user-emacs-file ".sweep_history"))
@@ -1187,8 +1197,7 @@ as the initial input for completion, and return that directory."
                 ("\\.rb\\'"    . ruby-ts-mode)
                 ("\\.rs\\'"    . rust-ts-mode)
                 ("\\.go\\'"    . go-ts-mode)
-                ("\\.plt?\\'"  . prolog-mode)
-                ("\\.tex\\'"   . LaTeX-mode)))
+                ("\\.plt?\\'"  . prolog-mode)))
   (push cell auto-mode-alist))
 
 ;;; Configure Help
@@ -1262,7 +1271,11 @@ as the initial input for completion, and return that directory."
 
   (setq
    ;; read feeds list from a separate file
-   elfeed-feeds (esy/feeds)))
+   elfeed-feeds (esy/feeds))
+
+  (with-eval-after-load 'completion-preview
+    (push '(not elfeed-search-mode elfeed-show-mode)
+          global-completion-preview-modes)))
 
 ;;; Disable some minor-mode mode-line lighters
 
@@ -1279,6 +1292,8 @@ as the initial input for completion, and return that directory."
 
 ;;; Configure TeX
 
+(add-to-list 'major-mode-remap-alist '(latex-mode . Latex-Mode))
+
 (with-eval-after-load 'tex-mode
   (require 'tex))
 
@@ -1320,7 +1335,8 @@ as the initial input for completion, and return that directory."
   (setq completion-preview-minimum-symbol-length 2)
   (keymap-set completion-preview-active-mode-map "M-n" #'completion-preview-next-candidate)
   (keymap-set completion-preview-active-mode-map "M-p" #'completion-preview-prev-candidate)
-  (keymap-set completion-preview-active-mode-map "M-i" #'completion-preview-insert))
+  ;; (keymap-set completion-preview-active-mode-map "M-i" #'completion-preview-insert)
+  )
 
 (load-file "/Users/eshelyaron/checkouts/agda/src/data/emacs-mode/agda2.el")
 
@@ -1381,19 +1397,26 @@ as the initial input for completion, and return that directory."
 
 (defun esy/read-buffer (prompt &optional def require-match predicate)
   (minibuffer-with-setup-hook
-      (lambda ()
-        (when read-buffer-to-switch-current-buffer
-          (read-buffer-to-switch-mode)))
+      (:append
+       (lambda ()
+         (when read-buffer-to-switch-current-buffer
+           (read-buffer-to-switch-mode))))
     (let ((read-buffer-function nil))
       (read-buffer prompt def require-match predicate))))
 
 (defun esy/kill-buffers (buffers)
   (interactive
    (list (let ((def (buffer-name)))
-           (completing-read-multiple
-            (format-prompt "Kill buffers" def)
-            #'completion-buffer-name-table nil t nil
-            'buffer-name-history def))))
+           (minibuffer-with-setup-hook
+               (lambda () (setq minibuffer-completion-action
+                                (cons (lambda (buf-name)
+                                        (kill-buffer buf-name)
+                                        (message "Killed %s" buf-name))
+                                      "kill")))
+             (completing-read-multiple
+              (format-prompt "Kill buffers" def)
+              (completion-buffer-name-table) nil t nil
+              'buffer-name-history def)))))
   (when buffers
     (let ((num (length buffers)))
       (while (and buffers (kill-buffer (car buffers)))
@@ -1408,59 +1431,7 @@ as the initial input for completion, and return that directory."
 
 (load-file (expand-file-name "admin/cherry.el" source-directory))
 
-(defvar-local minibuffer-hint-timer nil)
-
-(defvar minibuffer-hint-idle-time 1)
-
-(defun minibuffer-hint ()
-  (when-let ((beg-end (minibuffer--completion-boundaries))
-             (beg (car beg-end)) (end (cdr beg-end))
-             (all (let ((completion--input completion--input)
-                        (completion-lazy-hilit t))
-                    (completion-all-sorted-completions beg end))))
-    (setcdr (last all) nil)
-    (let (minibuffer-message-timeout)
-      (minibuffer-message (concat (propertize (car all) 'face 'bold)
-                                  (when (cdr all)
-                                    (concat
-                                     " and "
-                                     (number-to-string (1- (length all)))
-                                     " more")))))))
-
-(defun minibuffer-hint-cancel-timer ()
-  (when (timerp minibuffer-hint-timer)
-    (cancel-timer minibuffer-hint-timer)
-    (setq minibuffer-hint-timer nil)))
-
-(defun minibuffer-hint-fn (buffer)
-  (lambda ()
-    (when (equal (current-buffer) buffer)
-      (minibuffer-hint))
-    (when (buffer-live-p buffer)
-      (with-current-buffer buffer (minibuffer-hint-cancel-timer)))))
-
-(defun minibuffer-hint-start-timer ()
-  (unless (timerp minibuffer-hint-timer)
-    (setq minibuffer-hint-timer
-          (run-with-idle-timer minibuffer-hint-idle-time
-                               nil (minibuffer-hint-fn (current-buffer))))))
-
-(define-minor-mode minibuffer-hint-mode
-  "Foo."
-  :lighter nil
-  (if minibuffer-hint-mode
-      (progn
-        (add-hook 'post-self-insert-hook #'minibuffer-hint-start-timer nil t)
-        (add-hook 'minibuffer-exit-hook #'minibuffer-hint-cancel-timer nil t)
-        (add-hook 'pre-command-hook #'minibuffer-hint-cancel-timer nil t))
-    (remove-hook 'post-self-insert-hook #'minibuffer-hint-start-timer t)
-    (remove-hook 'minibuffer-exit-hook #'minibuffer-hint-cancel-timer t)
-    (remove-hook 'pre-command-hook #'minibuffer-hint-cancel-timer t)
-    (minibuffer-hint-cancel-timer)))
-
-(add-hook 'minibuffer-setup-hook (lambda ()
-                                   (when minibuffer-completion-table
-                                     (minibuffer-hint-mode))))
+(add-hook 'minibuffer-setup-hook #'minibuffer-hint-mode)
 
 (with-eval-after-load 'magit
   (with-eval-after-load 'diff-hl
index 5707e4f12f2d4afb04bda6e3f81d259ff7d2d9df..1b0cd1b6c735f2cadb7d4703a83f4ca134500d31 100644 (file)
      "me@eshelyaron.com" "mail.eshelyaron.com" "mail.eshelyaron.com")
     ("gmail"
      "eshelshay.yaron@gmail.com" "imap.gmail.com" "smtp.gmail.com")
-    ("swi"
-     "eshel@swi-prolog.org" "mail.swi-prolog.com" "mail.swi-prolog.com")
+    ;; ("swi"
+    ;;  "eshel@swi-prolog.org"
+    ;;  ;; "mx.transip.email" "mx.transip.email"
+    ;;  ;; "mail.swi-prolog.com" "mail.swi-prolog.com"
+    ;;  )
     ("uva"
      "eshel.yaron@student.uva.nl" "outlook.office365.com" "smtp.office365.com"
      (nnimap-authenticator xoauth2))))
@@ -88,6 +91,7 @@
                             "text/calendar")
  gnus-icalendar-org-capture-file "~/org/inbox.org"
  gnus-icalendar-org-capture-headline '("Calendar")
+ nntp-connection-timeout 15
 
  ;; Mastodon
  mastodon-instance-url "https://emacs.ch"
index 47aa6ffa41f001d1f53becb91b87cac5b4f40385..4584dabde2a772dfb0fc320ce3d65ea726844716 100644 (file)
@@ -29,7 +29,8 @@
  '(font-lock-doc-face ((t :inherit font-lock-string-face :slant italic)))
  '(elisp-shorthand-font-lock-face ((t :inherit font-lock-keyword-face :slant italic)))
  '(elfeed-search-title-face ((t :inherit shadow)))
- '(error ((t :foreground "Red1"))))
+ ;; '(error ((t :foreground "Red1")))
+ )
 
 (custom-theme-set-variables
  'esy
@@ -55,7 +56,7 @@
      (4 "|%c")
      " "
      (-3 "%p")
-     "/%I "))
+     "/%I  "))
  '(elfeed-search-face-alist '((unread default)))
  '(mode-face-faces '(default fringe mode-line-inactive)))
 
index 310d3e0df1c531ada8a0185988fc6cd5b63af71a..48586f556a5b0b22dcb180024b2746884440cba1 100644 (file)
@@ -28,3 +28,4 @@
 /.emacs.d/etc/
 /Brewfile.lock.json
 /*~
+/TAGS