From 0493f7c546909b98b36fad4f1a3b4a4181d4305c Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Thu, 13 Feb 2025 12:49:09 +0100 Subject: [PATCH] Update Emacs configuration --- .emacs.d/init.el | 93 +++++++++++++++++-------- .emacs.d/lisp/esy-comm.el | 2 + .emacs.d/lisp/some-button.el | 129 ----------------------------------- .emacs.d/theme/esy-theme.el | 1 + 4 files changed, 69 insertions(+), 156 deletions(-) delete mode 100644 .emacs.d/lisp/some-button.el diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 092fa3f..b3ef28a 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -135,6 +135,7 @@ ;; :branch "externals/oauth2")) (elpaca transient) (elpaca (magit :repo "git@git.sr.ht:~eshel/magit")) +(elpaca (el-search :repo "git@git.sr.ht:~eshel/el-search" :branch "master")) (elpaca (markdown-mode :pre-build (("pandoc" "-o" "markdown-mode.texi" "README.md")))) (elpaca mastodon) @@ -162,6 +163,9 @@ ("mv" "README.texi" "pdf-tools.texi")))) (elpaca ob-prolog) (elpaca (kubed :repo "~/checkouts/kubed")) +(elpaca (lean4-mode :repo "https://github.com/leanprover-community/lean4-mode" + :files ("*"))) +(elpaca (ultra-scroll :repo "git@github.com:jdtsmith/ultra-scroll.git")) ;; (elpaca kubed) (elpaca-wait) @@ -489,7 +493,11 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t)) help-enable-variable-value-editing t pcomplete-termination-string "" imenu-flatten t - imenu-auto-rescan t) + imenu-auto-rescan t + scroll-conservatively 101 ; For `ultra-scroll' + rotate-windows-change-selected nil + use-system-tooltips nil + x-max-tooltip-size '(80 . 12)) (setq-default indent-tabs-mode nil display-line-numbers-width 4) @@ -506,7 +514,6 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t)) ;;; Add custom code directory to `load-path' (add-to-list 'load-path (expand-file-name "lisp/" user-emacs-directory)) -(autoload 'some-button "some-button" nil t) (unless (eq system-type 'android) (add-to-list 'load-path "~/checkouts/esy-publish/") @@ -846,22 +853,29 @@ Interactively, POINT is point and KILL is the prefix argument." (keymap-set ctl-x-map "k" #'esy/kill-buffers) (find-function-setup-keys) -(keymap-set search-map "b" #'some-button) - (keymap-set window-prefix-map "p" #'windmove-swap-states-up) (keymap-set window-prefix-map "n" #'windmove-swap-states-down) (keymap-set window-prefix-map "a" #'windmove-swap-states-left) (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) +(keymap-set window-prefix-map "r" #'rotate-window-layout-clockwise) +(keymap-set window-prefix-map "R" #'rotate-window-layout-counterclockwise) +(keymap-set window-prefix-map "|" #'flip-window-layout-horizontally) +(keymap-set window-prefix-map "-" #'flip-window-layout-vertically) +(keymap-set window-prefix-map "=" #'fit-window-to-buffer) (dolist (command '(windmove-swap-states-up windmove-swap-states-down windmove-swap-states-left - windmove-swap-states-right)) + windmove-swap-states-right + rotate-window-layout-clockwise + rotate-window-layout-counterclockwise + flip-window-layout-horizontally + flip-window-layout-vertically)) (put command 'repeat-map 'window-prefix-map)) +(keymap-set isearch-mode-map "C-;" #'avy-isearch) + ;;; digit arguments with the super modifier (dotimes (i 10) (keymap-global-set (concat "s-" (number-to-string i)) @@ -1030,25 +1044,25 @@ as the initial input for completion, and return that directory." (add-to-list 'global-hl-line-modes mode))) ;;; Enable some global minor modes -(dolist (mode '(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-hl-line-mode - global-minibuffer-auto-completion-mode - kubed-menu-bar-mode - minibuffer-depth-indicate-mode - pixel-scroll-precision-mode - recentf-mode - repeat-mode - save-place-mode - savehist-mode - transient-mark-mode - winner-mode)) - (funcall mode)) +(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-hl-line-mode) +(global-minibuffer-auto-completion-mode) +(kubed-menu-bar-mode) +(minibuffer-depth-indicate-mode) +;; (pixel-scroll-precision-mode +(ultra-scroll-mode) +(recentf-mode) +(repeat-mode) +(save-place-mode) +(savehist-mode) +(transient-mark-mode) +(winner-mode) ;;; Set up EMMS @@ -1281,10 +1295,11 @@ as the initial input for completion, and return that directory." (keymap-set completion-preview-active-mode-map "M-p" #'completion-preview-prev-candidate) (keymap-set completion-preview-active-mode-map "M-f" #'completion-preview-insert-word)) +(add-hook 'read-shell-command-minibuffer-setup-hook #'completion-preview-mode) (add-hook 'eval-expression-minibuffer-setup-hook #'completion-preview-mode) (add-hook 'eval-expression-minibuffer-setup-hook #'electric-pair-local-mode) -(load-file "/usr/local/opt/agda/libexec/ghc-9.10.1-inplace/Agd-2.6.4.3-7d670049/share/emacs-mode/agda2.el") +;; (load-file "/usr/local/opt/agda/libexec/ghc-9.10.1-inplace/Agd-2.6.4.3-7d670049/share/emacs-mode/agda2.el") (defun read-buffer-to-switch-recentf (file) (interactive @@ -1397,5 +1412,29 @@ as the initial input for completion, and return that directory." (with-eval-after-load 'package (backtrace)) +(defun esy/update-forks () + (interactive) + (require 'with-editor) + (require 'git-commit) + (require 'server) + (unless (server-running-p) (server-start)) + (with-editor + (compile (string-join + (mapcar (lambda (name) + (format + "echo Updating: %s && git -C %s pull && git -C %s push" + name name name)) + (mapcar (lambda (base) + (expand-file-name base "~/checkouts")) + '("auctex" "pdf-tools" "magit" "tablist"))) + " && ")))) + +(defvar esy/trusted-files `(,user-init-file ,early-init-file)) + +(setq trusted-content + (mapcar #'abbreviate-file-name + (append esy/trusted-files + (mapcar #'file-name-as-directory load-path)))) + (provide 'init) ;;; init.el ends here diff --git a/.emacs.d/lisp/esy-comm.el b/.emacs.d/lisp/esy-comm.el index 1176549..4170ba7 100644 --- a/.emacs.d/lisp/esy-comm.el +++ b/.emacs.d/lisp/esy-comm.el @@ -50,6 +50,7 @@ message-alternative-emails (regexp-opt (mapcar #'cadr esy-comm-accounts)) message-dont-reply-to-names message-alternative-emails message-elide-ellipsis "\n[...%l lines elided...]\n" + message-generate-hashcash nil message-server-alist (mapcar (pcase-lambda (`(,_ ,cond ,_ ,server . ,_)) (cons cond @@ -91,6 +92,7 @@ "text/calendar") gnus-icalendar-org-capture-file "~/org/inbox.org" gnus-icalendar-org-capture-headline '("Calendar") + gnus-large-newsgroup 2048 nntp-connection-timeout 15 ;; Mastodon diff --git a/.emacs.d/lisp/some-button.el b/.emacs.d/lisp/some-button.el deleted file mode 100644 index 77eb02f..0000000 --- a/.emacs.d/lisp/some-button.el +++ /dev/null @@ -1,129 +0,0 @@ -;;; some-button.el --- Push some button -*- lexical-binding: t -*- - -;; Copyright (C) 2021-2023 Eshel Yaron - -;; Author: Eshel Yaron - -;; This file 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 file 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 file. If not, see . - -;;; Package-Version: 0.1.0 -;;; Package-Requires: ((emacs "29")) - -;;; Commentary: - -;;; Code: - -(defun some-button--completion-candidate (index button) - "Return a completion candidate for BUTTON prefixed by INDEX." - (cons (concat (propertize (format "%d " index) - 'invisible t) - (truncate-string-to-width - (to-line (button-label button)) - 64 nil ?\s t)) - (button-start button))) - -(defun some-button--buttons (&optional buffer pom) - "Return an alist of buttons in BUFFER. -Buttons following POM appear first in the resulting list." - (with-current-buffer (or buffer (current-buffer)) - (let ((pos (or pom (point))) - (button (next-button (point-min))) - (index 1) - (buttons-before nil) - (buttons-after nil)) - (while (and button (< (button-start button) pos)) - (setq buttons-before - (cons (some-button--completion-candidate index button) - buttons-before)) - (setq index (1+ index)) - (setq button (next-button (button-end button)))) - (while button - (setq buttons-after - (cons (some-button--completion-candidate index button) - buttons-after)) - (setq index (1+ index)) - (setq button (next-button (button-end button)))) - (append (reverse buttons-after) (reverse buttons-before))))) - -(defun to-line (str) - "Inline STR." - (when str - (string-replace "\n" " " str))) - -(defun some-button--completing-read (prompt collection window buffer) - "Prompt for an button among COLLECTION with preview. -PROMPT passed on to `completing-read'. WINDOW is the window in -which to show preview for locations in BUFFER." - (define-advice next-completion (:after (&rest _) after-advice) - (let* ((completion (with-minibuffer-completions-window - (substring-no-properties - (get-text-property (point) - 'completion--string)))) - (pos (cdr (assoc completion collection)))) - (with-selected-window window - (unless (= (goto-char pos) (point)) - (widen) - (goto-char pos)) - (recenter) - (pulse-momentary-highlight-one-line)))) - (unwind-protect - (let ((completions-sort nil) - (completion-extra-properties - (list :annotation-function (some-button--annotate-function collection buffer)))) - (completing-read prompt collection nil t nil nil (caar collection))) - (advice-remove #'next-completion - 'next-completion@after-advice))) - -(defun some-button--annotate-function (collection buffer) - "Annotate candidate amond COLLECTION in BUFFER." - (lambda (key) - (with-current-buffer buffer - (let* ((button (button-at - (cdr - (assoc key collection)))) - (type (or (button-type button) - (button-get button 'action))) - (url (button-get button 'shr-url)) - (turl (and url - (truncate-string-to-width - (to-line url) 80 nil ?\s t)))) - (to-line - (if type - (if turl - (format "\t%S %64s" type turl) - (format "\t%S" type)) - (when turl - (format "\t%64s" turl)))))))) - -;;;###autoload -(defun some-button (&optional no-push) - "Jump to a button in the current buffer and push it. -If NO-PUSH is non-nil (interactively, the prefix argument), only -jump to the selected button but don't push it." - (interactive "P") - (if-let ((buf (current-buffer)) - (win (selected-window)) - (table (some-button--buttons))) - (let* ((choice (save-excursion - (some-button--completing-read - "Button: " table win buf))) - (pos (cdr (assoc choice table)))) - (goto-char pos) - (unless no-push - (or (ignore-errors (push-button)) - (shr-browse-url)))) - (user-error "No buttons in current buffer"))) - -(provide 'some-button) -;;; some-button.el ends here diff --git a/.emacs.d/theme/esy-theme.el b/.emacs.d/theme/esy-theme.el index 50b67a2..949911e 100644 --- a/.emacs.d/theme/esy-theme.el +++ b/.emacs.d/theme/esy-theme.el @@ -31,6 +31,7 @@ ;; '(font-lock-variable-use-face ((t :foreground "sienna"))) '(elisp-shorthand-font-lock-face ((t :inherit font-lock-keyword-face :slant italic))) '(elfeed-search-title-face ((t :inherit shadow))) + '(tooltip ((t :background "#f0fff0"))) ;; '(error ((t :foreground "Red1"))) ) -- 2.39.5