]> git.eshelyaron.com Git - dotfiles.git/commitdiff
Update
authorEshel Yaron <me@eshelyaron.com>
Sun, 4 Aug 2024 10:09:40 +0000 (12:09 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 4 Aug 2024 10:09:40 +0000 (12:09 +0200)
.emacs.d/init.el
.emacs.d/theme/esy-theme.el

index b9d7bac28dda3b48331de9cdf8e703aa9d6b1d06..b35ab7796355a6ddec297b6c0af9fd5c84f1c98c 100644 (file)
@@ -1,5 +1,5 @@
 ;;; init.el --- Personal Emacs configuration -*- lexical-binding: t -*-
-;; Copyright (C) 2021-2023 Eshel Yaron
+;; Copyright (C) 2021-2024 Eshel Yaron
 
 ;; Author: Eshel Yaron <me@eshelyaron.com>
 
 
 (elpaca org-transclusion)
 (elpaca sweeprolog)
-(elpaca avy)
 (elpaca (bbdb
          :repo "https://git.savannah.nongnu.org/git/bbdb.git"
          :files (:defaults "lisp/*.el.in")
          :pre-build (("pandoc" "-o" "elfeed.texi" "README.md"))))
 (elpaca emms)
 (elpaca htmlize)
-(elpaca kubernetes)
 (elpaca (oauth2
          :repo "git://git.sv.gnu.org/emacs/elpa"
          :local-repo "oauth2"
                       "--eval" "(setq org-babel-confirm-evaluate-answer-no t)"
                       "-f" "org-texinfo-export-to-texinfo"))))
 (elpaca paredit)
-(elpaca rainbow-delimiters)
-(elpaca rainbow-mode)
 (elpaca sqlformat)
-(elpaca (mode-face :repo "https://git.sr.ht/~eshel/mode-face"))
 (elpaca (auctex
+         :branch "main"
          :files ("*.el" "*.info*")
          :pre-build (("./autogen.sh")
                      ("./configure" "--with-lispdir=." "--with-texmf-dir=/tmp")
                       "-f" "org-texinfo-export-to-texinfo")
                      ("mv" "README.texi"  "pdf-tools.texi"))))
 (elpaca ob-prolog)
+(elpaca (kubed :repo "~/checkouts/kubed"))
 
 (elpaca-wait)
 
 (defvar-keymap esy/elpaca-prefix-map
   :doc "Keymap for `elpaca' commands."
+  :prefix 'esy/elpaca-prefix-map
   "r" #'elpaca-rebuild
   "e" #'elpaca-recipe
   "f" #'elpaca-fetch
   "d" #'elpaca-delete
   "l" #'elpaca-log-updates
   "i" #'elpaca-info
-  "t" #'elpaca-try)
+  "t" #'elpaca-try
+  "m" #'elpaca-update-menus)
 
 (keymap-unset elpaca-ui-mode-map "p" t)
 (keymap-set elpaca-ui-mode-map "l" #'elpaca-ui-mark-pull)
                          (quit-windows-on "*elpaca-diff*")))
                       nil t)))
 
-(defalias 'esy/elpaca-prefix-map esy/elpaca-prefix-map)
-
 ;;; Set some variables
 
 (setq
  ;; don't spawn new frames in Ediff
  ediff-window-setup-function #'ediff-setup-windows-plain
  duplicate-line-final-position -1
- tramp-kubernetes-namespace "argo"
;; tramp-kubernetes-namespace "argo"
  ;; configure Org capture templates
  org-capture-templates '(("t" "Todo [inbox]" entry
                           (file+headline "~/org/inbox.org" "Tasks")
@@ -325,6 +322,7 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t))
                  ("studies"  . ?s)
                  ("esols"    . ?e)
                  ("personal" . ?p)
+                 ("kubed"    . ?k)
                  (:endgroup))
  ;; minimal prompt for tags
  org-fast-tag-selection-single-key 'expert
@@ -429,13 +427,14 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t))
  '((buffer       (styles                          substring))
    (file         (styles basic partial-completion substring)
                  (sort-function . minibuffer-sort-by-history))
+   (cobra-command-line (styles basic substring partial-completion))
    (project-file (styles basic partial-completion substring))
    (recent-file  (styles basic partial-completion substring))
    (command      (sort-function . minibuffer-sort-by-history)))
;; completion-auto-help 'visible
+ completion-auto-help 'visible
  completions-max-height 16
  completion-auto-wrap t
completion-at-point-functions nil
read-minibuffer-restore-windows nil
  shell-kill-buffer-on-exit t
  compilation-scroll-output t
  display-time-default-load-average nil
@@ -481,9 +480,16 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t))
  ;; confirm-nonexistent-file-or-buffer nil
  extended-command-dim-hyphens t
  read-buffer-completion-ignore-case t
- echo-keystrokes-help nil)
+ echo-keystrokes-help nil
+ checkdoc-verb-check-experimental-flag nil
+ prefix-help-command #'help-complete-keys
+ help-enable-variable-value-editing t
+ pcomplete-termination-string ""
+ imenu-flatten t
+ imenu-auto-rescan t)
 
-(setq-default indent-tabs-mode nil)
+(setq-default indent-tabs-mode nil
+               display-line-numbers-width 4)
 
 ;;; Load my custom theme
 
@@ -734,60 +740,6 @@ Interactively, POINT is point and KILL is the prefix argument."
       (message path))
     path))
 
-(defun esy/transcribe ()
-  (interactive)
-  (message "Recording...")
-  (let ((process
-         (start-process "ffmpeg" nil "ffmpeg"
-                        "-f" "avfoundation"
-                        "-i" "1:0"
-                        "-ar" "16000"
-                        "-y"
-                        "/tmp/foo.wav")))
-    (set-transient-map
-     (make-sparse-keymap) nil
-     (lambda ()
-       (message "Stopping recording")
-       (interrupt-process process)
-       (accept-process-output process 1 nil t)
-       (message "Transcribing...")
-       (message
-        (string-trim-right
-         (string-trim-left
-          (with-temp-buffer
-            (call-process "whisper"
-                          nil '(t nil) nil
-                          "-m"
-                          "/Users/eshelyaron/checkouts/whisper.cpp/models/ggml-base.en.bin"
-                          "--no-timestamps" "-f" "/tmp/foo.wav")
-            (goto-char (point-min))
-            (while (search-forward "[BLANK_AUDIO]" nil t)
-              (replace-match "" nil t))
-            (buffer-string))))))
-     "Recording...  Press any key to stop")))
-
-(defun esy/record (timeout)
-  (interactive "p")
-  (message "Recording...")
-  (call-process "ffmpeg"
-                nil nil nil
-                "-f" "avfoundation"
-                "-i" "1:0" "-t"
-                (number-to-string (max timeout 2))
-                "-ar" "16000" "-y" "/tmp/foo.wav")
-  (openai-chat (string-trim-right
-                (string-trim-left
-                 (with-temp-buffer
-                   (call-process "whisper"
-                                 nil '(t nil) nil
-                                 "-m"
-                                 "/Users/eshelyaron/checkouts/whisper.cpp/models/ggml-base.en.bin"
-                                 "--no-timestamps" "-f" "/tmp/foo.wav")
-                   (goto-char (point-min))
-                   (while (search-forward "[BLANK_AUDIO]" nil t)
-                     (replace-match "" nil t))
-                   (buffer-string))))))
-
 (defun esy/dedicate-window (window flag)
   (interactive (list (get-buffer-window) (not current-prefix-arg)))
   (message "Window is %s dedicated to buffer %s."
@@ -820,10 +772,16 @@ Interactively, POINT is point and KILL is the prefix argument."
 
 ;;; Extend standard programming mode hooks
 
+(defun esy/prog-set-up-capf ()
+  (add-hook 'completion-at-point-functions
+            #'tags-completion-at-point-function 90 t))
+
 (dolist (mode '(bug-reference-prog-mode
                 display-fill-column-indicator-mode
                 display-line-numbers-mode
-                flymake-mode))
+                flymake-mode
+                ;; esy/prog-set-up-capf
+                ))
   (add-hook 'prog-mode-hook mode))
 
 (add-hook 'lisp-data-mode-hook #'paredit-mode)
@@ -837,19 +795,19 @@ 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 !" #'flymake-go-to-diagnostic)
 (keymap-global-set "C-c f" #'recentf-open)
+(keymap-global-set "C-c k" 'kubed-prefix-map)
 (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 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 C" #'esy-publish-create-post)
-(keymap-global-set "C-c O" #'openai-chat)
 (keymap-global-set "C-c e" 'esy/elpaca-prefix-map)
 (keymap-global-set "C-c E" #'elfeed)
 (keymap-global-set "C-c T" #'esy/ttyper)
-(keymap-global-set "C-c R" #'esy/record)
 (keymap-global-set "C-c G" #'gnus)
 (keymap-global-set "C-c M" #'mastodon)
 (keymap-global-set "C-c t" #'esy/tmp-dired)
@@ -888,6 +846,8 @@ Interactively, POINT is point and KILL is the prefix argument."
 (keymap-set window-prefix-map "e" #'windmove-swap-states-right)
 (keymap-set window-prefix-map "d" #'esy/dedicate-window)
 
+(keymap-set isearch-mode-map "C-;" #'avy-isearch)
+
 (dolist (command '(windmove-swap-states-up
                    windmove-swap-states-down
                    windmove-swap-states-left
@@ -909,7 +869,8 @@ Interactively, POINT is point and KILL is the prefix argument."
                    narrow-to-region
                    narrow-to-page
                    downcase-region
-                   upcase-region))
+                   upcase-region
+                   list-timers))
   (put command 'disabled nil))
 
 ;;; disable some commands
@@ -920,9 +881,9 @@ Interactively, POINT is point and KILL is the prefix argument."
 
 (with-eval-after-load 'project
   (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"))
+  (add-to-list 'project-switch-commands '(project-go-to-diagnostic "Flymake"))
   (define-key project-prefix-map "w" #'project-copy-relative-file-name-as-kill)
   (define-key project-prefix-map "m" #'magit-project-status)
 
@@ -1073,28 +1034,24 @@ as the initial input for completion, and return that directory."
 
 ;;; Enable some global minor modes
 
-(dolist (mode '(
-                column-number-mode
-                context-menu-mode
-                display-time-mode
-                display-battery-mode
-                global-auto-revert-mode
-                global-diff-hl-mode
-                lin-global-mode
-                minibuffer-depth-indicate-mode
-                pixel-scroll-precision-mode
-                recentf-mode
-                repeat-mode
-                save-place-mode
-                savehist-mode
-                transient-mark-mode
-                winner-mode
-                completions-auto-update-mode
-                ;; mode-face-global-mode
-                global-completion-preview-mode
-                ;; tab-bar-mode
-                ))
-  (funcall mode))
+(mapc #'funcall '(column-number-mode
+                  context-menu-mode
+                  display-battery-mode
+                  display-time-mode
+                  global-auto-revert-mode
+                  global-completion-preview-mode
+                  global-diff-hl-mode
+                  global-minibuffer-auto-completion-mode
+                  kubed-menu-bar-mode
+                  lin-global-mode
+                  minibuffer-depth-indicate-mode
+                  pixel-scroll-precision-mode
+                  recentf-mode
+                  repeat-mode
+                  save-place-mode
+                  savehist-mode
+                  transient-mark-mode
+                  winner-mode))
 
 ;;; Set up EMMS
 
@@ -1309,7 +1266,8 @@ as the initial input for completion, and return that directory."
 
 (with-eval-after-load 'elisp-mode
   (setq elisp-flymake-byte-compile-load-path (cons "./" load-path))
-  (keymap-set emacs-lisp-mode-map "C-c C-t" #'trace-function))
+  (keymap-set emacs-lisp-mode-map "C-c C-t" #'trace-function)
+  (keymap-set emacs-lisp-mode-map "C-c C-s" #'set-variable))
 
 (dolist (mm '((go-ts-mode         . go-ts-mode-hook)
               (typescript-ts-mode . typescript-ts-mode-hook)
@@ -1323,8 +1281,7 @@ 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-f" #'completion-preview-insert-word))
 
 (load-file "/Users/eshelyaron/checkouts/agda/src/data/emacs-mode/agda2.el")
 
@@ -1395,11 +1352,13 @@ as the initial input for completion, and return that directory."
   (interactive
    (list (let ((def (buffer-name)))
            (minibuffer-with-setup-hook
-               (lambda () (setq minibuffer-completion-action
+               (lambda () (setq minibuffer-action
                                 (cons (lambda (buf-name)
                                         (kill-buffer buf-name)
                                         (message "Killed %s" buf-name))
-                                      "kill")))
+                                      "kill")
+                                minibuffer-alternative-action
+                                (cons #'display-buffer "display")))
              (completing-read-multiple
               (format-prompt "Kill buffers" def)
               (completion-buffer-name-table) nil t nil
@@ -1418,8 +1377,6 @@ as the initial input for completion, and return that directory."
 
 (load-file (expand-file-name "admin/cherry.el" source-directory))
 
-(add-hook 'minibuffer-setup-hook #'minibuffer-hint-mode)
-
 (with-eval-after-load 'magit
   (with-eval-after-load 'diff-hl
     (add-hook 'magit-pre-refresh-hook  'diff-hl-magit-pre-refresh)
@@ -1432,5 +1389,10 @@ as the initial input for completion, and return that directory."
   (interactive "sSearch: ")
   (eww (url-encode-url (format "yhetil.org/emacs?q=%s" q))))
 
+(with-eval-after-load 'vc-git
+  (add-hook 'vc-git-region-history-mode-hook #'bug-reference-mode))
+
+(add-hook 'find-function-after-hook #'esy/pulse-line)
+
 (provide 'init)
 ;;; init.el ends here
index 99f190e7f35ff46856e5d2387564c583b260b54c..219658edf670b960f3c0ba3df5f4bd0a7527db3f 100644 (file)
 
 (custom-theme-set-variables
  'esy
+ '(mode-line-position-column-line-format
+   '("%5l" (4 "|%c")))
+ '(mode-line-position
+   '((line-number-mode
+      (column-number-mode
+       mode-line-position-column-line-format
+       mode-line-position-line-format)
+      (column-number-mode
+       mode-line-position-column-format))
+     " " (8 ("" mode-line-percent-position "/%I"))))
  '(mode-line-format
    '(" %+ "
      (:eval (when-let (project (project-current))
      mode-name mode-line-process minor-mode-alist
      (:eval (when (window-dedicated-p)
               " Dedicated"))
-     (eglot--managed-mode (" " (:eval (when  (eglot--mode-line-format)))))
+     (eglot--managed-mode (" " (:eval (when (eglot--mode-line-format)))))
      "%n%])"
      (vc-mode vc-mode)
      (which-func-mode (" " which-func-format))
      mode-line-format-right-align
      (:eval (when (mode-line-window-selected-p)
-              (list "" 'display-time-string 'battery-mode-line-string " ")))
-     "%5l"
-     (4 "|%c")
-     " "
-     (-3 "%p")
-     "/%I  "))
+              (list "" 'display-time-string 'battery-mode-line-string)))
+     mode-line-position "  "))
  '(elfeed-search-face-alist '((unread default)))
  '(mode-face-faces '(default fringe mode-line-inactive))
  '(mode-face-global-mode t))