]> git.eshelyaron.com Git - dotfiles.git/commitdiff
Update Emacs configuration
authorEshel Yaron <me@eshelyaron.com>
Mon, 4 Sep 2023 09:25:55 +0000 (11:25 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 4 Sep 2023 09:25:55 +0000 (11:25 +0200)
.emacs.d/init.el
.emacs.d/lisp/esy-comm.el
.emacs.d/lisp/esy-o365.el
.emacs.d/lisp/some-button.el

index a7f9051616a692227aa9da55bbc96b4ad4ac7718..11576d35bea4d7b658768297648191d6b70b103d 100644 (file)
 (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 ("*")
 (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)
 
  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
 (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)
 
 (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)
index 49e17fccfd6a79048bcd334d1500c34165081603..67ec12222be9c1eb312bc827070b0012fead1c76 100644 (file)
  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"
 
  ;; 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)
index c69986ef0957965dbe6f36accfee2fa0b1e33772..eb1cf05ff900b837a6199eebac3e5f1c7940af4f 100644 (file)
@@ -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
index 46f79d5e17b65dce846f1ccbe4be7633f14f04cb..77eb02fdeb6b18af69903937bdfcc2e8327a7a94 100644 (file)
@@ -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 <eshelshay.yaron@gmail.com>
 
@@ -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")))