From c7baa477cf0041ac006f55795cd6619a569418c1 Mon Sep 17 00:00:00 2001 From: jao Date: Wed, 14 Oct 2026 23:46:06 +0100 Subject: back to linux tweaks --- attic/elisp/jao-ednc.el | 143 --------------------------------------- attic/elisp/jao-recoll.el | 7 +- attic/elisp/misc.el | 3 +- custom/jao-custom-notmuch.el | 14 ++-- custom/jao-custom-programming.el | 14 ++-- custom/jao-custom-x11.el | 1 + init.el | 136 ++++++++++++++++++------------------- lib/eos/jao-ednc.el | 143 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 223 insertions(+), 238 deletions(-) delete mode 100644 attic/elisp/jao-ednc.el create mode 100644 lib/eos/jao-ednc.el diff --git a/attic/elisp/jao-ednc.el b/attic/elisp/jao-ednc.el deleted file mode 100644 index 92ee21f..0000000 --- a/attic/elisp/jao-ednc.el +++ /dev/null @@ -1,143 +0,0 @@ -;;; jao-ednc.el --- Minibuffer notifications using EDNC -*- lexical-binding: t; -*- - -;; Copyright (C) 2020, 2021, 2024 jao - -;; Author: jao -;; Keywords: tools, abbrev - -;; This program 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 program 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 program. If not, see . - -;;; Commentary: - -;; Use the ednc package to provide a notification daemon that uses -;; the minibuffer to display them. - -;;; Code: - -(require 'ednc) -(require 'jao-minibuffer) - -(declare-function tracking-add-buffer "tracking") -(declare-function tracking-remove-buffer "tracking") - -(defvar jao-ednc--count-format " {%d} ") -(defvar jao-ednc--notifications ()) -(defvar jao-ednc--handlers ()) - -(defvar jao-ednc-use-tracking nil) - -(defface jao-ednc-tracking '((t :inherit warning)) - "Tracking notifications face" - :group 'jao-ednc) - -(defun jao-ednc--last-notification () (car jao-ednc--notifications)) - -(defun jao-ednc--format-last () - (when (jao-ednc--last-notification) - (let ((s (ednc-format-notification (jao-ednc--last-notification) t))) - (replace-regexp-in-string "\n" " " (substring-no-properties s))))) - -(defun jao-ednc--count () - (let ((no (length jao-ednc--notifications))) - (if (> no 0) - (propertize (format jao-ednc--count-format no) 'face 'warning) - ""))) - -(defun jao-ednc-add-handler (app handler) - (add-to-list 'jao-ednc--handlers (cons app handler))) - -(defun jao-ednc-ignore-app (app) - (jao-ednc-add-handler app - (lambda (not _) - (ignore-errors (ednc-dismiss-notification not))))) - -(defun jao-ednc--clean (&optional notification) - (tracking-remove-buffer (get-buffer ednc-log-name)) - (if notification - (remove notification jao-ednc--notifications) - (pop jao-ednc--notifications)) - (jao-minibuffer-refresh)) - -(defun jao-ednc--show-last () - (message (jao-ednc--format-last))) - -(defun jao-ednc--default-handler (notification newp) - (if (not newp) - (jao-ednc--clean notification) - (when jao-ednc-use-tracking - (tracking-add-buffer (get-buffer ednc-log-name) '(jao-ednc-tracking))) - (push notification jao-ednc--notifications) - (jao-ednc--show-last))) - -(defun jao-ednc--handler (notification) - (alist-get (ednc-notification-app-name notification) - jao-ednc--handlers - #'jao-ednc--default-handler - nil - 'string=)) - -(defun jao-ednc--on-notify (old new) - (when old (funcall (jao-ednc--handler old) old nil)) - (when new (funcall (jao-ednc--handler new) new t))) - -(defun jao-ednc-setup (minibuffer-order) - (setq jao-notify-use-messages t) - (with-eval-after-load "tracking" - (when jao-ednc-use-tracking - (add-to-list 'tracking-faces-priorities 'jao-ednc-tracking) - (when (listp tracking-shorten-modes) - (add-to-list 'tracking-shorten-modes 'ednc-view-mode)))) - (when minibuffer-order - (jao-minibuffer-add-variable '(jao-ednc--count) minibuffer-order)) - (add-hook 'ednc-notification-presentation-functions #'jao-ednc--on-notify) - (ednc-mode)) - -(defun jao-ednc-pop () - (interactive) - (pop-to-buffer-same-window ednc-log-name)) - -(defun jao-ednc-show () - (interactive) - (if (not (jao-ednc--last-notification)) - (jao-ednc-pop) - (jao-ednc--show-last))) - -(defun jao-ednc-invoke-last-action () - (interactive) - (if (jao-ednc--last-notification) - (ednc-invoke-action (jao-ednc--last-notification)) - (message "No active notifications")) - (jao-ednc--clean)) - -(defun jao-ednc-dismiss () - (interactive) - (when (jao-ednc--last-notification) - (ignore-errors - (with-current-buffer ednc-log-name - (ednc-dismiss-notification (jao-ednc--last-notification))))) - (jao-ednc--clean)) - -(defun jao-ednc-dismiss-and-show () - (interactive) - (let ((m (jao-ednc--format-last))) - (jao-ednc-dismiss) - (when m (message m)))) - -(defun jao-ednc-dismiss-all () - (interactive) - (while (jao-ednc--last-notification) - (jao-ednc-dismiss))) - -(provide 'jao-ednc) -;;; jao-ednc.el ends here diff --git a/attic/elisp/jao-recoll.el b/attic/elisp/jao-recoll.el index b23106f..def4b5a 100644 --- a/attic/elisp/jao-recoll.el +++ b/attic/elisp/jao-recoll.el @@ -1,6 +1,6 @@ ;;; jao-recoll.el -- Displaying recoll queries -*- lexical-binding: t; -*- -;; Copyright (c) 2017, 2020, 2021, 2022 Jose Antonio Ortega Ruiz +;; Copyright (c) 2017, 2020, 2021, 2022, 2026 Jose Antonio Ortega Ruiz ;; 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 @@ -41,6 +41,7 @@ (defvar-local jao-recoll--last-query nil) (defvar-local jao-recoll--last-full-query nil) +;;;###autoload (defun jao-recoll-show-query () (interactive) (message (concat jao-recoll--last-query "\n" @@ -65,7 +66,7 @@ ((looking-at "^0 : \\(.[^\n]+\\)") (let ((desc (match-string 1))) (replace-match " - ") - (insert (org-make-link-string lnk desc)))) + (insert (org-link-make-string lnk desc)))) (t (insert " - "))) (forward-line 1)) (unless (eobp) (kill-line))))) @@ -110,7 +111,7 @@ (concat (file-name-nondirectory ref) " :: " desc)) desc))) (delete-region start end) - (insert "* " (org-make-link-string lnk desc) " (" mime ")") + (insert "* " (org-link-make-string lnk desc) " (" mime ")") (forward-line) (jao-recoll--format-snippets lnk))) (pop-to-buffer (current-buffer)) diff --git a/attic/elisp/misc.el b/attic/elisp/misc.el index c2a6bd3..7e15ee9 100644 --- a/attic/elisp/misc.el +++ b/attic/elisp/misc.el @@ -298,8 +298,7 @@ mu4e-user-mail-address-list jao-mails mu4e-view-show-addresses t mu4e-view-show-images t - mu4e-maildir-shortcuts '((:maildir "/jao/inbox" :key ?j) - (:maildir "/bigml/inbox" :key ?b)) + mu4e-maildir-shortcuts '((:maildir "/jao/inbox" :key ?j)) jao-mu4e-uninteresting-mail-query (concat "flag:unread AND NOT flag:trashed" diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el index 8b8cd58..0cb60e7 100644 --- a/custom/jao-custom-notmuch.el +++ b/custom/jao-custom-notmuch.el @@ -33,10 +33,10 @@ (defun jao-notmuch-notify () (interactive) (let* ((cnts (notmuch-hello-query-counts jao-notmuch-minibuffer-queries)) - (mc (jao-d-l + (mc (jao-when-darwin (when jao-notmuch-mac-mail-badge - (jao-mac-app-badge jao-notmuch-mac-mail-badge)) - 0)) + (jao-mac-app-badge jao-notmuch-mac-mail-badge) + 0))) (cnts (if mc (cons `(:name "" :count ,(format "[%s]" mc)) cnts) cnts))) (setq jao-notmuch-minibuffer-string (mapconcat #'jao-notmuch--qstr cnts " ")) (when jao-notmuch-mac-hammerspoon (jao-notmuch-hammerspoon)) @@ -260,7 +260,6 @@ (let (;; (d `(:foreground ,(face-attribute 'jao-themes-dimm :foreground))) (e `(:foreground ,(face-attribute 'jao-themes-error :foreground)))) `(("attachment" "⧺") - ("bigml" "b") ("deleted" "⛒" (propertize tag 'face '(:underline nil ,@e))) ("feeds" "f") ("flagged" "✓") @@ -594,10 +593,7 @@ (advice-remove 'notmuch-tree #'jao-notmuch-before-tree) (advice-remove 'notmuch-tree-quit #'jao-notmuch-after-tree-quit)) - (when jao-notmuch-enabled - ;; (jao-d-l (jao-notmuch-use-one-pane) (jao-notmuch-use-two-panes)) - (jao-notmuch-use-two-panes) - ) + (when jao-notmuch-enabled (jao-notmuch-use-two-panes)) :bind (:map notmuch-tree-mode-map (("b" . jao-notmuch-browse-urls) @@ -721,7 +717,7 @@ (defvar jao-consult-notmuch-history nil) - (defvar jao-mailbox-folders '("bigml" "jao")) + (defvar jao-mailbox-folders '("jao")) (defun jao-consult-notmuch-folder (&optional tree folder) (interactive "P") diff --git a/custom/jao-custom-programming.el b/custom/jao-custom-programming.el index 4ea4029..0e749c0 100644 --- a/custom/jao-custom-programming.el +++ b/custom/jao-custom-programming.el @@ -74,10 +74,10 @@ (lisp-interaction-mode . disable-paredit-mode)) :diminish ((paredit-mode . " þ"))) -(use-package smartparens - :ensure t - :bind (:map smartparens-mode-map - ("C-)" . sp-forward-slurp-sexp))) +;; (use-package smartparens +;; :ensure t +;; :bind (:map smartparens-mode-map +;; ("C-)" . sp-forward-slurp-sexp))) ;;;; diff/ediff (setq ediff-split-window-function 'split-window-horizontally) @@ -624,12 +624,6 @@ (t "prolog"))))) ;;;; Python -(use-package virtualenvwrapper - :ensure t - :config - (venv-initialize-eshell) - (jao-compilation-env "VIRTUAL_ENV")) - (use-package uv-mode :ensure t :hook (python-mode . uv-mode-auto-activate-hook)) diff --git a/custom/jao-custom-x11.el b/custom/jao-custom-x11.el index 6f0a607..3922bc5 100644 --- a/custom/jao-custom-x11.el +++ b/custom/jao-custom-x11.el @@ -22,6 +22,7 @@ ;;; exwm (defun jao-exwm-enable () + (interactive) (require 'jao-custom-exwm) (setq jao-exwm-enabled t) (display-time-mode -1) diff --git a/init.el b/init.el index 2a69e8e..5c79f06 100644 --- a/init.el +++ b/init.el @@ -33,12 +33,11 @@ ("melpa" . "https://melpa.org/packages/")) package-archive-priorities '(("gnu-devel" . 2) ("nongnu-devel" . 1) - ("melpa" . 0))) + ("melpa" . 0)) + package-install-upgrade-built-in t) (package-initialize) -(require 'use-package) - (use-package gnu-elpa-keyring-update :ensure t) ;;;; .elc vs .el loading @@ -165,7 +164,7 @@ ;;;; docker (use-package dockerfile-mode :ensure t) -(use-package docker :ensure t) +(jao-when-darwin (use-package docker :ensure t)) ;;;; sleep/awake (use-package jao-sleep @@ -834,71 +833,71 @@ (require 'jao-custom-completion) ;;;; recoll -(jao-when-linux (jao-load-path "consult-recoll")) - -(use-package consult-recoll - :if (jao-is-linux) - :commands (consult-recoll consult-recoll-embark-setup) - :init - (defun jao-recoll-format (title url _mtype) - (let* ((u (replace-regexp-in-string "file://" "" url)) - (u (replace-regexp-in-string "/home/jao/" "" u)) - (u (replace-regexp-in-string - "\\(doc\\|org/doc\\|.emacs.d/gnus/Mail\\|var/mail\\)/" "" u))) - (format "%s (%s)" ;; "%s (%s, %s)" - title - (propertize u 'face 'jao-themes-f01) - ;; (propertize mtype 'face 'jao-themes-f01) - ))) - - (defun jao-recoll-open-html (file &optional _page) - (if (string-match-p "\.epub\\'" file) - (find-file file) - (jao-afio-goto-www) - (if jao-afio-use-w3m (w3m-find-file file) (eww-open-file file)))) - - (defun jao-recoll-open-pdf (file &optional page) - (if (string-match-p "/gnus/Mail/" file) - (funcall - (or (cdr (assoc-string "message/rfc822" consult-recoll-open-fns)) - 'find-file) - file - page) - (jao-open-doc file page))) - - (defun jao-recoll-consult-messages () - (interactive) - (consult-recoll "mime:message ")) - - (defun jao-recoll-consult-docs () - (interactive) - (consult-recoll (format "dir:%s/doc " (jao-org-dir)))) - - (defun jao-recoll-consult-notes () - "Use consult-recoll to search notes." - (interactive) - (consult-recoll (format "dir:%s " jao-org-notes-dir))) +(jao-when-linux + (jao-load-path "consult-recoll") + + (defun jao-recoll-format (title url _mtype) + (let* ((u (replace-regexp-in-string "file://" "" url)) + (u (replace-regexp-in-string "/home/jao/" "" u)) + (u (replace-regexp-in-string + "\\(doc\\|org/doc\\|.emacs.d/gnus/Mail\\|var/mail\\)/" "" u))) + (format "%s (%s)" ;; "%s (%s, %s)" + title + (propertize u 'face 'jao-themes-f01) + ;; (propertize mtype 'face 'jao-themes-f01) + ))) + + (defun jao-recoll-open-html (file &optional _page) + (if (string-match-p "\.epub\\'" file) + (find-file file) + (jao-afio-goto-www) + (if jao-afio-use-w3m (w3m-find-file file) (eww-open-file file)))) + + (defun jao-recoll-open-pdf (file &optional page) + (if (string-match-p "/gnus/Mail/" file) + (funcall + (or (cdr (assoc-string "message/rfc822" consult-recoll-open-fns)) + 'find-file) + file + page) + (jao-open-doc file page))) + + (defun jao-recoll-consult-messages () + (interactive) + (consult-recoll "mime:message ")) - (setq consult-recoll-open-fns - '(("application/pdf" . jao-recoll-open-pdf) - ("text/html" . jao-recoll-open-html)) - consult-recoll-search-flags 'query - consult-recoll-inline-snippets t - consult-recoll-format-candidate #'jao-recoll-format) + (defun jao-recoll-consult-docs () + (interactive) + (consult-recoll (format "dir:%s/doc " (jao-org-dir)))) - :config + (defun jao-recoll-consult-notes () + "Use consult-recoll to search notes." + (interactive) + (consult-recoll (format "dir:%s " jao-org-notes-dir))) + + (setq consult-recoll-open-fns + '(("application/pdf" . jao-recoll-open-pdf) + ("text/html" . jao-recoll-open-html)) + consult-recoll-search-flags 'query + consult-recoll-inline-snippets t + consult-recoll-format-candidate #'jao-recoll-format) + + (use-package consult-recoll + :demand t + :commands (consult-recoll consult-recoll-embark-setup) + :config + (consult-customize consult-recoll :preview-key 'any) - (consult-customize consult-recoll :preview-key 'any) - (with-eval-after-load "embark" (consult-recoll-embark-setup)) + (with-eval-after-load "embark" (consult-recoll-embark-setup)) - (transient-define-prefix jao-transient-recoll () - ["Consult recoll queries" - ("r" "everywhere" consult-recoll) - ("n" "on notes" jao-recoll-consult-notes) - ("d" "on docs" jao-recoll-consult-docs) - ("m" "on messages" jao-recoll-consult-messages)]) + (transient-define-prefix jao-transient-recoll () + ["Consult recoll queries" + ("r" "everywhere" consult-recoll) + ("n" "on notes" jao-recoll-consult-notes) + ("d" "on docs" jao-recoll-consult-docs) + ("m" "on messages" jao-recoll-consult-messages)]) - :bind (("s-r" . #'jao-transient-recoll))) + :bind (("s-r" . #'jao-transient-recoll)))) ;;;; alternative (mac): consult-spotlight @@ -1382,10 +1381,6 @@ (add-to-list 'display-buffer-alist '("\\*Async Shell Command\\*" (display-buffer-no-window))) -(use-package nushell-ts-mode - :ensure t - :config (setq nushell-ts-mode-indent-offset 4)) - ;;;; eat (use-package eat :ensure t @@ -1603,8 +1598,7 @@ (setq magit-repository-directories (jao-d-l '(("/Users/jao/Projects" . 3)) - '(("/home/jao/usr/bigml" . 2) - ("/home/jao/usr/jao" . 3) + '(("/home/jao/usr/jao" . 3) ("/usr/local/src" . 1)))) (setq magit-status-initial-section nil @@ -2138,7 +2132,7 @@ ("do" "open doc" jao-open-doc) ("dr" "search docs with recoll" jao-recoll-consult-docs)] ["Monitors" - ("p" "list projects" list-projects) + ;; ("p" "list projects" list-projects) ;; ("p" "htop" jao-term-htop) ("P" "pasytray" jao-toggle-pasystray-applet) ("x" "restart i3bar" jao-river-restart-i3bar :if jao-river-enabled-p) diff --git a/lib/eos/jao-ednc.el b/lib/eos/jao-ednc.el new file mode 100644 index 0000000..92ee21f --- /dev/null +++ b/lib/eos/jao-ednc.el @@ -0,0 +1,143 @@ +;;; jao-ednc.el --- Minibuffer notifications using EDNC -*- lexical-binding: t; -*- + +;; Copyright (C) 2020, 2021, 2024 jao + +;; Author: jao +;; Keywords: tools, abbrev + +;; This program 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 program 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 program. If not, see . + +;;; Commentary: + +;; Use the ednc package to provide a notification daemon that uses +;; the minibuffer to display them. + +;;; Code: + +(require 'ednc) +(require 'jao-minibuffer) + +(declare-function tracking-add-buffer "tracking") +(declare-function tracking-remove-buffer "tracking") + +(defvar jao-ednc--count-format " {%d} ") +(defvar jao-ednc--notifications ()) +(defvar jao-ednc--handlers ()) + +(defvar jao-ednc-use-tracking nil) + +(defface jao-ednc-tracking '((t :inherit warning)) + "Tracking notifications face" + :group 'jao-ednc) + +(defun jao-ednc--last-notification () (car jao-ednc--notifications)) + +(defun jao-ednc--format-last () + (when (jao-ednc--last-notification) + (let ((s (ednc-format-notification (jao-ednc--last-notification) t))) + (replace-regexp-in-string "\n" " " (substring-no-properties s))))) + +(defun jao-ednc--count () + (let ((no (length jao-ednc--notifications))) + (if (> no 0) + (propertize (format jao-ednc--count-format no) 'face 'warning) + ""))) + +(defun jao-ednc-add-handler (app handler) + (add-to-list 'jao-ednc--handlers (cons app handler))) + +(defun jao-ednc-ignore-app (app) + (jao-ednc-add-handler app + (lambda (not _) + (ignore-errors (ednc-dismiss-notification not))))) + +(defun jao-ednc--clean (&optional notification) + (tracking-remove-buffer (get-buffer ednc-log-name)) + (if notification + (remove notification jao-ednc--notifications) + (pop jao-ednc--notifications)) + (jao-minibuffer-refresh)) + +(defun jao-ednc--show-last () + (message (jao-ednc--format-last))) + +(defun jao-ednc--default-handler (notification newp) + (if (not newp) + (jao-ednc--clean notification) + (when jao-ednc-use-tracking + (tracking-add-buffer (get-buffer ednc-log-name) '(jao-ednc-tracking))) + (push notification jao-ednc--notifications) + (jao-ednc--show-last))) + +(defun jao-ednc--handler (notification) + (alist-get (ednc-notification-app-name notification) + jao-ednc--handlers + #'jao-ednc--default-handler + nil + 'string=)) + +(defun jao-ednc--on-notify (old new) + (when old (funcall (jao-ednc--handler old) old nil)) + (when new (funcall (jao-ednc--handler new) new t))) + +(defun jao-ednc-setup (minibuffer-order) + (setq jao-notify-use-messages t) + (with-eval-after-load "tracking" + (when jao-ednc-use-tracking + (add-to-list 'tracking-faces-priorities 'jao-ednc-tracking) + (when (listp tracking-shorten-modes) + (add-to-list 'tracking-shorten-modes 'ednc-view-mode)))) + (when minibuffer-order + (jao-minibuffer-add-variable '(jao-ednc--count) minibuffer-order)) + (add-hook 'ednc-notification-presentation-functions #'jao-ednc--on-notify) + (ednc-mode)) + +(defun jao-ednc-pop () + (interactive) + (pop-to-buffer-same-window ednc-log-name)) + +(defun jao-ednc-show () + (interactive) + (if (not (jao-ednc--last-notification)) + (jao-ednc-pop) + (jao-ednc--show-last))) + +(defun jao-ednc-invoke-last-action () + (interactive) + (if (jao-ednc--last-notification) + (ednc-invoke-action (jao-ednc--last-notification)) + (message "No active notifications")) + (jao-ednc--clean)) + +(defun jao-ednc-dismiss () + (interactive) + (when (jao-ednc--last-notification) + (ignore-errors + (with-current-buffer ednc-log-name + (ednc-dismiss-notification (jao-ednc--last-notification))))) + (jao-ednc--clean)) + +(defun jao-ednc-dismiss-and-show () + (interactive) + (let ((m (jao-ednc--format-last))) + (jao-ednc-dismiss) + (when m (message m)))) + +(defun jao-ednc-dismiss-all () + (interactive) + (while (jao-ednc--last-notification) + (jao-ednc-dismiss))) + +(provide 'jao-ednc) +;;; jao-ednc.el ends here -- cgit v1.2.3