From 65a2e95c54813f6205c75a8dd68c5d23b4fd04cf Mon Sep 17 00:00:00 2001 From: Julien Malka Date: Tue, 15 Apr 2025 10:36:12 +0200 Subject: [PATCH] little improvements --- ReadMe.org | 115 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 101 insertions(+), 14 deletions(-) diff --git a/ReadMe.org b/ReadMe.org index 0aeea06..835b9d8 100644 --- a/ReadMe.org +++ b/ReadMe.org @@ -196,6 +196,7 @@ We sometimes need a little help to figure out keybindings, using ~which-key~ for :demand t :config (setq help-window-select t) + (setq dired-kill-when-opening-new-dired-buffer t) (setq eval-expression-print-length nil) (setq kill-do-not-save-duplicates t)) #+end_src @@ -582,7 +583,12 @@ Setup contextual information on minibuffer options. :config (setq corfu-auto t) :init - (global-corfu-mode)) + (global-corfu-mode) + (corfu-popupinfo-mode) + (corfu-history-mode) + :config + (setq corfu-popupinfo-delay '(0.2 . 0.1)) + (setq corfu-popupinfo-hide nil)) #+end_src ~Cape~ is a completion provider for ~corfu~. I mostly use it to complete filenames, mostly. @@ -952,8 +958,10 @@ I have a little integration to remove empty lookbooks from my tasks. Whenever I mark a tasks as done, it gets archived in my daily note. #+begin_src emacs-lisp :tangle "init.el" - (use-package emacs + (use-package org-archive :ensure nil + :after denote-org + :after org :config (setq org-archive-file-header-format nil) (setq org-archive-default-command #'org-archive-subtree-hierarchically) @@ -1021,14 +1029,15 @@ Whenever I mark a tasks as done, it gets archived in my daily note. (file-truename (buffer-file-name))) (luj/archive-to-location (concat today-file "::* Tasks done"))))) - - (add-to-list 'org-after-todo-state-change-hook - (lambda () - (when (member org-state '("DONE" "CANCELLED" "READ")) - (luj/org-roam-archive-todo-to-today)))) + + (add-hook 'org-after-todo-state-change-hook + (lambda () + (when (member org-state '("DONE" "CANCELLED" "READ")) + (luj/org-roam-archive-todo-to-today)))) (setq org-log-done 'time)) + #+end_src @@ -1120,8 +1129,8 @@ I use ~notmuch~ to index and search through my large mail inboxes. #+begin_src emacs-lisp :tangle "init.el" (use-package notmuch :ensure t - :defer t - :config + :init + (setq notmuch-search-oldest-first nil) (setq notmuch-show-logo nil notmuch-column-control 1.0 @@ -1206,6 +1215,76 @@ I use ~notmuch~ to index and search through my large mail inboxes. ("julien.malka@telecom-paris.fr" . "telecom/Sent"))) #+end_src +I want the number of unread messages in my ~notmuch-hello~ buffer. + +#+begin_src emacs-lisp :tangle init.el + (defun luj/notmuch-hello-insert-buttons (searches) + "Insert buttons for SEARCHES. + + SEARCHES must be a list of plists each of which should contain at + least the properties :name NAME :query QUERY and :count COUNT, + where QUERY is the query to start when the button for the + corresponding entry is activated, and COUNT should be the number + of messages matching the query. Such a plist can be computed + with `notmuch-hello-query-counts'." + (let* ((widest (notmuch-hello-longest-label searches)) + (tags-and-width (notmuch-hello-tags-per-line widest)) + (tags-per-line (car tags-and-width)) + (column-width (cdr tags-and-width)) + (column-indent 0) + (count 0) + (reordered-list (notmuch-hello-reflect searches tags-per-line)) + ;; Hack the display of the buttons used. + (widget-push-button-prefix "") + (widget-push-button-suffix "")) + ;; dme: It feels as though there should be a better way to + ;; implement this loop than using an incrementing counter. + (mapc (lambda (elem) + ;; (not elem) indicates an empty slot in the matrix. + (when elem + (when (> column-indent 0) + (widget-insert (make-string column-indent ? ))) + (let* ((name (plist-get elem :name)) + (query (plist-get elem :query)) + (query-unread (concat query " and tag:unread")) + (count-unread (string-to-number (notmuch-saved-search-count query-unread))) + (oldest-first (cl-case (plist-get elem :sort-order) + (newest-first nil) + (oldest-first t) + (otherwise notmuch-search-oldest-first))) + (exclude (cl-case (plist-get elem :excluded) + (hide t) + (show nil) + (otherwise notmuch-search-hide-excluded))) + (search-type (plist-get elem :search-type)) + (msg-count (plist-get elem :count))) + (widget-insert (format "%8s(%2s) " + (notmuch-hello-nice-number msg-count) + (if (>= count-unread 100) + "xx" + (notmuch-hello-nice-number count-unread)))) + (widget-create 'push-button + :notify #'notmuch-hello-widget-search + :notmuch-search-terms query + :notmuch-search-oldest-first oldest-first + :notmuch-search-type search-type + :notmuch-search-hide-excluded exclude + name) + (setq column-indent + (1+ (max 0 (- column-width (length name))))))) + (cl-incf count) + (when (eq (% count tags-per-line) 0) + (setq column-indent 0) + (widget-insert "\n"))) + reordered-list) + ;; If the last line was not full (and hence did not include a + ;; carriage return), insert one now. + (unless (eq (% count tags-per-line) 0) + (widget-insert "\n")))) + (advice-add 'notmuch-hello-insert-buttons :override #'luj/notmuch-hello-insert-buttons) +#+end_src + + * Programming @@ -1358,11 +1437,7 @@ The compilation buffer is very useful to launch ephemeral processes. ~eglot~ is the builtin LSP client inside ~emacs~. It works well, but I add some customization to make it faster. #+begin_src emacs-lisp :tangle "init.el" - (use-package eglot - :ensure nil - :config - (fset #'jsonrpc--log-event #'ignore) - (setq eglot-events-buffer-size 0)) + (use-package eglot) #+end_src Including using ~eglot-booster~, that bufferize the LSP output instead of ~emacs~ and parses the ~json~. @@ -1374,6 +1449,18 @@ Including using ~eglot-booster~, that bufferize the LSP output instead of ~emacs :config (eglot-booster-mode)) #+end_src +I don't like how I must open another buffer to get documentation, so let's go with ~eldoc-box~ + +#+begin_src emacs-lisp :tangle "init.el" + (use-package eldoc-box + :ensure t + :config + (eldoc-box-hover-at-point-mode) + (add-hook 'eglot-managed-mode-hook #'eldoc-box-hover-mode t) + ) +#+end_src + + ** Programming modes