]> git.eshelyaron.com Git - dotfiles.git/commitdiff
Update Emacs configuration
authorEshel Yaron <me@eshelyaron.com>
Wed, 10 Jan 2024 13:23:54 +0000 (14:23 +0100)
committerEshel Yaron <me@eshelyaron.com>
Wed, 10 Jan 2024 13:23:54 +0000 (14:23 +0100)
.emacs.d/init.el
.emacs.d/lisp/completions-auto-update.el [deleted file]
.emacs.d/theme/esy-theme.el

index 989391de11098ccf5271e099f86c29890b3bf36a..821aab1c1b3fc5d85ba3bf5fb68b95c74b7851ca 100644 (file)
                      ("install-info" "--dir=dir" "eat.info"))))
 (elpaca (elfeed
          :pre-build (("pandoc" "-o" "elfeed.texi" "README.md"))))
-(elpaca embark-consult)
+(elpaca embark)
 (elpaca emms)
 (elpaca htmlize)
 (elpaca keycast)
 (elpaca (markdown-mode
          :pre-build (("pandoc" "-o" "markdown-mode.texi" "README.md"))))
 (elpaca mastodon)
-(elpaca orderless)
-(elpaca (marginalia
-         :pre-build (("emacs" "--batch" "-l" "ox-texinfo" "README.org"
-                      "--eval" "(setq org-babel-confirm-evaluate-answer-no t)"
-                      "-f" "org-texinfo-export-to-texinfo"))
-         :repo "https://github.com/minad/marginalia.git"))
 (elpaca (osm
          :pre-build (("emacs" "--batch" "-l" "ox-texinfo" "README.org"
                       "--eval" "(setq org-babel-confirm-evaluate-answer-no t)"
 (elpaca ob-prolog)
 (elpaca (query-replace-parallel
          :repo "https://github.com/hokomo/query-replace-parallel.git"))
+
 (elpaca-wait)
 
 (defvar-keymap esy/elpaca-prefix-map
@@ -378,7 +373,7 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t))
  ;; don't ask me about it either
  tramp-allow-unsafe-temporary-files t
  ;; increase maximum number of recent files Emacs remembers
- recentf-max-saved-items 128
+ recentf-max-saved-items 1024
  ;; increase maximum kill ring size
  kill-ring-max 256
  ;; save text copied from another program to the kill ring
@@ -396,6 +391,21 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t))
  shr-color-visible-luminance-min 75
  ;; direct Magit to my Git checkouts directory
  magit-repository-directories '(("~/checkouts/" . 1))
+ magit-status-sections-hook
+ '(magit-insert-status-headers
+   magit-insert-merge-log
+   magit-insert-rebase-sequence
+   magit-insert-am-sequence
+   magit-insert-sequencer-sequence
+   magit-insert-bisect-output
+   magit-insert-bisect-rest
+   magit-insert-bisect-log
+   magit-insert-untracked-files
+   magit-insert-unstaged-changes
+   magit-insert-staged-changes
+   magit-insert-stashes
+   magit-insert-unpushed-to-pushremote
+   magit-insert-recent-commits)
  ;; have Dired operations target another visible Dired buffer
  dired-dwim-target t
  ;; use MPV with EMMS
@@ -412,8 +422,13 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t))
  show-trailing-whitespace t
  read-extended-command-predicate #'command-completion-default-include-p
  completions-format 'one-column
+ completions-detailed t
  completion-auto-select nil
- completion-styles '(orderless partial-completion basic)
+ completion-styles '(substring partial-completion)
+ completion-category-overrides '((buffer (styles substring))
+                                 (file   (styles basic
+                                                 partial-completion
+                                                 substring)))
  completion-show-help nil
  ;; completions-header-format nil
  ;; completion-auto-help 'visible
@@ -427,8 +442,6 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t))
  display-time-default-load-average nil
  ;; allow disabling confirming before compilation via local variables
  safe-local-variable-values '((compilation-read-command . nil))
- xref-show-definitions-function #'consult-xref
- xref-show-xrefs-function       #'consult-xref
  xref-search-program             'ripgrep
  ;; include CWD in shell command prompts
  shell-command-prompt-show-cwd t
@@ -464,7 +477,9 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t))
  ;; TeX-electric-escape t
  LaTeX-electric-left-right-brace t
  ;; Read remote man pages
- Man-support-remote-systems t)
+ Man-support-remote-systems t
+ confirm-nonexistent-file-or-buffer t
+ extended-command-dim-hyphens t)
 
 (setq-default indent-tabs-mode nil)
 
@@ -478,7 +493,8 @@ 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-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/")
@@ -487,7 +503,8 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t))
   (autoload 'esy-publish-local-server "esy-publish"  nil t)
   (autoload 'esy-publish-create-post  "esy-publish"  nil t)
   (with-eval-after-load 'recentf
-    (add-to-list 'recentf-exclude "~/checkouts/esy-publish/local/.*\.html")))
+    (add-to-list 'recentf-exclude "~/checkouts/esy-publish/local/.*\.html")
+    (add-to-list 'recentf-exclude #'file-remote-p)))
 
 (require 'esy-comm)
 
@@ -540,10 +557,9 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t))
       (backward-word)
       (kill-region (point) end))))
 
-(defvar duplicate-line-final-position)
-
 (defun duplicate-line-stay (arg)
   (interactive "p")
+  (require 'misc)
   (let ((duplicate-line-final-position 0))
     (duplicate-line arg)))
 
@@ -808,15 +824,11 @@ Interactively, POINT is point and KILL is the prefix argument."
                 display-fill-column-indicator-mode
                 display-line-numbers-mode
                 flymake-mode
-                ;; flyspell-prog-mode
-                completion-preview-mode
-                ))
+                completion-preview-mode))
   (add-hook 'prog-mode-hook mode))
 
 (add-hook 'lisp-data-mode-hook #'paredit-mode)
-(add-hook 'lisp-data-mode-hook (lambda ()
-                                 (when (require 'rainbow-delimiters nil t)
-                                   (rainbow-delimiters-mode))))
+(add-hook 'lisp-data-mode-hook #'rainbow-delimiters-mode)
 
 ;;; Extend standard text mode hooks
 
@@ -827,13 +839,13 @@ Interactively, POINT is point and KILL is the prefix argument."
 
 (keymap-global-set "C-M-i" #'completion-at-point)
 (keymap-global-set "C-c c" #'org-capture)
+(keymap-global-set "C-c f" #'recentf-open)
 (keymap-global-set "C-c l" #'org-store-link)
 (keymap-global-set "C-c a" #'org-agenda)
 (keymap-global-set "C-c v" #'esy/terminal)
 (keymap-global-set "C-c p" #'sweeprolog-prefix-map)
 (keymap-global-set "C-c S" #'scratch-buffer)
 (keymap-global-set "C-c m" #'esy/emms-map)
-(keymap-global-set "C-c !" #'consult-flymake)
 (keymap-global-set "C-c C" #'esy-publish-create-post)
 (keymap-global-set "C-c O" #'openai-chat)
 (keymap-global-set "C-c e" 'esy/elpaca-prefix-map)
@@ -844,14 +856,11 @@ Interactively, POINT is point and KILL is the prefix argument."
 (keymap-global-set "C-c M" #'mastodon)
 (keymap-global-set "C-c t" #'esy/tmp-dired)
 (keymap-global-set "C-c F" #'esy/find-init-file)
-(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)
-(keymap-global-set "<remap> <imenu>" #'consult-imenu)
 (keymap-global-set "s-n" #'duplicate-line)
 (keymap-global-set "s-p" #'duplicate-line-stay)
 (keymap-global-set "s-u" #'universal-argument)
@@ -869,10 +878,6 @@ Interactively, POINT is point and KILL is the prefix argument."
 (keymap-global-set "M-'" #'insert-pair)
 (keymap-global-set "M-]" #'up-list)
 
-(keymap-set ctl-x-map "b" #'consult-buffer)
-(keymap-set ctl-x-4-map "b" #'consult-buffer-other-window)
-(keymap-set ctl-x-5-map "b" #'consult-buffer-other-frame)
-(keymap-set ctl-x-map "r b" #'consult-bookmark)
 (keymap-set ctl-x-map "C-b" #'ibuffer)
 
 (keymap-set search-map "r" #'rg)
@@ -916,17 +921,13 @@ Interactively, POINT is point and KILL is the prefix argument."
 ;;; Configure project management commands
 
 (with-eval-after-load 'project
-  (define-advice project--find-in-directory (:override (dir) no-remote-projects)
-    (unless (file-remote-p dir)
-      (run-hook-with-args-until-success 'project-find-functions dir)))
   (add-to-list 'project-switch-commands '(project-compile "Compile"))
   (add-to-list 'project-switch-commands '(rg-project "rg"))
   (add-to-list 'project-switch-commands '(magit-project-status "Magit"))
   (add-to-list 'project-switch-commands '(project-shell "Shell"))
-  (when (boundp 'project-prefix-map)
-    (define-key project-prefix-map "R" #'rg-project)
-    (define-key project-prefix-map "w" #'project-copy-relative-file-name-as-kill)
-    (define-key project-prefix-map "m" #'magit-project-status))
+  (define-key project-prefix-map "R" #'rg-project)
+  (define-key project-prefix-map "w" #'project-copy-relative-file-name-as-kill)
+  (define-key project-prefix-map "m" #'magit-project-status)
 
   (defvar esy/project-name-history nil)
 
@@ -1062,18 +1063,12 @@ as the initial input for completion, and return that directory."
 
 ;;; Configure minibuffer completions
 
-(defvar esy/completing-read-commands nil)
-
-(add-to-list 'savehist-additional-variables
-             'esy/completing-read-commands)
-
-(define-advice completing-read (:before (&rest _) record-command)
-  (cl-incf (alist-get this-command esy/completing-read-commands 0)))
-
 (add-to-list 'display-buffer-alist
              '("\\*Completions\\*"
                (display-buffer-reuse-window display-buffer-at-bottom)
-               (window-parameters (mode-line-format . none))))
+               (window-parameters
+                ;; (mode-line-format . none)
+                (split-window . ignore))))
 
 (add-hook 'completion-list-mode-hook
           (lambda ()
@@ -1087,10 +1082,6 @@ as the initial input for completion, and return that directory."
               (car key-binding)
               (cdr key-binding)))
 
-(with-eval-after-load 'consult
-  (with-eval-after-load 'embark
-    (require 'embark-consult)))
-
 ;;; Define some custom `completion-at-point-functions'
 
 (defun file-capf ()
@@ -1131,7 +1122,6 @@ as the initial input for completion, and return that directory."
                 global-diff-hl-mode
                 global-whitespace-cleanup-mode
                 lin-global-mode
-                marginalia-mode
                 minibuffer-depth-indicate-mode
                 pixel-scroll-precision-mode
                 recentf-mode
@@ -1216,7 +1206,7 @@ as the initial input for completion, and return that directory."
 
 ;;; Associate major modes with files based on their extensions
 
-(dolist (cell '(("Dockerfile"  . dockerfile-ts-mode)
+(dolist (cell '(("Dockerfile\\'"  . dockerfile-ts-mode)
                 ("\\.ya?ml\\'" . yaml-ts-mode)
                 ("\\.toml\\'"  . toml-ts-mode)
                 ("\\.json\\'"  . json-ts-mode)
@@ -1349,8 +1339,8 @@ as the initial input for completion, and return that directory."
   (with-eval-after-load (car mm) (add-hook (cdr mm) #'eglot-ensure)))
 
 (with-eval-after-load 'completion-preview
-  (push 'org-self-insert-command completion-preview-commands)
-  (push 'paredit-backward-delete completion-preview-commands)
+  (add-to-list 'completion-preview-commands 'org-self-insert-command)
+  (add-to-list 'completion-preview-commands 'paredit-backward-delete)
   (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)
@@ -1358,5 +1348,49 @@ as the initial input for completion, and return that directory."
 
 (load-file "/Users/eshelyaron/checkouts/agda/src/data/emacs-mode/agda2.el")
 
+(defun read-buffer-to-switch-recentf (file)
+  (interactive
+   (minibuffer-with-setup-hook #'minibuffer-completion-help
+     (unless recentf-mode (recentf-mode 1))
+     (let ((completions-sort nil))
+       (list (completing-read (format-prompt "Open recent file" nil)
+                              recentf-list nil t (minibuffer-contents))))))
+  (let ((buf (find-file-noselect file)))
+    (delete-minibuffer-contents)
+    (insert (buffer-name buf))
+    (exit-minibuffer)))
+
+(defun read-buffer-to-switch-bookmark (bookmark)
+  (interactive
+   (minibuffer-with-setup-hook #'minibuffer-completion-help
+     (list (bookmark-completing-read "Jump to bookmark"))))
+  (let ((buf (save-current-buffer
+               (bookmark-handle-bookmark bookmark)
+               (current-buffer))))
+    (delete-minibuffer-contents)
+    (insert (buffer-name buf))
+    (exit-minibuffer)))
+
+(defvar-keymap read-buffer-to-switch-mode-map
+  :doc "Keymap for `read-buffer-to-switch-mode'."
+  "M-m" #'read-buffer-to-switch-bookmark
+  "M-r" #'read-buffer-to-switch-recentf)
+
+(define-minor-mode read-buffer-to-switch-mode
+  "Minor mode for reading a buffer name in the minibuffer."
+  :group 'minibuffer)
+
+(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)))
+    (let ((read-buffer-function nil))
+      (read-buffer prompt def require-match predicate))))
+
+(setq read-buffer-function #'esy/read-buffer)
+
+(load-file (expand-file-name "admin/cherry.el" source-directory))
+
 (provide 'init)
 ;;; init.el ends here
diff --git a/.emacs.d/lisp/completions-auto-update.el b/.emacs.d/lisp/completions-auto-update.el
deleted file mode 100644 (file)
index 59b4065..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-;;; completions-auto-update.el --- Auto-update minibuffer completions  -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2023  Eshel Yaron
-
-;; Author: Eshel Yaron <me@eshelyaron.com>
-;; Keywords: convenience
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; This file defines a minor mode `completions-auto-update-mode' that
-;; updates the *Completions* buffer as you type in the minibuffer.
-
-;;; Code:
-
-(defcustom completions-auto-update-idle-time 0.2
-  "Number of seconds of idle to wait for before updating *Completions*."
-  :group 'minibuffer
-  :type 'number)
-
-(defvar-local completions-auto-update-timer nil)
-
-(defun completions-auto-update ()
-  "Update the *Completions* buffer, if it is visible."
-  (when (get-buffer-window "*Completions*")
-    (if completion-in-region-mode
-        (completion-help-at-point)
-      (minibuffer-completion-help)))
-  (setq completions-auto-update-timer nil))
-
-(defun completions-auto-update-start-timer ()
-  "Start an idle timer for updating *Completions*."
-  (unless (or completions-auto-update-timer
-              (not (get-buffer-window "*Completions*")))
-    (setq completions-auto-update-timer
-          (run-with-idle-timer completions-auto-update-idle-time
-                               nil #'completions-auto-update))))
-
-(defun completions-auto-update-setup ()
-  (add-hook 'post-self-insert-hook #'completions-auto-update-start-timer nil t))
-
-(defun completions-auto-update-exit ()
-  (remove-hook 'post-self-insert-hook #'completions-auto-update-start-timer t))
-
-(define-minor-mode completions-auto-update-mode
-  "Update the *Completions* buffer as you type in the minibuffer."
-  :global t :group 'minibuffer
-  (if completions-auto-update-mode
-      (progn
-        (add-hook 'minibuffer-setup-hook #'completions-auto-update-setup)
-        (add-hook 'minibuffer-setup-exit #'completions-auto-update-exit))
-    (remove-hook 'minibuffer-setup-hook #'completions-auto-update-setup)
-    (remove-hook 'minibuffer-setup-exit #'completions-auto-update-exit)))
-
-(provide 'completions-auto-update)
-;;; completions-auto-update.el ends here
index abece978f4ab8538d03f556acc915d32d09c2bc7..baab475d0feb299674ca363fd35589565a4ed268 100644 (file)
@@ -28,7 +28,8 @@
  '(cursor ((t :background "salmon")))
  '(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))))
+ '(elfeed-search-title-face ((t :inherit shadow)))
+ '(error ((t :foreground "Red1"))))
 
 (custom-theme-set-variables
  'esy