From: Eshel Yaron Date: Mon, 4 Sep 2023 09:25:55 +0000 (+0200) Subject: Update Emacs configuration X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=52a954ad34f599528567a1dafebe38ee3071a9bf;p=dotfiles.git Update Emacs configuration --- diff --git a/.emacs.d/init.el b/.emacs.d/init.el index a7f9051..11576d3 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -178,11 +178,8 @@ (elpaca sqlformat) (elpaca (sweeprolog :repo "~/checkouts/sweep/" - :files ("*.org" "dir" "*.info" "sweep.pl" - "sweeprolog-pce-theme.el" "sweeprolog.el") - :pre-build (("emacs" "--batch" "-l" "ox-texinfo" "README.org" - "--eval" "(setq org-babel-confirm-evaluate-answer-no t)" - "-f" "org-texinfo-export-to-texinfo")))) + :files ("*.org" "*.texi" "sweep.pl" + "sweeprolog-pce-theme.el" "sweeprolog.el"))) (elpaca terraform-mode) (elpaca (vterm :files ("*") @@ -199,6 +196,7 @@ (elpaca (do-at-point :repo "https://git.sr.ht/~pkal/do-at-point" :pre-build (("pandoc" "-o" "do-at-point.texi" "README.md")))) +(elpaca rfc-mode) (elpaca-wait) @@ -442,13 +440,7 @@ eldoc-minor-mode-string nil flyspell-mode-line-string nil paredit-lighter nil - ;; IRC stuff - rcirc-default-nick "esy" - rcirc-server-alist '(("irc.libera.chat" - :channels ("#emacs") - :port 6697 - :encryption tls)) - rcirc-log-flag t + eglot-confirm-server-edits 'diff ;; use my custom project-prompting function project-prompter #'esy/read-project-by-name ;; have common bindings initially hidden in the output of C-h b @@ -550,6 +542,29 @@ (put 'transpose-lines 'repeat-map 'transpose-lines-repeat-map) ;;; utility commands + +(defun esy/emacs-patch (file) + (interactive "fPatch file: ") + (require 'emacsbug) + (delete-other-windows) + (let ((pbuf (get-buffer-create "*Patch*")) + (subject nil)) + (with-current-buffer pbuf + (insert-file-contents file nil nil nil t) + (setq subject (mail-fetch-field "Subject")) + (diff-mode)) + (compose-mail report-emacs-bug-address subject) + (message-goto-body) + (insert "Tags: patch\n\n\n\n") + (mml-attach-file file "text/patch" nil "attachment") + (message-goto-body) + (forward-line 2) + (display-buffer pbuf '(display-buffer-in-direction (direction . right))) + (message-add-action (lambda () + (when-let (window (get-buffer-window pbuf)) + (quit-window nil window))) + 'send 'kill))) + (defun esy/kill-dwim () "When region is active, kill region, otherwise kill last word." (interactive) @@ -575,6 +590,7 @@ (defun esy/hut-builds () (interactive) + (require 'eat) (let ((eat-kill-buffer-on-exit nil)) (eat "hut builds show -f" t))) @@ -919,6 +935,7 @@ Interactively, POINT is point and KILL is the prefix argument." (keymap-global-set "M-#" #'dictionary-search) (keymap-global-set "M-o" #'previous-buffer) (keymap-global-set "M-O" #'next-buffer) +(keymap-global-set "C-'" #'do-at-point) (keymap-global-set "C-," #'backward-delete-char) (keymap-global-set "C-." #'embark-act) (keymap-global-set "C-;" #'avy-goto-char-timer) @@ -970,6 +987,7 @@ Interactively, POINT is point and KILL is the prefix argument." (put command 'disabled nil)) ;;; disable some commands + (put 'suspend-frame 'disabled t) ;;; Configure project management commands @@ -1243,15 +1261,15 @@ as the initial input for completion, and return that directory." ;;; Configure terminal emulation via `vterm' (with-eval-after-load 'vterm - (when (eq system-type 'darwin) - (setq vterm-shell "/bin/zsh")) (add-to-list 'vterm-tramp-shells '("kubernetes" "/bin/bash"))) ;;; Remove some over-intrusive keybindings in `paredit' (with-eval-after-load 'paredit (keymap-unset paredit-mode-map "M-s" t) - (keymap-unset paredit-mode-map "M-?" t)) + (keymap-unset paredit-mode-map "M-?" t) + (with-eval-after-load 'eldoc + (eldoc-add-command 'paredit-RET))) ;;; Configure Prolog integration via `sweeprolog' @@ -1372,6 +1390,11 @@ as the initial input for completion, and return that directory." (with-eval-after-load (car mm) (setf (alist-get (cdr mm) minor-mode-alist) '("")))) +;;; Configure Texinfo mode + +(with-eval-after-load 'texinfo + (add-hook 'texinfo-mode-hook #'abbrev-mode)) + ;;; Track currency exchange rates (defvar esy/eur-to-ils-rates nil) diff --git a/.emacs.d/lisp/esy-comm.el b/.emacs.d/lisp/esy-comm.el index 49e17fc..67ec122 100644 --- a/.emacs.d/lisp/esy-comm.el +++ b/.emacs.d/lisp/esy-comm.el @@ -66,16 +66,18 @@ gnus-simplify-subject-functions '(gnus-simplify-subject-re) gnus-treat-display-smileys nil gnus-select-method '(nntp "news.gmane.io") - gnus-secondary-select-methods (mapcar - (pcase-lambda - (`(,name ,_ ,address ,_ . ,tail)) - `(nnimap ,name - (nnimap-address ,address) - (nnimap-server-port "imaps") - (nnimap-stream ssl) - . - ,tail)) - esy-comm-accounts) + gnus-secondary-select-methods (cons + '(nntp "news.eternal-september.org") + (mapcar + (pcase-lambda + (`(,name ,_ ,address ,_ . ,tail)) + `(nnimap ,name + (nnimap-address ,address) + (nnimap-server-port "imaps") + (nnimap-stream ssl) + . + ,tail)) + esy-comm-accounts)) gnus-no-groups-message "No new articles" gnus-use-full-window nil gnus-article-treat-types '("text/plain" @@ -97,7 +99,15 @@ ;; emacsbug.el report-emacs-bug-no-explanations t - submit-emacs-patch-display-help nil) + submit-emacs-patch-display-help nil + + ;; rcirc.el + rcirc-default-nick "esy" + rcirc-server-alist '(("irc.libera.chat" + :channels ("#emacs") + :port 6697 + :encryption tls)) + rcirc-log-flag t) (with-eval-after-load 'gnus (require 'gnus-icalendar) diff --git a/.emacs.d/lisp/esy-o365.el b/.emacs.d/lisp/esy-o365.el index c69986e..eb1cf05 100644 --- a/.emacs.d/lisp/esy-o365.el +++ b/.emacs.d/lisp/esy-o365.el @@ -50,6 +50,7 @@ ;;;###autoload (defun esy-o365-setup (mua) + (require 'auth-source) (if (not (file-exists-p esy-o365-token-directory)) (let ((m "`esy-o365-token-directory' does not exist")) (if after-init-time (user-error m) (display-warning 'comm m))) @@ -59,7 +60,7 @@ (pcase mua ('gnus (dolist (hook '(gnus-before-startup-hook gnus-before-resume-hook)) - (add-hook hook #'esy-o365-maybe-refresh-token) ))))) + (add-hook hook #'esy-o365-maybe-refresh-token)))))) (provide 'esy-o365) ;;; esy-o365.el ends here diff --git a/.emacs.d/lisp/some-button.el b/.emacs.d/lisp/some-button.el index 46f79d5..77eb02f 100644 --- a/.emacs.d/lisp/some-button.el +++ b/.emacs.d/lisp/some-button.el @@ -1,6 +1,6 @@ ;;; some-button.el --- Push some button -*- lexical-binding: t -*- -;; Copyright (C) 2021-2022 Eshel Yaron +;; Copyright (C) 2021-2023 Eshel Yaron ;; Author: Eshel Yaron @@ -107,8 +107,10 @@ which to show preview for locations in BUFFER." (format "\t%64s" turl)))))))) ;;;###autoload -(defun some-button (&optional arg) - "Push a button in the current buffer with completion and preview." +(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)) @@ -118,7 +120,7 @@ which to show preview for locations in BUFFER." "Button: " table win buf))) (pos (cdr (assoc choice table)))) (goto-char pos) - (when (not arg) + (unless no-push (or (ignore-errors (push-button)) (shr-browse-url)))) (user-error "No buttons in current buffer")))