summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--custom/jao-custom-completion.el2
-rw-r--r--custom/jao-custom-gnus.el30
-rw-r--r--init.el11
-rw-r--r--lib/doc/jao-org-notes.el11
-rw-r--r--lib/eos/jao-dirmon.el4
-rw-r--r--lib/media/jao-mpris.el32
-rw-r--r--lib/net/randomsig.el9
7 files changed, 61 insertions, 38 deletions
diff --git a/custom/jao-custom-completion.el b/custom/jao-custom-completion.el
index 9524e23..34701b3 100644
--- a/custom/jao-custom-completion.el
+++ b/custom/jao-custom-completion.el
@@ -87,7 +87,7 @@
(funcall fun lines)
(move-overlay vertico--candidates-ov (point-min) (point-min))
(overlay-put vertico--candidates-ov 'after-string (apply #'concat lines))
- (vertico--resize-window (length lines))))
+ (vertico--resize)))
(advice-add 'vertico--display-candidates :around #'jao-vertico--display))
diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el
index 70823ef..a7059c6 100644
--- a/custom/jao-custom-gnus.el
+++ b/custom/jao-custom-gnus.el
@@ -447,13 +447,19 @@
(use-package org-capture
:config
(add-to-list 'org-capture-templates
+ '("x" "arXiv" entry (file "notes/physics/arxiv.org")
+ "* %(jao-gnus-subject)\n\n %i\n %(jao-gnus-org-url)"
+ :immediate-finish t)
+ t)
+ (add-to-list 'org-capture-templates
'("X" "arXiv" entry (file "notes/physics/arxiv.org")
- "* %:subject\n\n(jao-gnus-org-paragraph \"%i\")"
+ "* %(jao-gnus-subject)\n\n%(jao-gnus-org-paragraph \"%i\")"
:immediate-finish t)
t)
(org-capture-upgrade-templates org-capture-templates))
(defvar jao-gnus-org-url nil)
+(defun jao-gnus-org-url () jao-gnus-org-url)
(defun jao-gnus-org-paragraph (x)
(with-temp-buffer
(insert " " (string-trim (or x "")) "\n ")
@@ -462,22 +468,27 @@
(goto-char (point-max))
(open-rectangle 0 (point))
(concat (buffer-string) "\n " (or jao-gnus-org-url ""))))
+(defvar jao-gnus-subject nil)
+(defun jao-gnus-subject () jao-gnus-subject)
(defun jao-gnus-arXiv-capture ()
(interactive)
(unless (derived-mode-p '(gnus-summary-mode)) (gnus-article-show-summary))
- (setq jao-subject (gnus-summary-article-subject))
+ (setq jao-gnus-subject (gnus-summary-article-subject))
(gnus-summary-select-article-buffer)
(gnus-article-goto-part 0)
(setq-local transient-mark-mode 'lambda)
(set-mark (point))
(forward-paragraph)
- (save-excursion
- (when (re-search-forward "^Link" nil t)
- (beginning-of-line)
- (setq jao-gnus-org-url (org-eww-url-below-point))))
- (org-capture nil "X")
- (set-mark (point))
+ (or (and (save-excursion
+ (when (re-search-forward "^Link" nil t)
+ (beginning-of-line)
+ (setq jao-gnus-org-url (org-eww-url-below-point))))
+ (org-capture nil "X"))
+ (and (save-excursion
+ (when (re-search-forward "^URL: " nil t)
+ (setq jao-gnus-org-url (thing-at-point-url-at-point))))
+ (org-capture nil "x")))
(gnus-article-show-summary))
;;; article
@@ -558,7 +569,7 @@
(save-excursion
(goto-char (point-min))
(when (or (search-forward-regexp "^Via: h" nil t)
- (search-forward-regexp "^URL: h" nil t)
+ (search-forward-regexp "^URL:[\n ]h" nil t)
(and (search-forward-regexp "^Link$" nil t)
(not (beginning-of-line))))
(cond (external (jao-browse-with-external-browser))
@@ -689,6 +700,7 @@
(jao-gnus--notify)))
(add-hook 'gnus-summary-exit-hook #'jao-gnus--on-summary-exit)
+(add-hook 'gnus-exit-group-hook #'jao-gnus--notify)
;;;; open mail file in gnus
(defun jao-gnus-file-to-group (file &optional maildir newsdir m-server n-server)
diff --git a/init.el b/init.el
index 4f54b41..51a48f7 100644
--- a/init.el
+++ b/init.el
@@ -930,6 +930,13 @@
scroll-step 1
redisplay-skip-fontification-on-input nil))
+;;;; show diffs when running C-x s
+(add-to-list 'save-some-buffers-action-alist
+ `("d"
+ ,(lambda (buffer)
+ (diff-buffer-with-file (buffer-file-name buffer)))
+ "show diff between the buffer and its file"))
+
;;; Windows
;;;; splitting and switch
(setq split-height-threshold 80
@@ -1529,9 +1536,9 @@
:hook ((doc-view-mode . jao-doc-session-mark))
:bind (:map doc-view-mode-map
("j" . doc-view-next-line-or-next-page)
- ("J" . doc-view-scroll-up-or-next-page)
+ ("J" . doc-view-search-next-match)
("k" . doc-view-previous-line-or-previous-page)
- ("K" . doc-view-scroll-down-or-previous-page)
+ ("K" . doc-view-search-previous-match)
("z" . jao-open-with-zathura)))
(use-package jao-doc-session :demand t)
diff --git a/lib/doc/jao-org-notes.el b/lib/doc/jao-org-notes.el
index 43b8c09..d3f18b8 100644
--- a/lib/doc/jao-org-notes.el
+++ b/lib/doc/jao-org-notes.el
@@ -1,6 +1,6 @@
;;; jao-org-notes.el --- A simple system for org note taking -*- lexical-binding: t; -*-
-;; Copyright (C) 2020, 2021, 2022, 2024 jao
+;; Copyright (C) 2020, 2021, 2022, 2024, 2025 jao
;; Author: jao <mail@jao.io>
;; Keywords: tools
@@ -74,11 +74,12 @@
(defun jao-org-notes--consult-rg (prompt &optional cat no-req cmd initial)
(let ((default-directory (expand-file-name (or cat "") jao-org-notes-dir)))
(consult--read
- (consult--async-command #'jao-org-notes--rg-title-or-tags
- (consult--async-transform jao-org-notes--matches))
+ (consult--async-pipeline
+ (consult--process-collection #'jao-org-notes--rg-title-or-tags)
+ (consult--async-transform #'jao-org-notes--matches))
:prompt prompt
- :initial (consult--async-split-initial (or initial ""))
- :add-history (concat (consult--async-split-initial (thing-at-point 'symbol)))
+ :initial (or initial "")
+ :add-history (thing-at-point 'symbol)
:require-match (not no-req)
:category 'jao-org-notes-lookup
:group 'jao-org-notes--consult-group
diff --git a/lib/eos/jao-dirmon.el b/lib/eos/jao-dirmon.el
index 0edb3a3..117da85 100644
--- a/lib/eos/jao-dirmon.el
+++ b/lib/eos/jao-dirmon.el
@@ -1,6 +1,6 @@
;;; jao-dirmon.el --- little utility to monitor disk usage -*- lexical-binding: t; -*-
-;; Copyright (C) 2022, 2024 jao
+;; Copyright (C) 2022, 2024, 2025 jao
;; Author: jao <mail@jao.io>
;; Keywords: tools
@@ -71,7 +71,7 @@
(dolist (c current)
(let ((d (- (cdr c) (alist-get (car c) old 0 nil #'string=))))
(when (> (abs d) jao-dirmon-threshold)
- (push c high))))
+ (push (cons (car c) d) high))))
(setq jao-dirmon-last-delta high)
(jao-dirmon--show-deltas old current jao-dirmon-last-delta)
jao-dirmon-last-delta))
diff --git a/lib/media/jao-mpris.el b/lib/media/jao-mpris.el
index 3bb2636..80d0675 100644
--- a/lib/media/jao-mpris.el
+++ b/lib/media/jao-mpris.el
@@ -1,6 +1,6 @@
;;; jao-mpris.el --- mpris players control -*- lexical-binding: t; -*-
-;; Copyright (C) 2020, 2021, 2022, 2024 jao
+;; Copyright (C) 2020, 2021, 2022, 2024, 2025 jao
;; Author: jao <mail@jao.io>
;; Keywords: multimedia
@@ -158,25 +158,25 @@
(defun jao-mpris--handler (iname properties &rest _args)
(let ((inhibit-message t))
- (message "Received properties: %S from %s" properties iname))
- (when-let (md (caadr (assoc "Metadata" properties)))
- (let ((tno (caadr (assoc "xesam:trackNumber" md)))
- (tlt (caadr (assoc "xesam:title" md)))
- (art (caadr (assoc "xesam:artist" md)))
- (alb (caadr (assoc "xesam:album" md)))
- (len (caadr (assoc "mpris:length" md))))
- (if (string= (or tlt "") "TIDAL")
- (jao-mpris-reset)
+ (message "Received properties: %S from %s" properties iname)
+ (when-let (md (caadr (assoc "Metadata" properties)))
+ (let ((tno (caadr (assoc "xesam:trackNumber" md)))
+ (tlt (caadr (assoc "xesam:title" md)))
+ (art (caadr (assoc "xesam:artist" md)))
+ (alb (caadr (assoc "xesam:album" md)))
+ (len (caadr (assoc "mpris:length" md))))
(jao-mpris--set-current 'track tno)
(jao-mpris--set-current 'title tlt)
(jao-mpris--set-current 'artist art)
(jao-mpris--set-current 'album alb)
- (jao-mpris--set-current 'length len))))
- (when-let (st (caadr (assoc "PlaybackStatus" properties)))
- (jao-mpris--set-current 'status st)
- (when (string= st "Stopped")
- (dolist (k '(track title artist album length))
- (jao-mpris--del-current k))))
+ (jao-mpris--set-current 'length len)))
+ (when-let (st (caadr (assoc "PlaybackStatus" properties)))
+ (jao-mpris--set-current 'status st)
+ (when (string= st "Stopped")
+ (dolist (k '(track title artist album length))
+ (jao-mpris--del-current k))))
+ ;; (message "Current is: %S" jao-mpris--current)
+ )
(jao-mpris--track jao-mpris--current))
;;;###autoload
diff --git a/lib/net/randomsig.el b/lib/net/randomsig.el
index cb37694..05b95ab 100644
--- a/lib/net/randomsig.el
+++ b/lib/net/randomsig.el
@@ -1,6 +1,6 @@
;;; randomsig.el --- insert a randomly selected signature
-;; Copyright (C) 2001, 2002, 2013, 2020, 2021 Hans-Jürgen Ficker
+;; Copyright (C) 2001, 2002, 2013, 2020, 2021, 2024 Hans-Jürgen Ficker
;; Emacs Lisp Archive Entry
;; Author: Hans-Juergen Ficker <hj@backmes.de>
@@ -277,8 +277,11 @@ You probably want to have a newline at the end of it."
(defun randomsig-prompt (&optional prompt)
;; Prompt for a signature file.
(let ((files (randomsig-files-to-list randomsig-files)))
- (completing-read (if prompt prompt "signature: ")
- (mapcar 'list files) nil t nil randomsig-history (car files))))
+ (if (cdr files)
+ (completing-read (if prompt prompt "signature: ")
+ (mapcar 'list files) nil t nil
+ randomsig-history (car files))
+ (car files))))
(defun randomsig-read-signatures-to-buffer (buffer-name &optional files)
;; read the signatures into the signature buffer